Snippets

Create an account or login to be able to add, comment and rate snippets.

Navigation

Snippets by user Marco Catunda Snippets by user Marco Catunda

Run all test in plugins and applications

I've been using the following code to run all tests in all plugins and applications.

Create an file with this code like 'run-all-test.php' and execute it in command line 'php run-all-test.php'.

Take a look at SF_ROOT_DIR, set the correct path of your ROOT project.

<?php
define( 'SF_ROOT_DIR', dirname(__FILE__).'/../../../..' );
include( SF_ROOT_DIR.'/config/config.php' );
 
require_once($sf_symfony_lib_dir.'/config/sfConfig.class.php');
require_once($sf_symfony_lib_dir.'/vendor/lime/lime.php');
require_once($sf_symfony_lib_dir.'/vendor/pake/pakeFinder.class.php');
 
$h = new lime_harness(new lime_output_color());
$h->base_dir = SF_ROOT_DIR;
 
// unit tests app
$h->register_glob( SF_ROOT_DIR.'/test/unit/*Test.php' );
$h->register_glob( SF_ROOT_DIR.'/test/unit/*/*Test.php' );
// functional tests app
$h->register_glob( SF_ROOT_DIR.'/test/functional/*Test.php');
$h->register_glob( SF_ROOT_DIR.'/test/functional/*/*Test.php');
 
// unit tests plugin
$h->register_glob( SF_ROOT_DIR.'/plugins/*Plugin/test/unit/*Test.php' );
$h->register_glob( SF_ROOT_DIR.'/plugins/*Plugin/test/unit/*/*Test.php' );
// functional tests plugin
$h->register_glob( SF_ROOT_DIR.'/plugins/*Plugin/test/functional/*Test.php' );
$h->register_glob( SF_ROOT_DIR.'/plugins/*Plugin/test/functional/*/*Test.php' );
 
$h->run();
 
by Marco Catunda on 2007-10-24, tagged test