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

Matthew Turland:
Customizing Codeception Database Cleanup
May 12, 2014 @ 11:15:24

If you're a Codeception user, you'll find Matthew Turland's latest post interesting. In it he shares a way to customize database cleanup between the tests. Codeception handles it a bit differently that how PHPUnit's Db module does.

Recently, I was looking into ways to speed up the runtime of the test suite at Blopboard. We use the Codeception framework to write functional tests for our REST API, part of which entails putting the database into a known state using Codeception's Db module. The behavior of this module is similar to that of the PHPUnit Database extension with one exception: where PHPUnit only truncates tables and leaves their schemas intact, Codeception removes the database structure and expects the SQL dump it uses to recreate it between tests. I must admit to not understanding this design decision of Codeception, nor attempts to clarify it.

He admits that his solution is "a bit hacky" but it does work to truncate the table rather than drop the entire schema and wait for a rebuild. His "DbHelper" class is used in place of the Db module. He traced through the execution path of the Db module and found a "hook" where he could override the "cleanup" method to prevent the schema drop and replace it with a truncate. He also includes code for a suggested addition to Codception that would handle the same thing in a more integrated way.

0 comments voice your opinion now!
customize database cleanup codeception tutorial schema truncate phpunit

Link: http://matthewturland.com/2014/05/09/customizing-codeception-database-cleanup

Zumba Engineering Blog:
Mocking Singleton PHP classes with PHPUnit
November 26, 2012 @ 09:51:04

On the Zumba Engineering blog today Chris Taylor has a new post about mocking in PHPUnit, specifically how to handle those pesky Singleton methods lurking around your codebase.

In many of our projects, utilities and vendor classes are implemented with a singleton pattern. [...] In this post, we'll cover a nice way to inject a PHPUnit mock object for use in testing methods that utilize singleton classes.

He starts by introducing mocking and how to use mock classes in PHPUnit with a simple "sayHello" example. Adding on another layer, he creates a "SomeclassMock" class, defining its own "expects" and "cleanup" methods. This class forces the Singleton method to act more like a regular non-static method and "resets" it after each use.

0 comments voice your opinion now!
mocking phpunit class singleton expects cleanup tutorial


Richard Thomas' Blog:
ZF please before you go 2.0 gunho please clean out the attic
January 28, 2010 @ 12:20:21

Richard Thomas has a suggestion for the Zend Framework development group - clean out the attic before you hit the 2.0 mark.

A big focus of 2.0 it seems is going to be performance and cleaning up the structure to make use of php 5.3 features which is great, I have been preaching the need for ZF to start taking performance as a real concern for a while now. On the other hand they have gotten to a certain point that they need to reflect on what they already have and not let the spiderwebs grow to large.

Richard points out that the Zend Framework, which has a focus on being a "business-class framework" and having the best to offer, has quite a few parts of it that are older and aren't well maintained. This sort of thing could cause some big problems down the line and could even cause some doubt over the developer's choice of frameworks.

1 comment voice your opinion now!
zendframework opinion cleanup maintenance


SDA Asia:
Yahoo Helping Zend with PHP 6, says Andi Gutmans
July 21, 2006 @ 05:33:28

According to this post on the SDA Asia site today, Andi Gutmans is quoted as saying that Yahoo is doing their share in helping PHP6 come along that much faster.

Yahoo is Helping Zend with PHP 6, says Andi Gutmans co-founder and vice president of technology at Israeli-based company Zend Technologies, in an interview with Stephen Shankland of c|net news. PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.

They mention what PHP6 will be and include a link to the (oldish) meeting notes concerning it. Be sure to check out the comments for some interesting questions...

0 comments voice your opinion now!
yahoo help php6 zend cleanup apc oop unicode yahoo help php6 zend cleanup apc oop unicode



Community Events





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


zendserver framework series laravel list update library release community api opinion symfony podcast interview language package introduction deployment tips install

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