Skip to content

Instantly share code, notes, and snippets.

@lstrojny
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lstrojny/9637743 to your computer and use it in GitHub Desktop.
Save lstrojny/9637743 to your computer and use it in GitHub Desktop.
<?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