-
-
Save stof/227f6d405bd71f44f3389a9a6a4699a3 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
<?php | |
class Bar | |
{ | |
public function doSth() | |
{ | |
echo 'sth'; | |
} | |
} |
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
<?php | |
class Foo | |
{ | |
/** | |
* @param VO $vo | |
*/ | |
public function handle(VO $vo) | |
{ | |
$vo->bar->doSth(); | |
} | |
} |
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
<?php | |
class FooSpec extends ObjectBehavior | |
{ | |
function it_should_call_do_sth(Bar $bar) | |
{ | |
$vo = new VO(); | |
/* $bar is actually a \PhpSpec\Wrapper\Collaborator when running the spec */ | |
$vo->bar = $bar->getWrappedObject(); | |
$this->handle($vo); | |
$bar->doSth()->shouldHaveBeenCalled(); | |
} | |
} |
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
Test fails with: | |
- it should call do sth | |
no calls have been made that match: | |
Double\Bar\P90->doSth() | |
but expected at least one. | |
0 vendor/phpspec/prophecy/src/Prophecy/Prediction/CallPrediction.php:76 | |
throw new Prophecy\Exception\Prediction\NoCallsException("No calls have been made t...") | |
1 vendor/phpspec/prophecy/src/Prophecy/Prophecy/MethodProphecy.php:295 | |
Prophecy\Prediction\CallPrediction->check([array:0], [obj:Prophecy\Prophecy\ObjectProphecy], [obj:Prophecy\Prophecy\MethodProphecy]) | |
2 vendor/phpspec/prophecy/src/Prophecy/Prophecy/MethodProphecy.php:315 | |
Prophecy\Prophecy\MethodProphecy->shouldHave([obj:Prophecy\Prediction\CallPrediction]) | |
3 spec/FooSpec.php:24 | |
Prophecy\Prophecy\MethodProphecy->shouldHaveBeenCalled() | |
4 [internal] | |
spec\FooSpec->it_should_call_do_sth([obj:PhpSpec\Wrapper\Collaborator]) | |
5 vendor/phpspec/phpspec/src/PhpSpec/Runner/ExampleRunner.php:143 | |
ReflectionMethod->invokeArgs([obj:spec\FooSpec], [array:1]) | |
6 vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:831 | |
Symfony\Component\Console\Command\Command->run([obj:Symfony\Component\Console\Input\ArgvInput], [obj:Symfony\Component\Console\Output\ConsoleOutput]) | |
7 vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:186 | |
Symfony\Component\Console\Application->doRunCommand([obj:PhpSpec\Console\Command\RunCommand], [obj:Symfony\Component\Console\Input\ArgvInput], [obj:Symfony\Component\Console\Output\ConsoleOutput]) | |
8 vendor/phpspec/phpspec/src/PhpSpec/Console/Application.php:97 | |
Symfony\Component\Console\Application->doRun([obj:Symfony\Component\Console\Input\ArgvInput], [obj:Symfony\Component\Console\Output\ConsoleOutput]) | |
9 vendor/phpspec/phpspec/bin/phpspec:26 | |
Symfony\Component\Console\Application->run() |
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
<?php | |
class VO | |
{ | |
/** @var Bar */ | |
public $bar; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment