Skip to content

Instantly share code, notes, and snippets.

@viirre
Last active April 10, 2018 18:39
Show Gist options
  • Save viirre/64750fd70560bdf4090433e4c8d44e02 to your computer and use it in GitHub Desktop.
Save viirre/64750fd70560bdf4090433e4c8d44e02 to your computer and use it in GitHub Desktop.
Test #1 - make SomeService testable without actually making any https calls
<?php
class SomeService
{
public function callApi()
{
$apiClass = new ApiClass;
$result = $apiClass->call('fetch');
// Handle result
}
}
class ApiClass {
public function call($method)
{
// Makes external http call
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment