LogoPhly, boy, phly
the weblog and site of Matthew Weier O'Phinney

Monday, June 30. 2008

Testing Zend Framework MVC Applications

Since I originally started hacking on the Zend Framework MVC in the fall of 2006, I've been touting the fact that you can test ZF MVC projects by utilizing the Request and Response objects; indeed, this is what I actually did to test the Front Controller and Dispatcher. However, until recently, there was never an easy way to do so in your userland projects; the default request and response objects make it difficult to easily and quickly setup tests, and the methods introduced into the front controller to make it testable are largely undocumented.

So, one of my ongoing projects the past few months has been to create an infrastructure for functional testing of ZF projects using PHPUnit. This past weekend, I made the final commits that make this functionality feature complete.

The new functionality provides several facets:

  • Stub test case classes for the HTTP versions of our Request and Response objects, containing methods for setting up the request environment (including setting GET, POST, and COOKIE parameters, HTTP request headers, etc).
  • Zend_Dom_Query, a class for using CSS selectors (and XPath) to query (X)HTML and XML documents.
  • PHPUnit constraints that consume Zend_Dom_Query and the Response object to make their comparisons.
  • A specialized PHPUnit test case that contains functionality for bootstrapping an MVC application, dispatching requests, and a variety of assertions that utilize the above constraints and objects.

Continue reading "Testing Zend Framework MVC Applications"

Posted by Matthew Weier O'Phinney in PHP at 12:00 | Comments (51) | Trackbacks (3)
Defined tags for this entry: best practices, mvc, php, zend framework

Migrating OOP Libraries and Frameworks to PHP 5.3

With PHP 5.3 coming up on the horizon, I'm of course looking forward to using namespaces. Let's be honest, who wants to write the following line?


$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
 

when the more succinct:


$viewRenderer = HelperBroker::getStaticHelper('viewRenderer');
 

could be used? (Assuming you've executed 'use Zend::Controller::Action;' somewhere earlier...)

However, while namespaces will hopefully lead to more readable code, particularly code in libraries and frameworks, PHP developers will finally need to start thinking about sane standards for abstract classes and interfaces.


Continue reading "Migrating OOP Libraries and Frameworks to PHP 5.3"

Posted by Matthew Weier O'Phinney in PHP at 09:00 | Comments (58) | Trackbacks (3)
Defined tags for this entry: best practices, oop, php, zend framework

Friday, June 20. 2008

phpwomen at DPC08

So, one thing I forgot to mention in my DPC08 wrapup was my involvement with the phpwomen booth. Lig emailed me some months in advance asking if I'd be an official "booth babe" while at the conference -- basically wearing a T-shirt to show my support of the movement, and answering any questions that others might have regarding it. While I haven't been particularly active with phpwomen, I of course agreed.


Continue reading "phpwomen at DPC08"

Posted by Matthew Weier O'Phinney in PHP at 13:30 | Comments (3) | Trackbacks (0)
Defined tags for this entry: conferences, dpc08, php, phpwomen

DPC08 Wrapup

Last Friday and Saturday I spent at the Dutch PHP Conference, hosted by Ibuildings. Unfortunately, I had very little time to blog while there. I'd prepared my outlines and basic slides before heading to the conference, but had a large number of screenshots and images to prepare that kept me up until the wee hours of the morning each day. In addition, the conference was extremely well organized -- which meant that any time not spent speaking was spent interacting with attendees or other speakers -- never a bad thing!


Continue reading "DPC08 Wrapup"

Posted by Matthew Weier O'Phinney in PHP at 07:33 | Comments (6) | Trackbacks (0)
Defined tags for this entry: amsterdam, conferences, dpc08, php, zend framework
(Page 1 of 1, totaling 4 entries)
  • Home
  • Resume
  • Blog
  • Phly PEAR Channel
  • Twitter
  • Contact Me
  • About this site

ZCE

Zend Education Advisory Board Member

Add to Technorati Favorites

Calendar

Back June '08 Forward
Mon Tue Wed Thu Fri Sat Sun
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30            

Quicksearch

Links

  • PHLY - PHp LibrarY
  • Planet PHP
  • Zend Framework, where I'm project lead
  • Sebastian Bergmann
  • Cal Evans
  • Shahar Evron
  • Paul M. Jones
  • Bill Karwin
  • Mike Naberezny
  • Fabien Potencier
  • Ben Ramsey
  • Derick Rethans
  • Ralph Schindler
  • Marco Tabini

Archives

September 2010
August 2010
July 2010
Recent...
Older...

Categories

XML Linux
XML Personal
XML Aikido
XML Family
XML Programming
XML Dojo
XML Perl
XML PHP

All categories

Syndicate This Blog

XML RSS 0.91 feed
XML RSS 1.0 feed
XML RSS 2.0 feed
ATOM/XML ATOM 0.3 feed
ATOM/XML ATOM 1.0 feed
XML RSS 2.0 Comments

Show tagged entries

xml apache
xml best practices
xml books
xml conferences
xml cw09
xml decorators
xml dojo
xml dpc08
xml file_fortune
xml git
xml linux
xml mvc
xml oop
xml pear
xml perl
xml personal
xml php
xml phpworks08
xml programming
xml rest
xml ubuntu
xml vim
xml webinar
xml zendcon
xml zendcon08
xml zendcon09
xml zend framework
© 2004 - present, Matthew Weier O'Phinney
matthew-web <at> weierophinney.net