News Feed
Sections




News Archive
feed this:

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

Jachim Coudenys:
Using multiple databases in phpunit/dbunit with Composer
November 21, 2012 @ 11:56:04

Jachim Coudenys has a new post to his site today showing you how to use multiple databases with phpunit/dbunit with functionality installed via Composer.

phpunit/dbunit is excellent, but you are stuck with one database. The guys at Etsy created very good extensions to fix this problem (MultipleDatabase), but it took me a while to figure out how to use it. Because PHPUnit is now available via Composer, you can fetch all dependencies with a single command.

He includes an example of a "composer.json" configuration file that pulls down tools including PHPUnit, dbunit, the Etsy extensions and Mockery for mock object testing. He suggests making a "parent class" to extend the DatabaseTest class to manage the database connections and includes an example of the code to get the connection and issue the method to check via the database assertions.

0 comments voice your opinion now!
phpunit unittest dbunit database multiple tutorial


Sebastian Bergmann's Blog:
RC2 Is The New RC1 (PHPUnit)
November 13, 2007 @ 10:24:00

Sebastian Bergmann has posted about the latest release of the popular unit testing framework for PHP, PHPUnit 3.2.

I have just released a second release candidate for PHPUnit 3.2, the next major version of the xUnit testing framework for PHP.

According to the Changelog, updates in this new Release Candidate include a number of updates to the software metrics that can be run on code (at project, file, function, class and method level), the addition of DbUnit, code coverage improvements, bug fixes to the TestUI test runner and Selenium integration and much more.

0 comments voice your opinion now!
phpunit unittest releasecandidate codecoverage software metric dbunit runner selenium phpunit unittest releasecandidate codecoverage software metric dbunit runner selenium


Mike Lively's Blog:
PHPUnit Database Extension (DBUnit Port)
September 03, 2007 @ 07:10:00

On his blog today, Mike Lively has posted about the work h's done to create a database extension for the popular unit testing software for PHP, PHPUnit.

For those that may not have read any of my previous postings on the subject the goal of this software is to extend the functionality of PHPUnit to allow using seed data to put a given database into a known state prior to executing each test. It also provides an easy mechanism to compare database contents with an expected dataset.

Mike has just completed the initial feature set for his project - more or less a port of DBUnit over to PHP. The post includes not only details about this initial release but also code that demonstrates its use. In his example, it's used to validate that a bank account has been created properly by comparng database information before and after the insert.

0 comments voice your opinion now!
phpunit dbunit database unittest extension phpunit dbunit database unittest extension


Mike Lively's Blog:
PHPDBUnit - Testing DB interaction with PHPUnit
June 21, 2007 @ 08:56:00

Mike Lively shares some info about a project he's been working on in a new post to his blog today - a port of Java's DBUnit functionality over to PHP to work happily with PHPUnit:

For those of you not familiar with DBUnit, it is a framework that allows you to easily and quickly test php code that modifies and works with database data. [...] With database code this [testing] is somewhat difficult because you have to ensure that your database is in a known state prior to running your tests.

He gives two examples, the first illustrates the difficulty that can come up when trying to test the database information with a normal unit test and the second an example of the same, but using his port of PHPDBUnit to delete information from the database. It uses two XML files in the test - one to seed the database and the other to give the expected export information.

Check out his post for more details on the port from Java and keep an eye out for a beta release of the library as soon as July.

0 comments voice your opinion now!
phpunit unittest phpdbunit java dbunit phpunit unittest phpdbunit java dbunit



Community Events





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


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

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