RSS - Latest posts Posts Tagged ‘Code’

Home » Tags » Code
15Dec
2009

PHPUnit & Selenium – screenshot path problem

PHPUnit_Framework_Exception: Response from Selenium RC server for testComplete().
ERROR: Command execution failure. Please search the forum at http://clearspace.openqa.org for error details from the log window.
The error message is: Component returned failure code: 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsILocalFile.initWithPath]

Setting up Selenium RC server together with PHPUnit has proven surprisingly easy… Well most of it. Every now and then as a beginner you might run into monster errors like the one above. No fear, what Selenium is trying to tell you is just that your path is wrong.

For me it happened when trying to setup the error screenshot variables:

protected $captureScreenshotOnFailure = TRUE;
protected $screenshotPath = '/var/www/localhost/htdocs/screenshots';
protected $screenshotUrl = 'http://localhost/screenshots';

In case you wonder the path relates to the browser’s host not the Selenium RC host (if they are different), In my case the browsers are run on a windows box, with the Selenium RC setup on a Linux machine. Thus the error about the inapropriate $screenshotPath.

Categories:

30Jul
2009

Autloading modular forms & models in Zend Framework 1.8

It’s not really obvious with the error messages you get, but using a thing like Form_Login does not work out of the box with a modular structure. Which is slightly surprising considering that it’s inside the default module.

I have found examples like the second one below, but no one mentions that you actually declare the default namespace too for everything to work.

$autoloader = new Zend_Application_Module_Autoloader(array(
	'namespace' => '',
	'basePath'  => APPLICATION_PATH .'/modules/default',
	'resourceTypes' => array (
		'form' => array(
		'path' => 'forms',
		'namespace' => 'Form',
    ),
	'model' => array(
		'path' => 'models',
		'namespace' => 'Model',
    	),
    )
));

$autoloader = new Zend_Application_Module_Autoloader(array(
	'namespace' => 'Admin_',
	'basePath'  => APPLICATION_PATH .'/modules/admin',
	'resourceTypes' => array (
		'form' => array(
		'path' => 'forms',
		'namespace' => 'Form',
    ),
	'model' => array(
		'path' => 'models',
		'namespace' => 'Model',
    	),
    )
));

Categories:

9May
2009

Doctrine Many To Many With Extra Fields

Recently I have started using Doctrine with Zend Framework. Most of the time it is great, but sometimes I get stuck on this or that issue. Most of my problems so far have been connected with the Many to Many relationship. Here are a few tips I learned the hard way. (more…)

Categories:

26Apr
2009

Week of the Month in Mysql

SELECT WEEK(my_date_field,5) -
WEEK(DATE_SUB(my_date_field, INTERVAL DAYOFMONTH(my_date_field)-1 DAY),5)+1

(more…)

Categories:

22Apr
2009

Zend_Db_Select multiple table joins explained

It sounds like a simple task – retrieve the result from a join SQL query. Unusually you can even find documentation on the official Zend Framework site explaining how to put together a query that will return the results from a JOIN query. Unfortunately when it actually comes to putting theory into practice any Zend newcomer can run into several problems. (more…)

Categories: