Skip to content

Instantly share code, notes, and snippets.

@gquemener
Last active December 18, 2015 03:59
Show Gist options
  • Save gquemener/5722064 to your computer and use it in GitHub Desktop.
Save gquemener/5722064 to your computer and use it in GitHub Desktop.
Which one is the clearest?
<?php
//PHPUnit
public function testApply() {
$mock = $this->getMock('My\Foo\Class', array('apply'));
$mock->expects($this->any())
->method('apply')
->with('foo')
->will($this->returnValue('bar'));
$target = new My\Bar\Class($mock);
$this->assertEquals('bar', $target->apply('foo'));
}
//PhpSpec2/Prophecy
/**
* @param My\Foo\Class $foo
*/
function it_should_apply_foo_modificator($foo) {
$this->beConstructedWith($foo);
$foo->apply(Argument::exact('foo'))->willReturn('bar');
$this->apply('foo')->shouldReturn('bar');
}
@docteurklein
Copy link

:D i love trolling.

@gquemener
Copy link
Author

oh you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment