News Feed
Sections




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

Benjamin Eberlei's Blog:
Test your Legacy PHP Application with Function Mocks!
March 31, 2009 @ 11:18:31

Benjamin Eberlei has a suggestion for testing your application without having to mess around with creating new resources just for testing - use mocks.

Much talking is going on about Unit testing, Mocks and TDD in the PHP world. For the most this discussions surround object-oriented PHP code, frameworks and applications. Yet I would assert that the reality for PHP developers (me included) is dealing with PHP 4, PHP 5 migrated, or non-object oriented legacy applications which are near to impossible to bring under test.

He includes a "proof of concept" for a replacement mysql_query function (as created inside of Runkit) that sets up a "mocker" object that returns a "hello world" message when the mysql_query function is called.

0 comments voice your opinion now!
mock function runkit proofofconcept mysqlquery resource


blog comments powered by Disqus

Similar Posts

ThinkPHP Blog: Accessing NTLM secured resources with PHP

PHPit.net: A beginners introduction to PHP\'s file functions

Vinu Thomas' Blog: PHP functions in Javascript using PHP.JS

Lars Tesmer's Blog: How to Unit Test a Class Making Calls to an URL (or the Filesystem) With PHPUnit

NetTuts.com: How to Write Testable and Maintainable Code in PHP


Community Events

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


community voicesoftheelephpant release opinion video introduction series list library unittest api version laravel interview php7 framework laravel5 language podcast example

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