Last active
August 29, 2015 13:57
-
-
Save lstrojny/9637743 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class TestCase extends PHPUnit_Framework_TestCase | |
{ | |
private $dep; | |
private $service; | |
public function setUp() | |
{ | |
$this->service = new Service(); | |
$this->dep = $this->getMock('Dependency'); | |
} | |
public function testInvokeIsCalled() | |
{ | |
$this->dep | |
->expects($this->once()) | |
->method('invoke'); | |
$this->service->execute($this->dep); | |
} | |
} | |
interface Dependency | |
{ | |
public function invoke(); | |
} | |
class Service | |
{ | |
public function execute(Dependency $dep) | |
{ | |
$dep->invoke(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment