Skip to content

Conversation

@jdreesen
Copy link
Contributor

This is a proposed fix for #1.

It means a big change, but allows us to use PHPUnit's getMock() method for mock creation, which registers the created mocks to check their expectations, which is needed to check if a spy was actually called.

I chose not to extend PHPUnit_Framework_TestCase because with a trait you have the possilility to "patch" for example Silex\WebTestCase.

The spy test now fails like it should if we don't call the spy but I wasn't able to create a test with an expected exception becaue the exception is not thrown within the test but from PHPUnit itself and thus cannot be catched in the test (at least I don't know how).

This allows us to use PHPUnit's getMock() method for mock creation which registers the created mocks to check their expectations which is needed to check if a spy was actually called.
@jdreesen
Copy link
Contributor Author

Ough, I forgot that PHP 5.3 doesn't support traits :/

@mnapoli
Copy link
Owner

mnapoli commented Oct 18, 2015

👍 that's awesome. I'm fine with the BC break, and for dropping PHP 5.3 (it was needed for PHP-DI but now it supports 5.4).

@mnapoli
Copy link
Owner

mnapoli commented Oct 18, 2015

Released 0.2.0!

@jdreesen jdreesen deleted the trait branch October 18, 2015 13:21
@jdreesen
Copy link
Contributor Author

Oh, cool, I didn't expect that :)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants