News Feed
Sections




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

Codeception.com:
Nothing is Untestable AspectMock in Action
August 01, 2013 @ 11:26:12

On the Codeception site they've posted a guide to using the AspectMock feature of the testing tool to prove that "nothing is untestable."

We already announced AspectMock, the mocking framework that may dramatically change the way you do testing in PHP. In this video Jeffrey Way shows how AspectMock is different from others. In this post we will demonstrate its powers too, and we will try to break some stereotypes about PHP testing. To get the code tested, you should always keep in mind how you would write a test for it. We know unit testing requires some good practices to follow and bad practices to avoid.

Their first example involves testing singletons, notorious for being difficult to test because of their "global" state. He also gives a more practical example using a Yii2-based application and a login form. True to its name, the AspectMock uses Aspect Oriented Programming concepts to make the "magic" happen behind the scenes.

0 comments voice your opinion now!
codeception aspect mock aspectoriented unittest singleton

Link: http://codeception.com/07-31-2013/nothing-is-untestable-aspect-mock.html

blog comments powered by Disqus

Similar Posts

Paul Jones' Blog: When Possible, Use File *Resources* Instead Of File *Names*

Sebastian Bergmann\'s Blog: PHPUnit 3.0

Fabian Schmengler's Blog: "Mocking" built-in functions like time() in Unit

Michael Girouard's Blog: One Step Closer to an Abstract Singleton

Ant Phillips' Blog: Singletons, BIRT, Theads and PHP


Community Events





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


release podcast voicesoftheelephpant symfony update series version interview introduction library package security laravel opinion language composer tool mvc community framework

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