1 November 2011
Recently I did a lot of Test Driven Development on my Symfony2 bundle. I used PHPUnit’s built-in mocks and stubs for many projects, so I took it again. But while I was working on mocking Symfony2 core objects I found those mocks very uncomfortable in use. I tried Mockery and it saved my day. Let’s see how to get it working with Symfony2 and how it kicks ass!
23 October 2011
Generally, it’s not a good idea to unit test protected or private methods, but in some cases it could be useful. Of course we don’t want to change our class contract, and expose those methods as a public ones, just becasue we want to test them with PHPUnit. This case can be solved with Proxy-Object library. It provides easy-to-use way to get protected classes to the surface. More about that is here http://blog.bastian-feder.de/blog/029_proxyObject.html. Here I’ll show how to integrate proxy object into your Symfony2 application: