Last active
December 18, 2015 03:59
-
-
Save gquemener/5722064 to your computer and use it in GitHub Desktop.
Which one is the clearest?
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 | |
//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'); | |
} |
I think phpunit is more clear.
you forget the <?php
. It's dirty.
the clearEST
:D i love trolling.
oh you!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you can even shorten your example by merging the let method with the example one.