Recently in PHPUnit Category

phpUnderControl is a customization of CruiseControl.

For those wanting to run CruiseControl behind an Apache webserver without configuring mod_jk or the like, this short how-to is just right.

Installing phpUnderControl / CruiseControl

This article is not about installing phpUnderControl or CruiseControl. For refernces see http://www.phpundercontrol.org/ or http://cruisecontrol.sourceforge.net/.

Configuring Apache as a proxy

So we are considering you have your phpUnderControl / CruiseControl instance up and running at http://localhost:8080/. We are also considering you have an instance of the Apache webserver up and running.

First we'll need to enable the proxy module of Apache. Consult the apache manual on how to enable the module in your instance of the Apache webserver. Now edit your Apache vHost or httpd.conf configuration.

You need to make sure that mod_proxy.so and mod_proxy_http.so do point to the right location on your harddisk.

Fixing URLs

Proxying already works with this configuration, but unfortunately clicking any link in your installation of phpUnderControl / CruiseControl would point to the direct installation of the instance. This is where mod_jk would come into play. But as we're just wanting a quick and easy resolution for runnning phpUnderControl / CruiseControl behind the Apache webserver, we'll be solving this issue quite easily:

Make sure to enable the ext_filter module. Now edit your Apache vHost or httpd.conf configuration again:

Conclusion

Just restart your Apache webserver and your instance of phpUnderControl / CruiseControl should be running perfectly well behind your Apache webserver.

ipc_2008.png

Aside from being a member of the advisory board of this years International PHP Conference, I will present one Full Day Workshop and one session at this year's edition of the International PHP Conference:

Quality Assurance in PHP Projects - In-Depth Best-Practises

Full Day Workshop

So you know PHPUnit, Selenium, phpUnderControl or CruiseControl and other tools to support testing efforts during your development process. But how does the puzzle of all those tools actually fit in your development process? During this Power Workshop Max Horváth and Wojciech Duda of studiVZ Ltd. will tell you about the everyday life at the Quality Assurance Business Unit. You will learn about best practices, which actually work and fit into an extremely fast moving iteration cycle at one of the biggest and fastest growing Social Networks in Europe. Talking about PHPUnit and Selenium, including tips on how to optimize using those tools, we will also show show you how you should integrate the testing process into your main development process, to be as lightweight and efficient as possible.

I will present this session together with my colleague Wojciech Duda.

Making Selenium Test Writing easier using a DSL

60 minutes Session

Implementing automated tests by using Seleniums API methods has several drawbacks. Selenium is great for what it does, providing a generic framework for testing a generic application. Using the Testing_SeleniumDSL framework, I will show you how to create your own Domain Specific Language (DSL), which would allow you to write tests in the language of your business rather than in Seleniums language.

I hope to see you in Mainz, Germany in late October!

Yes! Sebastian Bergmann did it: just one day after requesting a colorful output of PHPUnit's command line interface, he committed a patch to PHPUnit's trunk, which should be released with the next release. Thank you!

feature-request-completed.jpg

Update

Sebastian seems to like "the feature", too - he just blogged about it. Horray!

phpunit-output-success.jpg phpunit-output-failure.jpg

A few days ago I came across Josh Carters blog. I saw a very nice suggestion have your unit tests output the results in green or red bar - depending if the tests passed or failed.

unit_test_green_red_bar.jpg

I really like the idea and will be requesting the inclusion of ansi coloring to Sebastian Bergmann - I'd really like to see this feature being added to PHPUnit.

While it's absolutly correct that direct access to private properties is strictly forbidden in PHP, it's quite disturbing that even reflection cannot do it when you're writing Unit Tests. Sometimes you just want to test whether a private property contains the correct data. With the normal visibility rules you cannot access those from your Unit Tests.

Luckily, as I just read at Tobias Schlitt's Blog, Derick Rethans committed a patch to the PHP 5.3 repository, which allows you to get things done quite easily. You still need to explicitly state that you want to access the value of a protected/private property through reflection by the new method setAccessible(). It's a good thing to avoid people doing stupid things accidentally, but you finally get the access to it.

PHP 5.3 you'll be able to access private properties like this:

But until we'll see a stable PHP 5.3, there we're many working "hacks", which worked for some versions of PHP 5.x - the most current one would be this:

This should get you up and running for PHP 5.2.5 ("older hacks" won't work).

So how could you use it?

I hope those lines of code will help you until PHP 5.3 arrives, as it helps our developers.

Update

As Sebastian points out in his comment to this post, PHPUnit has had support for testing private and protected attributes for quite a while. It can be used via:

I should be reading the documentation much more thoroughly next time (even though I must admit, that none of our developers has known this method, too).

August 2008: Monthly Archives

Recent Activity

Sunday

  • I tweeted, "Let's continue working on the iPhone app ... but WTF does Apple keep the NDA?"
  • I tweeted, "Let's get some sleep - developing an iPhone application has been a lot of fun today ..."
Friday

  • I tweeted, "I'm off to the weekend - thanks god! And it's it's just another 11 days until the next holidays to southern spain ..."

More ...

Programming Blogs - BlogCatalog Blog Directory
Creative Commons License
This weblog is licensed under a Creative Commons License. blogoscoop

About this Archive

This page is a archive of recent entries in the PHPUnit category.

PHP is the previous category.

Testing is the next category.

Find recent content on the main index or look in the archives to find all content.