[TYPO3-dev] OT (somewhat): unit testing with typo3 4.x

Christoph Koehler christoph.koehler at gmail.com
Sun Mar 11 18:09:30 CET 2007


On Fri, 09 Mar 2007 13:47:44 -0600, Christoph Koehler  
<christoph.koehler at gmail.com> wrote:

> Am I missing something here? Is there a way around this?
>
> Thanks!
>
> Christoph

Turns out that it wasn't a bug but expected behavior in PHPUnit.
Also, we adapted Elmar's example to our environment, so now we just  
include this file in our tests and it seems to work. We use PHPUnit 3.1  
beta2 and Phing 2.3.0 beta1 for reports, xdebug for coverage reports and  
will soon try to incorporate Selenium as well.


-----------------------
<?php

$key = 'wec_assessment';   // extension key

// Fix part to set after class definition
if(!defined('PATH_site')) { // If running from command line

	// Setup environment
	$path = $_SERVER['PWD'] .'/'. $_SERVER['SCRIPT_NAME'];
	
	if(!preg_match('|(.*)(typo3conf.*)(' . $key . '/tests)|', $path,  
$matches)) {
		if(!preg_match('|(.*)(typo3/sysext.*)(' . $key . '/tests)|', $path,  
$matches))
			exit(chr(10) . 'Unknown installation path' . chr(10). $path . chr(10));
     }

     define('PATH_site', $matches[1]);
     $GLOBALS['TYPO3_LOADED_EXT'][$key]['siteRelPath']= $matches[2] . $key  
. '/';
     define('PATH_t3lib', PATH_site . 't3lib/');
     require_once(PATH_t3lib . 'class.t3lib_div.php');
     require_once(PATH_t3lib . 'class.t3lib_extmgm.php');
     define('PATH_tslib', PATH_site.'typo3/sysext/cms/tslib/');
	
}


?>
-------------------

Christoph




More information about the TYPO3-dev mailing list