Beispiel #1
0
 /**
  * Configures the enviroment for testing
  *
  * Does the following:
  *
  * * Loads the phpunit framework (for the web ui)
  * * Restores exception phpunit error handlers (for cli)
  * * registeres an autoloader to load test files
  */
 public static function configure_enviroment($do_whitelist = TRUE, $do_blacklist = TRUE)
 {
     if (!class_exists('PHPUnit_Util_Filter', FALSE)) {
         // Make sure the PHPUnit classes are available
         require_once 'PHPUnit/Framework.php';
     }
     if (Kohana::$is_cli) {
         restore_exception_handler();
         restore_error_handler();
     }
     spl_autoload_register(array('Kohana_Tests', 'autoload'));
     Kohana_Tests::$cache = ($cache = Kohana::cache('phpunit_whitelist_cache')) === NULL ? array() : $cache;
     $config = Kohana::config('phpunit');
     if ($do_whitelist and $config->use_whitelist) {
         self::whitelist();
     }
     if ($do_blacklist and count($config['blacklist'])) {
         foreach ($config->blacklist as $item) {
             if (is_dir($item)) {
                 PHPUnit_Util_Filter::addDirectoryToFilter($item);
             } else {
                 PHPUnit_Util_Filter::addFileToFilter($item);
             }
         }
     }
 }
 /**
  * Classe capable de prendre en charge les suites de test à lancer depuis le point d'entrée
  * test.php
  * Actuellement capable de lancer uniquement les tests relatifs au framework. Par la suite
  * il est souhaitable qu'il puisse prendre en charge le lancement des tests fonctionnels.
  *
  * @param	array	$pParams	Tableau de paramètres
  *
  * @todo être capable de lancer les tests fonctionnels avec ce controller.
  */
 public function process($pParams)
 {
     if (@(include_once 'PHPUnit/Framework.php')) {
         require_once COPIX_PATH . 'tests/CopixTest.class.php';
         require_once COPIX_PATH . 'tests/CopixDBTest.class.php';
         require_once COPIX_PATH . 'tests/CopixTestRunner.class.php';
         require_once COPIX_PATH . 'tests/CopixTestPrinter.class.php';
         require_once COPIX_PATH . 'tests/CopixTestXMLPrinter.class.php';
         // Ignore les fichiers de framework de test
         PHPUnit_Util_Filter::addDirectoryToFilter(dirname(__FILE__));
         PHPUnit_Util_Filter::addDirectoryToFilter(dirname(__FILE__) . '/framework');
         $this->_configFile = isset($pParams['conf']) ? $pParams['conf'] : '../project/config/copix.conf.php';
         if (!isset($_REQUEST['tests'])) {
             $this->testWelcome();
         } else {
             if (!isset($pParams['xml']) || $pParams['xml'] == false) {
                 $options['reportDirectory'] = COPIX_TEMP_PATH;
             }
             $options['xml'] = isset($pParams['xml']) && $pParams['xml'];
             CopixTestRunner::run($this->_getSuite(), $options);
         }
     } else {
         $this->showRequiredPHPUnit();
     }
 }
 /**
  * Overwrites beforeRunTests. Initiates coverage-report generation if 
  * $coverage has been set to true (@see setCoverageStatus).
  */
 protected function beforeRunTests()
 {
     if ($this->getCoverageStatus()) {
         // blacklist selected folders from coverage report
         foreach (TestRunner::$coverage_filter_dirs as $dir) {
             PHPUnit_Util_Filter::addDirectoryToFilter(BASE_PATH . '/' . $dir);
         }
         $this->getFrameworkTestResults()->collectCodeCoverageInformation(true);
     }
 }
Beispiel #4
0
 public function blacklistDirectories()
 {
     $directories = new DirectoryIterator(PROJECT_ROOT . DS . 'modules');
     foreach ($directories as $directory) {
         if (!$directory->isDot() && $directory->isDir()) {
             $path = $directory->getPathname() . DS . '_tests';
             if (is_dir($path)) {
                 PHPUnit_Util_Filter::addDirectoryToFilter($path, '.php');
             }
         }
     }
 }
Beispiel #5
0
 public static function suite()
 {
     PHPUnit_Util_Filter::addDirectoryToFilter(dirname(__FILE__));
     $suite = new PHPUnit_Framework_TestSuite();
     $suite->setName('SimpleDOM');
     foreach (glob(dirname(__FILE__) . '/*.php') as $filepath) {
         $name = basename($filepath, '.php');
         if ($name != 'AllTests') {
             $suite->addTestFile($filepath);
         }
     }
     return $suite;
 }
 public static function suite()
 {
     if (!class_exists('Kohana')) {
         throw new Exception('Please include the kohana bootstrap file.');
     }
     spl_autoload_unregister(array('Kohana', 'auto_load'));
     spl_autoload_register(array('Tests', 'auto_load'));
     $files = Kohana::list_files('tests');
     // Files to include in code coverage
     self::whitelist();
     $suite = new PHPUnit_Framework_TestSuite();
     $folders = Kohana::config('phpunit.filter_folders');
     foreach ($folders as $folder) {
         PHPUnit_Util_Filter::addDirectoryToFilter($folder);
     }
     self::addTests($suite, $files);
     return $suite;
 }
 /**
  * Overwrites beforeRunTests. Initiates coverage-report generation if 
  * $coverage has been set to true (@see setCoverageStatus).
  */
 protected function beforeRunTests()
 {
     if ($this->getCoverageStatus()) {
         // blacklist selected folders from coverage report
         $modules = $this->moduleDirectories();
         foreach (TestRunner::config()->coverage_filter_dirs as $dir) {
             if ($dir[0] == '*') {
                 $dir = substr($dir, 1);
                 foreach ($modules as $module) {
                     PHPUnit_Util_Filter::addDirectoryToFilter(BASE_PATH . '/' . $dir);
                 }
             } else {
                 PHPUnit_Util_Filter::addDirectoryToFilter(BASE_PATH . '/' . $dir);
             }
         }
         $this->getFrameworkTestResults()->collectCodeCoverageInformation(true);
     }
 }
 protected function prepare_harness()
 {
     if ($this->ver_phpunit < 3.5) {
         require_once 'PHPUnit/Framework.php';
         require_once 'PHPUnit/TextUI/ResultPrinter.php';
         require_once 'PHPUnit/TextUI/Command.php';
         PHPUnit_Util_Filter::addDirectoryToFilter($this->root, '.php', 'PHPUNIT', '');
     } elseif ($this->ver_phpunit < 3.6) {
         require_once 'PHPUnit/Autoload.php';
         require_once 'PHP/CodeCoverage.php';
         PHP_CodeCoverage::getInstance()->filter()->addDirectoryToBlacklist($this->root, '.php', '', 'PHPUNIT');
     } else {
         // PHPUnit 3.6+
         /**
          * Change to support PHPUnit 4+
          * These libraries are loaded in via phpunit.phar or don't exist in PHPUnit 4+
          */
         //require_once( 'PHPUnit/Autoload.php' );
         //require_once( 'PHP/CodeCoverage.php' );
         $this->add_directory_to_blacklist($this->root, '.php');
     }
 }
 /**
  * Initialize Task.
  * This method includes any necessary PHPUnit2 libraries and triggers
  * appropriate error if they cannot be found.  This is not done in header
  * because we may want this class to be loaded w/o triggering an error.
  */
 public function init()
 {
     if (version_compare(PHP_VERSION, '5.0.3') < 0) {
         throw new BuildException("PHPUnitTask requires PHP version >= 5.0.3", $this->getLocation());
     }
     /**
      * Determine PHPUnit version number
      */
     @(include_once 'PHPUnit/Runner/Version.php');
     $version = PHPUnit_Runner_Version::id();
     if (version_compare($version, '3.2.0') < 0) {
         throw new BuildException("PHPUnitTask requires PHPUnit version >= 3.2.0", $this->getLocation());
     }
     /**
      * Other dependencies that should only be loaded when class is actually used.
      */
     require_once 'phing/tasks/ext/phpunit/PHPUnitTestRunner.php';
     require_once 'phing/tasks/ext/phpunit/BatchTest.php';
     require_once 'phing/tasks/ext/phpunit/FormatterElement.php';
     /**
      * point PHPUnit_MAIN_METHOD define to non-existing method
      */
     if (!defined('PHPUnit_MAIN_METHOD')) {
         define('PHPUnit_MAIN_METHOD', 'PHPUnitTask::undefined');
     }
     /**
      * Add some defaults to the PHPUnit filter
      */
     $pwd = dirname(__FILE__);
     $path = realpath($pwd . '/../../../');
     if (version_compare($version, '3.5.0') >= 0) {
         PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist($path);
     } else {
         require_once 'PHPUnit/Framework.php';
         require_once 'PHPUnit/Util/Filter.php';
         PHPUnit_Util_Filter::addDirectoryToFilter($path);
     }
 }
