Skip to content

Instantly share code, notes, and snippets.

@GromNaN
Created April 16, 2014 13:46
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 GromNaN/10878088 to your computer and use it in GitHub Desktop.
Save GromNaN/10878088 to your computer and use it in GitHub Desktop.
Prophecy vs PHPUnit MockObjects error messages

With Prophecy

jtamarelle@ox-dev-php ~/f/lexpress> phpunit tests/Routing/Matcher/ChainMatcherTest.php
PHPUnit 3.7.31 by Sebastian Bergmann.

Configuration read from /space/home/jtamarelle/front/lexpress/phpunit.xml.dist

.E...

Time: 518 ms, Memory: 11.00Mb

There was 1 error:

1) LExpress\Routing\Matcher\ChainMatcherTest::testRequestContextShouldBeInjectedIntoMatchers
Prophecy\Exception\Prediction\AggregateException: Some predictions failed:
  Double\UrlMatcherInterface\P5:
    No calls been made that match:
      Double\UrlMatcherInterface\P5->setContext(exact(Symfony\Component\Routing\RequestContext:000000000fc150cc0000000049e59ddb))
    but expected at least one.

/space/home/jtamarelle/front/lexpress/vendor/phpspec/prophecy/src/Prophecy/Prophet.php:119
/space/home/jtamarelle/front/lexpress/tests/TestCase.php:18

FAILURES!
Tests: 5, Assertions: 11, Errors: 1.

Generating code coverage report in Clover XML format ... done

Generating code coverage report in HTML format ... done

With PHPUnit MockObjects

jtamarelle@ox-dev-php ~/f/lexpress> phpunit tests/Routing/Matcher/ChainMatcherTest.php
PHPUnit 3.7.31 by Sebastian Bergmann.

Configuration read from /space/home/jtamarelle/front/lexpress/phpunit.xml.dist

.F...

Time: 394 ms, Memory: 9.50Mb

There was 1 failure:

1) LExpress\Routing\Matcher\ChainMatcherTest::testRequestContextShouldBeInjectedIntoMatchers
Expectation failed for method name is equal to <string:setContext> when invoked 1 time(s).
Method was expected to be called 1 times, actually called 0 times.


FAILURES!
Tests: 5, Assertions: 12, Failures: 1.

Generating code coverage report in Clover XML format ... done

Generating code coverage report in HTML format ... done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment