PHP in Action Rotating Header Image

Posts under ‘PHP’

How to test everything

They say there’s no free lunch, but at least there’s free breakfast. Last week I attended a “breakfast seminar” with Robert C. Martin (Uncle Bob). There really was free food.
Anyway, Uncle Bob held an extremely entertaining and useful introduction to the FitNesse testing tool. He got me hooked on it, but I’m even more fascinated [...]

Zend_Test

I admit I don’t follow Zend Framework very closely, since I haven’t been using it for any serious work. But I did write a piece about testing a Zend Framework action controller with View Helpers.
This might need updating, since the testing capabilities of the Zend Framework have grown substantially since then. In [...]

More beautiful code

I got some interesting comments to my previous post on “beautiful code”. Some were pretty strong disagreements.
So am I wrong? Did I get carried away? Did my critical faculty go on vacation somewhere nice and sunny? I admit that sometimes I deliberately look at the positive and ignore the negative. (And sometimes [...]

Beautiful code

Max Horwath has published his slides on Making Selenium Test Writing easier using a DSL onlinefrom IPC 2008. Let me quote the whole short description:
Implementing automated tests by using Seleniums API methods has several [...]

Refactoring is design

Refactoring is by definition a design actitivity, since the definition of refactoring is “improving the design of existing code”. But is this generally and fully recognized? After attending my friendly local agile conference (Smidig2008—sorry, it’s in Norwegian), I’m getting more of a feel for how different people think about it. And I’m wondering whether [...]

Get links with XPath

There’s a tutorial that appeared recently called Get Links With DOM. Planet PHP lists the author as Kevin Waterson, although his name is not mentioned on the page itself. Anyway, he claims:
Perhaps the biggest mistake people make when trying to get URLs or link text from a web page is trying to [...]

Many test methods versus custom assertions

This is something I posted to the Sitepoint PHP Application Design Forum with a little bit of added background.
The background is the idea that unit test methods, for the sake of readability, should test only one single behavior. This may mean several tests for one method under test, since one method may [...]

Type hints are more useful for scalars than objects

Max Horvath has implemented a library for type hinting scalars. That interests me, since I find that type hinting for objects has limited usefulness.
I tried using type hints extensively from [...]

Testing a Zend Framework action controller with View Helpers

I came across a Zend Framework (ZF) example I wanted to refactor. You really have to have unit test coverage to refactor effectively, and since there were no tests, I started trying to find out how to test it. There didn’t seem to be a wealth of information available on the web, so I’ve [...]

Flash messages

Redirects are useful in web programming, especially when implementing the Post-Redrect-Get pattern. But there is a problem with redirects: there is no simple way to send a message to the user across the redirect. When processing a GET request, you can display whatever messages you want. The most simplistic way is to echo them [...]