Beispiel #10
0
/*
 * Set error reporting to the level to which Zend Framework code must comply.
 */
error_reporting(E_ALL | E_STRICT);
/*
 * Determine the root, library, and tests directories of the framework
 * distribution.
 */
$zfRoot = dirname(__FILE__) . '/..';
$zfCoreLibrary = "{$zfRoot}/library";
$zfCoreTests = "{$zfRoot}/tests";
/*
 * Omit from code coverage reports the contents of the tests directory
 */
foreach (array('php', 'phtml', 'csv') as $suffix) {
    PHPUnit_Util_Filter::addDirectoryToFilter($zfCoreTests, ".{$suffix}");
}
/*
 * Prepend the Zend Framework library/ and tests/ directories to the
 * include_path. This allows the tests to run out of the box and helps prevent
 * loading other copies of the framework code and tests that would supersede
 * this copy.
 */
$path = array($zfCoreLibrary, $zfCoreTests, get_include_path());
set_include_path(implode(PATH_SEPARATOR, $path));
/*
 * Load the user-defined test configuration file, if it exists; otherwise, load
 * the default configuration.
 */
if (is_readable($zfCoreTests . DIRECTORY_SEPARATOR . 'TestConfiguration.php')) {
    require_once $zfCoreTests . DIRECTORY_SEPARATOR . 'TestConfiguration.php';
Beispiel #11
0
require_once 'PHPUnit/Framework.php';
require_once 'PHPUnit/Framework/IncompleteTestError.php';
require_once 'PHPUnit/Framework/TestCase.php';
require_once 'PHPUnit/Framework/TestSuite.php';
require_once 'PHPUnit/Runner/Version.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once 'PHPUnit/Util/Filter.php';
// Set error reporting level
error_reporting(E_ALL | E_STRICT);
// Determine the root, library, and tests directories
$root_path = dirname(__FILE__) . '/..';
$library_path = "{$root_path}/library";
$tests_path = "{$root_path}/tests";
// Omit from code coverage reports the contents of the tests directory
foreach (array('php', 'phtml', 'csv') as $suffix) {
    PHPUnit_Util_Filter::addDirectoryToFilter($tests_path, ".{$suffix}");
}
// Set the include path to include Aspamia files first
$path = array($library_path, $tests_path, get_include_path());
set_include_path(implode(PATH_SEPARATOR, $path));
/**
 * Load the user-defined test configuration file, if it exists; otherwise, load
 * the default configuration.
 */
if (is_readable($tests_path . DIRECTORY_SEPARATOR . 'TestConfiguration.php')) {
    require_once $tests_path . DIRECTORY_SEPARATOR . 'TestConfiguration.php';
} else {
    require_once $tests_path . DIRECTORY_SEPARATOR . 'TestConfiguration.php.dist';
}
// Add the library files to the code coverage reports
if (defined('TESTS_GENERATE_REPORT') && TESTS_GENERATE_REPORT === true && version_compare(PHPUnit_Runner_Version::id(), '3.1.6', '>=')) {
<?php

set_include_path(implode(PATH_SEPARATOR, array(dirname(__FILE__), get_include_path())));
/**
 * The ethos_Test package require the Zend_Loader package from Zend Framework.
 * @link http://framework.zend.com/
 */
require_once 'Zend/Loader/Autoloader.php';
/**
 * Zend_Loader_Autoloader registers underscore-delimited psuedo-namespaces to
 * automatically load classes into memory as they're needed. For unit testing,
 * we expect that test fixtures will be subclassed in the "Test" namespace,
 * while base classes exist in the "ethos" namespace.
 *
 * @see Zend_Loader_Autoloader::registerNamespace()
 */
Zend_Loader_Autoloader::getInstance()->registerNamespace('Test')->registerNamespace('ethos');
// END Zend_Loader_Autoloader
require_once 'PHPUnit/Framework.php';
PHPUnit_Util_Filter::addDirectoryToFilter('Zend', '.php');
PHPUnit_Util_Filter::addDirectoryToFilter('Test', 'Test.php');
Beispiel #13
0
require_once 'security/all_tests.php';
require_once 'template/all_tests.php';
require_once 'text_processing/all_tests.php';
require_once 'dbal/all_tests.php';
require_once 'regex/all_tests.php';
require_once 'network/all_tests.php';
require_once 'random/all_tests.php';

// exclude the test directory from code coverage reports
if (version_compare(PHPUnit_Runner_Version::id(), '3.5.0') >= 0)
{
	PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist('./');
}
else
{
	PHPUnit_Util_Filter::addDirectoryToFilter('./');
}

class phpbb_all_tests
{
	public static function main()
	{
		PHPUnit_TextUI_TestRunner::run(self::suite());
	}

	public static function suite()
	{
		$suite = new PHPUnit_Framework_TestSuite('phpBB');

		$suite->addTest(phpbb_utf_all_tests::suite());
		$suite->addTest(phpbb_request_all_tests::suite());
Beispiel #14
0
 /**
  * @param array $classList
  * @param boolean $coverage
  */
 function runTests($classList, $coverage = false)
 {
     $startTime = microtime(true);
     // XDEBUG seem to cause problems with test execution :-(
     if (function_exists('xdebug_disable')) {
         xdebug_disable();
     }
     ini_set('max_execution_time', 0);
     $this->setUp();
     // Optionally skip certain tests
     $skipTests = array();
     if ($this->request->getVar('SkipTests')) {
         $skipTests = explode(',', $this->request->getVar('SkipTests'));
     }
     $classList = array_diff($classList, $skipTests);
     // run tests before outputting anything to the client
     $suite = new PHPUnit_Framework_TestSuite();
     natcasesort($classList);
     foreach ($classList as $className) {
         // Ensure that the autoloader pulls in the test class, as PHPUnit won't know how to do this.
         class_exists($className);
         $suite->addTest(new SapphireTestSuite($className));
     }
     // Remove the error handler so that PHPUnit can add its own
     restore_error_handler();
     /*, array("reportDirectory" => "/Users/sminnee/phpunit-report")*/
     if (Director::is_cli()) {
         $reporter = new CliTestReporter();
     } else {
         $reporter = new SapphireTestReporter();
     }
     self::$default_reporter->writeHeader("Sapphire Test Runner");
     if (count($classList) > 1) {
         self::$default_reporter->writeInfo("All Tests", "Running test cases: ", implode(", ", $classList));
     } else {
         self::$default_reporter->writeInfo($classList[0], "");
     }
     $results = new PHPUnit_Framework_TestResult();
     $results->addListener($reporter);
     if ($coverage === true) {
         foreach (self::$coverage_filter_dirs as $dir) {
             PHPUnit_Util_Filter::addDirectoryToFilter(BASE_PATH . '/' . $dir);
         }
         $results->collectCodeCoverageInformation(true);
         $suite->run($results);
         if (!file_exists(ASSETS_PATH . '/coverage-report')) {
             mkdir(ASSETS_PATH . '/coverage-report');
         }
         PHPUnit_Util_Report::render($results, ASSETS_PATH . '/coverage-report/');
         $coverageApp = ASSETS_PATH . '/coverage-report/' . preg_replace('/[^A-Za-z0-9]/', '_', preg_replace('/(\\/$)|(^\\/)/', '', Director::baseFolder())) . '.html';
         $coverageTemplates = ASSETS_PATH . '/coverage-report/' . preg_replace('/[^A-Za-z0-9]/', '_', preg_replace('/(\\/$)|(^\\/)/', '', realpath(TEMP_FOLDER))) . '.html';
         echo "<p>Coverage reports available here:<ul>\n\t\t\t\t<li><a href=\"{$coverageApp}\">Coverage report of the application</a></li>\n\t\t\t\t<li><a href=\"{$coverageTemplates}\">Coverage report of the templates</a></li>\n\t\t\t</ul>";
     } else {
         $suite->run($results);
     }
     if (!Director::is_cli()) {
         echo '<div class="trace">';
     }
     $reporter->writeResults();
     $endTime = microtime(true);
     if (Director::is_cli()) {
         echo "\n\nTotal time: " . round($endTime - $startTime, 3) . " seconds\n";
     } else {
         echo "<p>Total time: " . round($endTime - $startTime, 3) . " seconds</p>\n";
     }
     if (!Director::is_cli()) {
         echo '</div>';
     }
     // Put the error handlers back
     Debug::loadErrorHandlers();
     if (!Director::is_cli()) {
         self::$default_reporter->writeFooter();
     }
     $this->tearDown();
     // Todo: we should figure out how to pass this data back through Director more cleanly
     if (Director::is_cli() && $results->failureCount() + $results->errorCount() > 0) {
         exit(2);
     }
 }
 /**
  * Set white / black lists
  */
 public function setWhiteAndBlacklists()
 {
     if ($this->isPhpunitVersionGreaterOrEquals("3.6.0")) {
         $filter = new PHP_CodeCoverage_Filter();
         $filter->addDirectoryToBlacklist(PATH_TO_TEST_DIR);
         $filter->addDirectoryToBlacklist(PATH_TO_TINE_LIBRARY);
         $filter->addDirectoryToBlacklist(PATH_TO_REAL_DIR . '/Setup');
         $filter->addDirectoryToBlacklist(PATH_TO_REAL_DIR . '/Zend');
     } else {
         if ($this->isPhpunitVersionGreaterOrEquals("3.5.0")) {
             PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist(PATH_TO_TEST_DIR);
             PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist(PATH_TO_TINE_LIBRARY);
             PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist(PATH_TO_REAL_DIR . '/Setup');
             PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist(PATH_TO_REAL_DIR . '/Zend');
         } else {
             PHPUnit_Util_Filter::addDirectoryToFilter(PATH_TO_TEST_DIR);
             PHPUnit_Util_Filter::addDirectoryToFilter(PATH_TO_TINE_LIBRARY);
             PHPUnit_Util_Filter::addDirectoryToFilter(PATH_TO_REAL_DIR . '/Setup');
             PHPUnit_Util_Filter::addDirectoryToFilter(PATH_TO_REAL_DIR . '/Zend');
         }
     }
 }
Beispiel #16
0
 /**
  * Merges the test suites
  *
  * @return PHPUnit_Framework_TestSuite
  */
 public static function suite()
 {
     // These directories are covered for the code coverage even they are not part of unit testing
     PHPUnit_Util_Filter::addDirectoryToWhitelist(dirname(dirname(dirname(__FILE__))) . '/application');
     PHPUnit_Util_Filter::addDirectoryToWhitelist(dirname(dirname(dirname(__FILE__))) . '/library/Phprojekt');
     // Avoid Selenium checks
     PHPUnit_Util_Filter::addDirectoryToFilter(dirname(__FILE__) . '/Selenium');
     $authNamespace = new Zend_Session_Namespace('Phprojekt_Auth-login');
     $authNamespace->userId = 1;
     $authNamespace->admin = 1;
     $suite = new PHPUnit_Framework_TestSuite('PHPUnit');
     $suite->sharedFixture = Phprojekt::getInstance()->getDb();
     $suite->addTest(Timecard_AllTests::suite());
     $suite->addTest(Statistic_AllTests::suite());
     $suite->addTest(User_AllTests::suite());
     $suite->addTest(Calendar_AllTests::suite());
     $suite->addTest(Note_AllTests::suite());
     $suite->addTest(Todo_AllTests::suite());
     $suite->addTest(Helpdesk_AllTests::suite());
     $suite->addTest(Phprojekt_AllTests::suite());
     $suite->addTest(History_AllTests::suite());
     $suite->addTest(Role_AllTests::suite());
     $suite->addTest(Tab_AllTests::suite());
     $suite->addTest(Project_AllTests::suite());
     $suite->addTest(Module_AllTests::suite());
     $suite->addTest(Contact_AllTests::suite());
     $suite->addTest(Filemanager_AllTests::suite());
     $suite->addTest(Gantt_AllTests::suite());
     $suite->addTest(Minutes_AllTests::suite());
     // Add here additional test suites
     $suite->addTest(Default_AllTests::suite());
     //$suite->addTestSuite(Selenium_AllTests::suite());
     return $suite;
 }
Beispiel #17
0
if (is_null(ZEND_FRAMEWORK_PATH)) {
    die("Please configure the path to your Zend Framework library by setting the constant 'ZEND_FRAMEWORK_PATH' in your TestConfigureation.php file.");
}
/*
 * Set include path
 */
$path = array($coreLibrary, $coreTests, ZEND_FRAMEWORK_PATH, get_include_path());
set_include_path(implode(PATH_SEPARATOR, $path));
if (defined('TESTS_GENERATE_REPORT') && TESTS_GENERATE_REPORT === true && version_compare(PHPUnit_Runner_Version::id(), '3.1.6', '>=')) {
    /*
    * Add library/ directory to the PHPUnit code coverage
    * whitelist. This has the effect that only production code source files
    * appear in the code coverage report and that all production code source
    * files, even those that are not covered by a test yet, are processed.
    */
    PHPUnit_Util_Filter::addDirectoryToWhitelist($coreLibrary);
    /*
    * Omit from code coverage reports the contents of the tests directory
    */
    foreach (array('.php', '.phtml', '.csv', '.inc') as $suffix) {
        PHPUnit_Util_Filter::addDirectoryToFilter($coreTests, $suffix);
    }
    PHPUnit_Util_Filter::addDirectoryToFilter(PEAR_INSTALL_DIR);
    PHPUnit_Util_Filter::addDirectoryToFilter(PHP_LIBDIR);
    PHPUnit_Util_Filter::addDirectoryToFilter(ZEND_FRAMEWORK_PATH);
    PHPUnit_Util_Filter::addDirectoryToFilter($coreTests);
}
/*
 * Unset global variables that are no longer needed.
 */
unset($root, $coreLibrary, $coreTests, $path);
Beispiel #18
0
/**
 * 单元测试公用初始化文件
 */
date_default_timezone_set('Asia/Shanghai');
error_reporting(E_ALL | E_STRICT);
require_once 'PHPUnit/Framework.php';
require_once 'PHPUnit/Framework/TestSuite.php';
require dirname(__FILE__) . '/../../library/q.php';
Q::changeIni('runtime_cache_dir', dirname(__FILE__) . '/../../tmp');
Q::changeIni('log_writer_dir', dirname(__FILE__) . '/../../tmp');
define('FIXTURE_DIR', dirname(dirname(__FILE__)) . DS . 'fixture');
/**
 * 载入数据库连接信息
 */
$dsn_pool = Helper_YAML::load(FIXTURE_DIR . '/database.yaml');
Q::replaceIni('db_dsn_pool', $dsn_pool);
PHPUnit_Util_Filter::addDirectoryToFilter(dirname(dirname(__FILE__)));
abstract class QTest_UnitTest_Abstract extends PHPUnit_Framework_TestCase
{
    protected function assertEmpty($var, $msg = '')
    {
        $this->assertTrue(empty($var), $msg);
    }
    protected function assertNotEmpty($var, $msg = '')
    {
        $this->assertTrue(!empty($var), $msg);
    }
}
abstract class QTest_UnitTest_TestSuite_Abstract extends PHPUnit_Framework_TestSuite
{
}
Beispiel #19
0
 /**
  * @param  array $arguments
  * @since  Method available since Release 3.2.1
  */
 protected function handleConfiguration(array &$arguments)
 {
     if (isset($arguments['configuration']) && !$arguments['configuration'] instanceof PHPUnit_Util_Configuration) {
         $arguments['configuration'] = PHPUnit_Util_Configuration::getInstance($arguments['configuration']);
         $arguments['pmd'] = $arguments['configuration']->getPMDConfiguration();
     } else {
         $arguments['pmd'] = array();
     }
     $arguments['debug'] = isset($arguments['debug']) ? $arguments['debug'] : FALSE;
     $arguments['filter'] = isset($arguments['filter']) ? $arguments['filter'] : FALSE;
     $arguments['listeners'] = isset($arguments['listeners']) ? $arguments['listeners'] : array();
     $arguments['repeat'] = isset($arguments['repeat']) ? $arguments['repeat'] : FALSE;
     $arguments['testDatabasePrefix'] = isset($arguments['testDatabasePrefix']) ? $arguments['testDatabasePrefix'] : '';
     $arguments['verbose'] = isset($arguments['verbose']) ? $arguments['verbose'] : FALSE;
     $arguments['wait'] = isset($arguments['wait']) ? $arguments['wait'] : FALSE;
     if (isset($arguments['configuration'])) {
         $arguments['configuration']->handlePHPConfiguration();
         $filterConfiguration = $arguments['configuration']->getFilterConfiguration();
         PHPUnit_Util_Filter::$addUncoveredFilesFromWhitelist = $filterConfiguration['whitelist']['addUncoveredFilesFromWhitelist'];
         foreach ($filterConfiguration['blacklist']['include']['directory'] as $dir) {
             PHPUnit_Util_Filter::addDirectoryToFilter($dir['path'], $dir['suffix'], $dir['group'], $dir['prefix']);
         }
         foreach ($filterConfiguration['blacklist']['include']['file'] as $file) {
             PHPUnit_Util_Filter::addFileToFilter($file);
         }
         foreach ($filterConfiguration['blacklist']['exclude']['directory'] as $dir) {
             PHPUnit_Util_Filter::removeDirectoryFromFilter($dir['path'], $dir['suffix'], $dir['group'], $dir['prefix']);
         }
         foreach ($filterConfiguration['blacklist']['exclude']['file'] as $file) {
             PHPUnit_Util_Filter::removeFileFromFilter($file);
         }
         foreach ($filterConfiguration['whitelist']['include']['directory'] as $dir) {
             PHPUnit_Util_Filter::addDirectoryToWhitelist($dir['path'], $dir['suffix'], $dir['prefix']);
         }
         foreach ($filterConfiguration['whitelist']['include']['file'] as $file) {
             PHPUnit_Util_Filter::addFileToWhitelist($file);
         }
         foreach ($filterConfiguration['whitelist']['exclude']['directory'] as $dir) {
             PHPUnit_Util_Filter::removeDirectoryFromWhitelist($dir['path'], $dir['suffix'], $dir['prefix']);
         }
         foreach ($filterConfiguration['whitelist']['exclude']['file'] as $file) {
             PHPUnit_Util_Filter::removeFileFromWhitelist($file);
         }
         $phpunitConfiguration = $arguments['configuration']->getPHPUnitConfiguration();
         if (isset($phpunitConfiguration['backupGlobals']) && !isset($arguments['backupGlobals'])) {
             $arguments['backupGlobals'] = $phpunitConfiguration['backupGlobals'];
         }
         if (isset($phpunitConfiguration['backupStaticAttributes']) && !isset($arguments['backupStaticAttributes'])) {
             $arguments['backupStaticAttributes'] = $phpunitConfiguration['backupStaticAttributes'];
         }
         if (isset($phpunitConfiguration['bootstrap']) && !isset($arguments['bootstrap'])) {
             $arguments['bootstrap'] = $phpunitConfiguration['bootstrap'];
         }
         if (isset($phpunitConfiguration['colors']) && !isset($arguments['colors'])) {
             $arguments['colors'] = $phpunitConfiguration['colors'];
         }
         if (isset($phpunitConfiguration['convertErrorsToExceptions']) && !isset($arguments['convertErrorsToExceptions'])) {
             $arguments['convertErrorsToExceptions'] = $phpunitConfiguration['convertErrorsToExceptions'];
         }
         if (isset($phpunitConfiguration['convertNoticesToExceptions']) && !isset($arguments['convertNoticesToExceptions'])) {
             $arguments['convertNoticesToExceptions'] = $phpunitConfiguration['convertNoticesToExceptions'];
         }
         if (isset($phpunitConfiguration['convertWarningsToExceptions']) && !isset($arguments['convertWarningsToExceptions'])) {
             $arguments['convertWarningsToExceptions'] = $phpunitConfiguration['convertWarningsToExceptions'];
         }
         if (isset($phpunitConfiguration['processIsolation']) && !isset($arguments['processIsolation'])) {
             $arguments['processIsolation'] = $phpunitConfiguration['processIsolation'];
         }
         if (isset($phpunitConfiguration['stopOnFailure']) && !isset($arguments['stopOnFailure'])) {
             $arguments['stopOnFailure'] = $phpunitConfiguration['stopOnFailure'];
         }
         $groupConfiguration = $arguments['configuration']->getGroupConfiguration();
         if (!empty($groupConfiguration['include']) && !isset($arguments['groups'])) {
             $arguments['groups'] = $groupConfiguration['include'];
         }
         if (!empty($groupConfiguration['exclude']) && !isset($arguments['excludeGroups'])) {
             $arguments['excludeGroups'] = $groupConfiguration['exclude'];
         }
         foreach ($arguments['configuration']->getListenerConfiguration() as $listener) {
             if (!class_exists($listener['class'], FALSE) && $listener['file'] !== '') {
                 $file = PHPUnit_Util_Filesystem::fileExistsInIncludePath($listener['file']);
                 if ($file !== FALSE) {
                     require $file;
                 }
             }
             if (class_exists($listener['class'], FALSE)) {
                 if (count($listener['arguments']) == 0) {
                     $listener = new $listener['class']();
                 } else {
                     $listenerClass = new ReflectionClass($listener['class']);
                     $listener = $listenerClass->newInstanceArgs($listener['arguments']);
                 }
                 if ($listener instanceof PHPUnit_Framework_TestListener) {
                     $arguments['listeners'][] = $listener;
                 }
             }
         }
         $loggingConfiguration = $arguments['configuration']->getLoggingConfiguration();
         if (isset($loggingConfiguration['coverage-html']) && !isset($arguments['reportDirectory'])) {
             if (isset($loggingConfiguration['charset']) && !isset($arguments['reportCharset'])) {
                 $arguments['reportCharset'] = $loggingConfiguration['charset'];
             }
             if (isset($loggingConfiguration['yui']) && !isset($arguments['reportYUI'])) {
                 $arguments['reportYUI'] = $loggingConfiguration['yui'];
             }
             if (isset($loggingConfiguration['highlight']) && !isset($arguments['reportHighlight'])) {
                 $arguments['reportHighlight'] = $loggingConfiguration['highlight'];
             }
             if (isset($loggingConfiguration['lowUpperBound']) && !isset($arguments['reportLowUpperBound'])) {
                 $arguments['reportLowUpperBound'] = $loggingConfiguration['lowUpperBound'];
             }
             if (isset($loggingConfiguration['highLowerBound']) && !isset($arguments['reportHighLowerBound'])) {
                 $arguments['reportHighLowerBound'] = $loggingConfiguration['highLowerBound'];
             }
             $arguments['reportDirectory'] = $loggingConfiguration['coverage-html'];
         }
         if (isset($loggingConfiguration['coverage-clover']) && !isset($arguments['coverageClover'])) {
             $arguments['coverageClover'] = $loggingConfiguration['coverage-clover'];
         }
         if (isset($loggingConfiguration['coverage-xml']) && !isset($arguments['coverageClover'])) {
             $arguments['coverageClover'] = $loggingConfiguration['coverage-xml'];
         }
         if (isset($loggingConfiguration['coverage-source']) && !isset($arguments['coverageSource'])) {
             $arguments['coverageSource'] = $loggingConfiguration['coverage-source'];
         }
         if (isset($loggingConfiguration['graphviz']) && !isset($arguments['graphvizLogfile'])) {
             $arguments['graphvizLogfile'] = $loggingConfiguration['graphviz'];
         }
         if (isset($loggingConfiguration['json']) && !isset($arguments['jsonLogfile'])) {
             $arguments['jsonLogfile'] = $loggingConfiguration['json'];
         }
         if (isset($loggingConfiguration['metrics-xml']) && !isset($arguments['metricsXML'])) {
             $arguments['metricsXML'] = $loggingConfiguration['metrics-xml'];
         }
         if (isset($loggingConfiguration['plain'])) {
             $arguments['listeners'][] = new PHPUnit_TextUI_ResultPrinter($loggingConfiguration['plain'], TRUE);
         }
         if (isset($loggingConfiguration['pmd-xml']) && !isset($arguments['pmdXML'])) {
             if (isset($loggingConfiguration['cpdMinLines']) && !isset($arguments['cpdMinLines'])) {
                 $arguments['cpdMinLines'] = $loggingConfiguration['cpdMinLines'];
             }
             if (isset($loggingConfiguration['cpdMinMatches']) && !isset($arguments['cpdMinMatches'])) {
                 $arguments['cpdMinMatches'] = $loggingConfiguration['cpdMinMatches'];
             }
             $arguments['pmdXML'] = $loggingConfiguration['pmd-xml'];
         }
         if (isset($loggingConfiguration['tap']) && !isset($arguments['tapLogfile'])) {
             $arguments['tapLogfile'] = $loggingConfiguration['tap'];
         }
         if (isset($loggingConfiguration['junit']) && !isset($arguments['junitLogfile'])) {
             $arguments['junitLogfile'] = $loggingConfiguration['junit'];
             if (isset($loggingConfiguration['logIncompleteSkipped']) && !isset($arguments['logIncompleteSkipped'])) {
                 $arguments['logIncompleteSkipped'] = $loggingConfiguration['logIncompleteSkipped'];
             }
         }
         if (isset($loggingConfiguration['story-html']) && !isset($arguments['storyHTMLFile'])) {
             $arguments['storyHTMLFile'] = $loggingConfiguration['story-html'];
         }
         if (isset($loggingConfiguration['story-text']) && !isset($arguments['storyTextFile'])) {
             $arguments['storsTextFile'] = $loggingConfiguration['story-text'];
         }
         if (isset($loggingConfiguration['testdox-html']) && !isset($arguments['testdoxHTMLFile'])) {
             $arguments['testdoxHTMLFile'] = $loggingConfiguration['testdox-html'];
         }
         if (isset($loggingConfiguration['testdox-text']) && !isset($arguments['testdoxTextFile'])) {
             $arguments['testdoxTextFile'] = $loggingConfiguration['testdox-text'];
         }
     }
     $arguments['backupGlobals'] = isset($arguments['backupGlobals']) ? $arguments['backupGlobals'] : NULL;
     $arguments['backupStaticAttributes'] = isset($arguments['backupStaticAttributes']) ? $arguments['backupStaticAttributes'] : NULL;
     $arguments['cpdMinLines'] = isset($arguments['cpdMinLines']) ? $arguments['cpdMinLines'] : 5;
     $arguments['cpdMinMatches'] = isset($arguments['cpdMinMatches']) ? $arguments['cpdMinMatches'] : 70;
     $arguments['colors'] = isset($arguments['colors']) ? $arguments['colors'] : FALSE;
     $arguments['convertErrorsToExceptions'] = isset($arguments['convertErrorsToExceptions']) ? $arguments['convertErrorsToExceptions'] : TRUE;
     $arguments['convertNoticesToExceptions'] = isset($arguments['convertNoticesToExceptions']) ? $arguments['convertNoticesToExceptions'] : TRUE;
     $arguments['convertWarningsToExceptions'] = isset($arguments['convertWarningsToExceptions']) ? $arguments['convertWarningsToExceptions'] : TRUE;
     $arguments['excludeGroups'] = isset($arguments['excludeGroups']) ? $arguments['excludeGroups'] : array();
     $arguments['groups'] = isset($arguments['groups']) ? $arguments['groups'] : array();
     $arguments['logIncompleteSkipped'] = isset($arguments['logIncompleteSkipped']) ? $arguments['logIncompleteSkipped'] : FALSE;
     $arguments['processIsolation'] = isset($arguments['processIsolation']) ? $arguments['processIsolation'] : FALSE;
     $arguments['reportCharset'] = isset($arguments['reportCharset']) ? $arguments['reportCharset'] : 'ISO-8859-1';
     $arguments['reportHighlight'] = isset($arguments['reportHighlight']) ? $arguments['reportHighlight'] : FALSE;
     $arguments['reportHighLowerBound'] = isset($arguments['reportHighLowerBound']) ? $arguments['reportHighLowerBound'] : 70;
     $arguments['reportLowUpperBound'] = isset($arguments['reportLowUpperBound']) ? $arguments['reportLowUpperBound'] : 35;
     $arguments['reportYUI'] = isset($arguments['reportYUI']) ? $arguments['reportYUI'] : TRUE;
     $arguments['stopOnFailure'] = isset($arguments['stopOnFailure']) ? $arguments['stopOnFailure'] : FALSE;
     if ($arguments['filter'] !== FALSE && preg_match('/^[a-zA-Z0-9_]/', $arguments['filter'])) {
         $arguments['filter'] = '/' . $arguments['filter'] . '/';
     }
 }
Beispiel #20
0
 *
 * This file is part of phpVocab.
 *
 * phpVocab is free software: you can redistribute it and/or modify
 * it under the terms of the Artistic License as published by
 * the Open Source Initiative, either version 2.0 of the License, or
 * (at your option) any later version.
 *
 * phpVocab is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * Artistic License for more details.
 *
 * You should have received a copy of the Artistic License
 * along with phpVocab. If not, see <http://www.phpVocab.com/license.php>
 * or <http://www.opensource.org/licenses/artistic-license-2.0.php>.
 *
 * @author James Frasca <*****@*****.**>
 * @copyright Copyright 2009, James Frasca, All Rights Reserved
 */
require_once 'PHPUnit/Framework.php';
require_once 'PHPUnit/Extensions/OutputTestCase.php';
define("r8_SUPPRESS_HANDLERS", TRUE);
define("vocab_TEST_DATA", __DIR__ . '/Data');
require_once rtrim(__DIR__, "/") . "/../src/include.php";
// Set up the autoload structure for vocab specific classes
\r8\Autoload::getInstance()->register('vc\\Test', rtrim(__DIR__, "/") . '/Test');
error_reporting(E_ALL | E_STRICT);
PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
PHPUnit_Util_Filter::addDirectoryToFilter(rtrim(__DIR__, "/") . '/Test');
Beispiel #21
0
 * the Free Software Foundation; version 2 of the license.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * @package	PHPIDS tests
 * @version	SVN: $Id:allTests.php 515 2007-09-15 13:43:40Z christ1an $
 */
error_reporting(E_ALL | E_STRICT | @E_DEPRECATED);
require_once 'PHPUnit/Framework/TestSuite.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once 'PHPUnit/Util/Filter.php';
PHPUnit_Util_Filter::addDirectoryToFilter(dirname(__FILE__));
PHPUnit_Util_Filter::addDirectoryToFilter(dirname(__FILE__) . '/../lib/IDS/vendors');
if (!defined('PHPUnit_MAIN_METHOD')) {
    define('PHPUnit_MAIN_METHOD', 'allTests');
}
class allTests
{
    public static function main()
    {
        PHPUnit_TextUI_TestRunner::run(self::suite());
    }
    public static function suite()
    {
        $suite = new PHPUnit_Framework_TestSuite('PHPIDS');
        require_once 'IDS/MonitorTest.php';
        $suite->addTestSuite('IDS_MonitorTest');
        require_once 'IDS/ReportTest.php';
defined('APPLICATION_PATH') or define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
/**
 * Autoloader helpers
 */
function _SF_Autloader_SetUp()
{
    require_once 'Zend/Loader/Autoloader.php';
    $loader = Zend_Loader_Autoloader::getInstance();
    $loader->registerNamespace('SF_');
}
function _SF_Autloader_TearDown()
{
    Zend_Loader_Autoloader::resetInstance();
    $loader = Zend_Loader_Autoloader::getInstance();
    $loader->registerNamespace('SF_');
}
/**
 * Init autoloader
 */
_SF_Autloader_SetUp();
/**
 * Start session now!
 */
Zend_Session::$_unitTestEnabled = true;
Zend_Session::start();
/**
 * Ignore folders from code coverage etc
 */
PHPUnit_Util_Filter::addDirectoryToFilter("{$root}/tests");
PHPUnit_Util_Filter::addDirectoryToFilter("{$root}/library/Zend");
Beispiel #23
0
 /**
  * @param  array $arguments
  * @since  Method available since Release 3.2.1
  */
 protected function handleConfiguration(array &$arguments)
 {
     if (isset($arguments['configuration'])) {
         $arguments['configuration'] = new PHPUnit_Util_Configuration($arguments['configuration']);
         $arguments['pmd'] = $arguments['configuration']->getPMDConfiguration();
     } else {
         $arguments['pmd'] = array();
     }
     $arguments['filter'] = isset($arguments['filter']) ? $arguments['filter'] : FALSE;
     $arguments['listeners'] = isset($arguments['listeners']) ? $arguments['listeners'] : array();
     $arguments['repeat'] = isset($arguments['repeat']) ? $arguments['repeat'] : FALSE;
     $arguments['testDatabasePrefix'] = isset($arguments['testDatabasePrefix']) ? $arguments['testDatabasePrefix'] : '';
     $arguments['verbose'] = isset($arguments['verbose']) ? $arguments['verbose'] : FALSE;
     $arguments['wait'] = isset($arguments['wait']) ? $arguments['wait'] : FALSE;
     if (isset($arguments['configuration'])) {
         $arguments['configuration']->handlePHPConfiguration();
         $filterConfiguration = $arguments['configuration']->getFilterConfiguration();
         PHPUnit_Util_Filter::$addUncoveredFilesFromWhitelist = $filterConfiguration['whitelist']['addUncoveredFilesFromWhitelist'];
         foreach ($filterConfiguration['blacklist']['include']['directory'] as $dir) {
             PHPUnit_Util_Filter::addDirectoryToFilter($dir['path'], $dir['suffix']);
         }
         foreach ($filterConfiguration['blacklist']['include']['file'] as $file) {
             PHPUnit_Util_Filter::addFileToFilter($file);
         }
         foreach ($filterConfiguration['blacklist']['exclude']['directory'] as $dir) {
             PHPUnit_Util_Filter::removeDirectoryFromFilter($dir['path'], $dir['suffix']);
         }
         foreach ($filterConfiguration['blacklist']['exclude']['file'] as $file) {
             PHPUnit_Util_Filter::removeFileFromFilter($file);
         }
         foreach ($filterConfiguration['whitelist']['include']['directory'] as $dir) {
             PHPUnit_Util_Filter::addDirectoryToWhitelist($dir['path'], $dir['suffix']);
         }
         foreach ($filterConfiguration['whitelist']['include']['file'] as $file) {
             PHPUnit_Util_Filter::addFileToWhitelist($file);
         }
         foreach ($filterConfiguration['whitelist']['exclude']['directory'] as $dir) {
             PHPUnit_Util_Filter::removeDirectoryFromWhitelist($dir['path'], $dir['suffix']);
         }
         foreach ($filterConfiguration['whitelist']['exclude']['file'] as $file) {
             PHPUnit_Util_Filter::removeFileFromWhitelist($file);
         }
         $phpunitConfiguration = $arguments['configuration']->getPHPUnitConfiguration();
         if (isset($phpunitConfiguration['ansi']) && !isset($arguments['ansi'])) {
             $arguments['ansi'] = $phpunitConfiguration['ansi'];
         }
         if (isset($phpunitConfiguration['convertErrorsToExceptions']) && !isset($arguments['convertErrorsToExceptions'])) {
             $arguments['convertErrorsToExceptions'] = $phpunitConfiguration['convertErrorsToExceptions'];
         }
         if (isset($phpunitConfiguration['convertNoticesToExceptions']) && !isset($arguments['convertNoticesToExceptions'])) {
             $arguments['convertNoticesToExceptions'] = $phpunitConfiguration['convertNoticesToExceptions'];
         }
         if (isset($phpunitConfiguration['convertWarningsToExceptions']) && !isset($arguments['convertWarningsToExceptions'])) {
             $arguments['convertWarningsToExceptions'] = $phpunitConfiguration['convertWarningsToExceptions'];
         }
         if (isset($phpunitConfiguration['stopOnFailure']) && !isset($arguments['stopOnFailure'])) {
             $arguments['stopOnFailure'] = $phpunitConfiguration['stopOnFailure'];
         }
         $groupConfiguration = $arguments['configuration']->getGroupConfiguration();
         if (!empty($groupConfiguration['include']) && !isset($arguments['groups'])) {
             $arguments['groups'] = $groupConfiguration['include'];
         }
         if (!empty($groupConfiguration['exclude']) && !isset($arguments['excludeGroups'])) {
             $arguments['excludeGroups'] = $groupConfiguration['exclude'];
         }
         $loggingConfiguration = $arguments['configuration']->getLoggingConfiguration();
         if (isset($loggingConfiguration['coverage-html']) && !isset($arguments['reportDirectory'])) {
             if (isset($loggingConfiguration['charset']) && !isset($arguments['reportCharset'])) {
                 $arguments['reportCharset'] = $loggingConfiguration['charset'];
             }
             if (isset($loggingConfiguration['yui']) && !isset($arguments['reportYUI'])) {
                 $arguments['reportYUI'] = $loggingConfiguration['yui'];
             }
             if (isset($loggingConfiguration['highlight']) && !isset($arguments['reportHighlight'])) {
                 $arguments['reportHighlight'] = $loggingConfiguration['highlight'];
             }
             if (isset($loggingConfiguration['lowUpperBound']) && !isset($arguments['reportLowUpperBound'])) {
                 $arguments['reportLowUpperBound'] = $loggingConfiguration['lowUpperBound'];
             }
             if (isset($loggingConfiguration['highLowerBound']) && !isset($arguments['reportHighLowerBound'])) {
                 $arguments['reportHighLowerBound'] = $loggingConfiguration['highLowerBound'];
             }
             $arguments['reportDirectory'] = $loggingConfiguration['coverage-html'];
         }
         if (isset($loggingConfiguration['coverage-clover']) && !isset($arguments['coverageClover'])) {
             $arguments['coverageClover'] = $loggingConfiguration['coverage-clover'];
         }
         if (isset($loggingConfiguration['coverage-xml']) && !isset($arguments['coverageClover'])) {
             $arguments['coverageClover'] = $loggingConfiguration['coverage-xml'];
         }
         if (isset($loggingConfiguration['coverage-source']) && !isset($arguments['coverageSource'])) {
             $arguments['coverageSource'] = $loggingConfiguration['coverage-source'];
         }
         if (isset($loggingConfiguration['graphviz']) && !isset($arguments['graphvizLogfile'])) {
             $arguments['graphvizLogfile'] = $loggingConfiguration['graphviz'];
         }
         if (isset($loggingConfiguration['json']) && !isset($arguments['jsonLogfile'])) {
             $arguments['jsonLogfile'] = $loggingConfiguration['json'];
         }
         if (isset($loggingConfiguration['metrics-xml']) && !isset($arguments['metricsXML'])) {
             $arguments['metricsXML'] = $loggingConfiguration['metrics-xml'];
         }
         if (isset($loggingConfiguration['plain'])) {
             $arguments['listeners'][] = new PHPUnit_TextUI_ResultPrinter($loggingConfiguration['plain'], TRUE);
         }
         if (isset($loggingConfiguration['pmd-xml']) && !isset($arguments['pmdXML'])) {
             if (isset($loggingConfiguration['cpdMinLines']) && !isset($arguments['cpdMinLines'])) {
                 $arguments['cpdMinLines'] = $loggingConfiguration['cpdMinLines'];
             }
             if (isset($loggingConfiguration['cpdMinMatches']) && !isset($arguments['cpdMinMatches'])) {
                 $arguments['cpdMinMatches'] = $loggingConfiguration['cpdMinMatches'];
             }
             $arguments['pmdXML'] = $loggingConfiguration['pmd-xml'];
         }
         if (isset($loggingConfiguration['tap']) && !isset($arguments['tapLogfile'])) {
             $arguments['tapLogfile'] = $loggingConfiguration['tap'];
         }
         if (isset($loggingConfiguration['test-xml']) && !isset($arguments['xmlLogfile'])) {
             $arguments['xmlLogfile'] = $loggingConfiguration['test-xml'];
             if (isset($loggingConfiguration['logIncompleteSkipped']) && !isset($arguments['logIncompleteSkipped'])) {
                 $arguments['logIncompleteSkipped'] = $loggingConfiguration['logIncompleteSkipped'];
             }
         }
         if (isset($loggingConfiguration['story-html']) && !isset($arguments['storyHTMLFile'])) {
             $arguments['storyHTMLFile'] = $loggingConfiguration['story-html'];
         }
         if (isset($loggingConfiguration['story-text']) && !isset($arguments['storyTextFile'])) {
             $arguments['storsTextFile'] = $loggingConfiguration['story-text'];
         }
         if (isset($loggingConfiguration['testdox-html']) && !isset($arguments['testdoxHTMLFile'])) {
             $arguments['testdoxHTMLFile'] = $loggingConfiguration['testdox-html'];
         }
         if (isset($loggingConfiguration['testdox-text']) && !isset($arguments['testdoxTextFile'])) {
             $arguments['testdoxTextFile'] = $loggingConfiguration['testdox-text'];
         }
         $browsers = $arguments['configuration']->getSeleniumBrowserConfiguration();
         if (!empty($browsers)) {
             require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
             PHPUnit_Extensions_SeleniumTestCase::$browsers = $browsers;
         }
     }
     $arguments['cpdMinLines'] = isset($arguments['cpdMinLines']) ? $arguments['cpdMinLines'] : 5;
     $arguments['cpdMinMatches'] = isset($arguments['cpdMinMatches']) ? $arguments['cpdMinMatches'] : 70;
     $arguments['ansi'] = isset($arguments['ansi']) ? $arguments['ansi'] : FALSE;
     $arguments['convertErrorsToExceptions'] = isset($arguments['convertErrorsToExceptions']) ? $arguments['convertErrorsToExceptions'] : TRUE;
     $arguments['convertNoticesToExceptions'] = isset($arguments['convertNoticesToExceptions']) ? $arguments['convertNoticesToExceptions'] : TRUE;
     $arguments['convertWarningsToExceptions'] = isset($arguments['convertWarningsToExceptions']) ? $arguments['convertWarningsToExceptions'] : TRUE;
     $arguments['excludeGroups'] = isset($arguments['excludeGroups']) ? $arguments['excludeGroups'] : array();
     $arguments['groups'] = isset($arguments['groups']) ? $arguments['groups'] : array();
     $arguments['logIncompleteSkipped'] = isset($arguments['logIncompleteSkipped']) ? $arguments['logIncompleteSkipped'] : FALSE;
     $arguments['reportCharset'] = isset($arguments['reportCharset']) ? $arguments['reportCharset'] : 'ISO-8859-1';
     $arguments['reportHighlight'] = isset($arguments['reportHighlight']) ? $arguments['reportHighlight'] : FALSE;
     $arguments['reportHighLowerBound'] = isset($arguments['reportHighLowerBound']) ? $arguments['reportHighLowerBound'] : 70;
     $arguments['reportLowUpperBound'] = isset($arguments['reportLowUpperBound']) ? $arguments['reportLowUpperBound'] : 35;
     $arguments['reportYUI'] = isset($arguments['reportYUI']) ? $arguments['reportYUI'] : TRUE;
     $arguments['stopOnFailure'] = isset($arguments['stopOnFailure']) ? $arguments['stopOnFailure'] : FALSE;
 }
/*
 * Prepend the Mutateme library/ and tests/ directories to the
 * include_path. This allows the tests to run out of the box and helps prevent
 * loading other copies of the code and tests that would supercede
 * this copy.
 */
$path = array($library, get_include_path());
set_include_path(implode(PATH_SEPARATOR, $path));
require_once "{$root}/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php";
if (defined('TESTS_GENERATE_REPORT') && TESTS_GENERATE_REPORT === true && version_compare(PHPUnit_Runner_Version::id(), '3.1.6', '>=')) {
    /*
     * Add Mutateme library/ directory to the PHPUnit code coverage
     * whitelist. This has the effect that only production code source files
     * appear in the code coverage report and that all production code source
     * files, even those that are not covered by a test yet, are processed.
     */
    PHPUnit_Util_Filter::addDirectoryToWhitelist($library);
    /*
     * Omit from code coverage reports the contents of the tests directory
     */
    foreach (array('.php', '.phtml', '.csv', '.inc') as $suffix) {
        PHPUnit_Util_Filter::addDirectoryToFilter($tests, $suffix);
    }
    PHPUnit_Util_Filter::addDirectoryToFilter(PEAR_INSTALL_DIR);
    PHPUnit_Util_Filter::addDirectoryToFilter(PHP_LIBDIR);
}
require __DIR__ . '/../vendor/autoload.php';
/*
 * Unset global variables that are no longer needed.
 */
unset($root, $library, $tests, $path);
Beispiel #25
0
jimport('joomla.session.session');

// We need also these:
jimport('joomla.plugin.helper');

$_SERVER['HTTP_HOST'] = 'http://localhost';
$_SERVER['REQUEST_URI'] = '/index.php';
//$_SERVER['REMOTE_ADDR'] = '127.0.0.1';

$app = JFactory::getApplication('site');

if (!defined('KPATH_TESTS'))
{
	define('KPATH_TESTS', dirname(__FILE__));
}

// Exclude all of the tests from code coverage reports
if (class_exists('PHP_CodeCoverage_Filter')) {
	PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist(JPATH_BASE . '/tests');
} else {
	PHPUnit_Util_Filter::addDirectoryToFilter(JPATH_BASE . '/tests');
}

// Set error handling.
JError::setErrorHandling(E_NOTICE, 'ignore');
JError::setErrorHandling(E_WARNING, 'ignore');
JError::setErrorHandling(E_ERROR, 'ignore');

// Load Kunena API
require_once JPATH_ADMINISTRATOR . '/components/com_kunena/api.php';
KunenaFactory::loadLanguage();
Beispiel #26
0
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://framework.zend.com/license/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@zend.com so we can send you a copy immediately.
 *
 * @category   Zend
 * @package    Zend_Config
 * @subpackage UnitTests
 * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @version    $Id$
 */
// require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestHelper.php';
PHPUnit_Util_Filter::addDirectoryToFilter(dirname(__FILE__) . "/temp", "cfg");
if (!defined('PHPUnit_MAIN_METHOD')) {
    define('PHPUnit_MAIN_METHOD', 'Zend_Config_Writer_AllTests::main');
}
// require_once 'Zend/Config/Writer/ArrayTest.php';
// require_once 'Zend/Config/Writer/IniTest.php';
// require_once 'Zend/Config/Writer/XmlTest.php';
/**
 * @category   Zend
 * @package    Zend_Config
 * @subpackage UnitTests
 * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @group      Zend_Config
 */
class Zend_Config_Writer_AllTests
Beispiel #27
0
 /**
  * Blacklist a set of files in PHPUnit code coverage
  *
  * @param array A set of files to blacklist
  */
 public static function blacklist(array $blacklist_items)
 {
     if (self::$phpunit_v35) {
         $filter = PHP_CodeCoverage_Filter::getInstance();
         foreach ($blacklist_items as $item) {
             if (is_dir($item)) {
                 $filter->addDirectoryToBlacklist($item);
             } else {
                 $filter->addFileToBlacklist($item);
             }
         }
     } else {
         foreach ($blacklist_items as $item) {
             if (is_dir($item)) {
                 PHPUnit_Util_Filter::addDirectoryToFilter($item);
             } else {
                 PHPUnit_Util_Filter::addFileToFilter($item);
             }
         }
     }
 }
Beispiel #28
0
 /**
  * Blacklist a set of files in PHPUnit code coverage
  *
  * @param array $blacklist_items A set of files to blacklist
  * @param Unittest_TestSuite $suite The test suite
  */
 public static function blacklist(array $blacklist_items, Unittest_TestSuite $suite = NULL)
 {
     if (self::$phpunit_v35) {
         foreach ($blacklist_items as $item) {
             if (is_dir($item)) {
                 $suite->addDirectoryToBlacklist($item);
             } else {
                 $suite->addFileToBlacklist($item);
             }
         }
     } else {
         foreach ($blacklist_items as $item) {
             if (is_dir($item)) {
                 PHPUnit_Util_Filter::addDirectoryToFilter($item);
             } else {
                 PHPUnit_Util_Filter::addFileToFilter($item);
             }
         }
     }
 }
Beispiel #29
0
<?php

PHPUnit_Util_Filter::addDirectoryToFilter(__DIR__ . '/..');
//require_once(dirname(__FILE__) . '/importexport.php');
require_once 'PHPUnit/Framework.php';
require_once dirname(__FILE__) . '/../../src/jackalope/autoloader.php';
abstract class jackalope_baseSuite extends PHPUnit_Framework_TestSuite
{
    protected $path = '';
    protected $configKeys = array('jcr.url', 'jcr.user', 'jcr.pass', 'jcr.workspace', 'jcr.transport');
    public function setUp()
    {
        parent::setUp();
        $this->sharedFixture = array();
        foreach ($this->configKeys as $cfgKey) {
            $this->sharedFixture['config'][substr($cfgKey, 4)] = $GLOBALS[$cfgKey];
        }
    }
}
Beispiel #30
0
 */
// Include PHPUnit dependencies
require_once 'PHPUnit/Framework.php';
require_once 'PHPUnit/Framework/IncompleteTestError.php';
require_once 'PHPUnit/Framework/TestCase.php';
require_once 'PHPUnit/Framework/TestSuite.php';
require_once 'PHPUnit/Runner/Version.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once 'PHPUnit/Util/Filter.php';
// Set error reporting to the level to which code must comply.
error_reporting(E_ALL | E_STRICT);
// Determine paths
$_path_root = realpath(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR;
$_path_lib = $_path_root . 'library';
$_path_tests = $_path_root . 'tests';
// Omit the contents of the tests directory from code coverage reports
PHPUnit_Util_Filter::addDirectoryToFilter($_path_tests, '.php');
// Set the include path to only include library and test dirs
set_include_path($_path_lib . PATH_SEPARATOR . $_path_tests . PATH_SEPARATOR . get_include_path());
// Read the configuration file if available
if (is_readable($_path_tests . DIRECTORY_SEPARATOR . 'TestConfiguration.php')) {
    require_once $_path_tests . DIRECTORY_SEPARATOR . 'TestConfiguration.php';
} else {
    require_once $_path_tests . DIRECTORY_SEPARATOR . 'TestConfiguration.php.dist';
}
// Add the Sopha /library directory to the PHPUnit code coverage whitelist
if (defined('TESTS_GENERATE_REPORT') && TESTS_GENERATE_REPORT === true && version_compare(PHPUnit_Runner_Version::id(), '3.1.6', '>=')) {
    PHPUnit_Util_Filter::addDirectoryToWhitelist($_path_lib);
}
// Unset global variables that are no longer needed
unset($_path_root, $_path_lib, $_path_tests);