Last active
February 2, 2019 21:39
-
-
Save wodor/8089099 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function testRepositoryUsage() | |
{ | |
$id = 42; | |
$value = array('results'); | |
$repo = $this->getMock('Repository\FindsStuffInCity'); | |
$repo->expects($this->once()) | |
->method('findByCityId') | |
->with($id) | |
->will($this->returnValue($value)); | |
$sut = new Service($repo); | |
$this->assertEquals($value, $sut->getResultForCityId($id)); | |
} | |
function it_uses_stuffrepository_to_find_stuff(FindsStuffInCity $repository) | |
{ | |
$id = 42; | |
$value = array('result'); | |
$repository->findByCityId($id) | |
->shouldBeCalled() | |
->willReturn($value); | |
$this->getResultForCityId($id) | |
->shouldBeEqualTo($value); | |
} |
so what is the difference in design?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A simple yet brilliant comparison.