News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Sebastian Göttschkes' Blog:
Extending the Testclass for Unittests
May 02, 2012 @ 11:38:16

In his previous post Sebastian Göttschkes introduced a set of classes you could use for different types of testing in your Symfony2 applications. In his most recent post he expands on these examples, giving the UnitTestClass an extra ability.

In one of my last articles on Testclasses for symfony2 I explained some of the classes I use for my tests. Since then I found a great article on metatesting and want to update my UnitTest class to show some practical examples.

His update allows the class to access private properties via a "getAttribute" method that, via PHP's Reflection, allows you to pull out the private property's value and a "setAttribute" that lets you inject a value back in. He includes a word of warning, though - if you're using something like this often., you're probably "doing it wrong" and might need to think through your application design a bit more.

You can find the source for his classes in his previous post.

0 comments voice your opinion now!
unittest private method class symfony2


blog comments powered by Disqus

Similar Posts

Tillate.com Blog: Unit test practice at tilllate.com

Fabien Potencier's Blog: Create your own framework... on top of the Symfony2 Components (part 1)

Stoyan Stefanov's Blog: Reusing an existing database connection with MDB2

Maarten Balliauw's Blog: Office 2007 SpreadsheetML classes in PHP

Matthias Noback: A better PHP testing experience Part II: Pick your test doubles wisely


Community Events





Don't see your event here?
Let us know!


composer version interview tool language symfony api conference list voicesoftheelephpant community introduction unittest release opinion framework series configure laravel podcast

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework