示例#1
0
 /**
  * Constructs a new test suite instance.
  */
 public function __construct()
 {
     $this->setName('org::pdepend::reflection::resolvers::AllTests');
     \PHPUnit_Util_Filter::addDirectoryToWhitelist(realpath(dirname(__FILE__) . '/../../source/'));
     $this->addTestSuite('\\pdepend\\reflection\\resolvers\\AutoloadArrayResolverTest');
     $this->addTestSuite('\\pdepend\\reflection\\resolvers\\PearNamingResolverTest');
 }
示例#2
0
 /**
  * Constructs a new test suite instance.
  */
 public function __construct()
 {
     $this->setName('pFlow::AllTests');
     \PHPUnit_Util_Filter::addDirectoryToWhitelist(realpath(dirname(__FILE__) . '/../src/pFlow'));
     $this->addTestSuite('\\pFlow\\AnalyzerTest');
     $this->addTestSuite('\\pFlow\\CliTest');
 }
 /**
  * Constructs a new test suite instance.
  */
 public function __construct()
 {
     $this->setName('PHP::ChangeCoverage::Report::AllTests');
     PHPUnit_Util_Filter::addDirectoryToWhitelist(realpath(dirname(__FILE__) . '/../../../../source/'));
     $this->addTestSuite('PHP_ChangeCoverage_Report_CloverUnitTest');
     $this->addTestSuite('PHP_ChangeCoverage_Report_FactoryUnitTest');
 }
示例#4
0
 /**
  * Constructs a new test suite instance.
  */
 public function __construct()
 {
     $this->setName('org::pdepend::reflection::parser::AllTests');
     \PHPUnit_Util_Filter::addDirectoryToWhitelist(realpath(dirname(__FILE__) . '/../../source/'));
     $this->addTestSuite('\\pdepend\\reflection\\parser\\TokenizerTest');
     $this->addTestSuite('\\pdepend\\reflection\\parser\\ParserTest');
 }
示例#5
0
 /**
  * Constructs a new test suite instance.
  */
 public function __construct()
 {
     $this->setName('org::pdepend::reflection::queries::AllTests');
     \PHPUnit_Util_Filter::addDirectoryToWhitelist(realpath(dirname(__FILE__) . '/../../source/'));
     $this->addTestSuite('\\pdepend\\reflection\\queries\\ReflectionClassQueryTest');
     $this->addTestSuite('\\pdepend\\reflection\\queries\\ReflectionDirectoryQueryTest');
     $this->addTestSuite('\\pdepend\\reflection\\queries\\ReflectionFileQueryTest');
 }
示例#6
0
 /**
  * Constructs a new test suite instance.
  */
 public function __construct()
 {
     $this->setName('org::pdepend::reflection::factories::AllTests');
     \PHPUnit_Util_Filter::addDirectoryToWhitelist(realpath(dirname(__FILE__) . '/../../source/'));
     $this->addTestSuite('\\pdepend\\reflection\\factories\\InternalReflectionClassFactoryTest');
     $this->addTestSuite('\\pdepend\\reflection\\factories\\NullReflectionClassFactoryTest');
     $this->addTestSuite('\\pdepend\\reflection\\factories\\StaticReflectionClassFactoryTest');
 }
 /**
  * Constructs a new test suite instance.
  */
 public function __construct()
 {
     $this->setName('PHP::ChangeCoverage::AllTests');
     PHPUnit_Util_Filter::addDirectoryToWhitelist(realpath(dirname(__FILE__) . '/../../../source/'));
     $this->addTest(PHP_ChangeCoverage_ChangeSet_AllTests::suite());
     $this->addTest(PHP_ChangeCoverage_Source_AllTests::suite());
     $this->addTest(PHP_ChangeCoverage_Report_AllTests::suite());
     $this->addTestSuite('PHP_ChangeCoverage_PHPUnitUnitTest');
     $this->addTestSuite('PHP_ChangeCoverage_XdebugUnitTest');
 }
 public static function suite()
 {
     if (!defined('PHPUNIT_TESTSUITE_WHITELIST_PREPARED')) {
         PHPUnit_Util_Filter::addDirectoryToWhitelist(dirname(dirname(dirname(__FILE__))));
         PHPUnit_Util_Filter::removeDirectoryFromWhitelist(dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'Samples');
         PHPUnit_Util_Filter::removeDirectoryFromWhitelist(dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'Tests');
         define('PHPUNIT_TESTSUITE_WHITELIST_PREPARED', TRUE);
     }
     $suite = new PHPUnit_Framework_TestSuite('PHPUnit_Util');
     $suite->addTest(Util_Log_AllTests::suite());
     $suite->addTest(Util_TestDox_AllTests::suite());
     $suite->addTestSuite('Util_TimerTest');
     return $suite;
 }
示例#9
0
 /**
  * Constructs a new test suite instance.
  */
 public function __construct()
 {
     $this->setName('org::pdepend::reflection::AllTests');
     \PHPUnit_Util_Filter::addDirectoryToWhitelist(realpath(dirname(__FILE__) . '/../source/'));
     $this->addTestSuite('\\pdepend\\reflection\\AutoloaderTest');
     $this->addTestSuite('\\pdepend\\reflection\\ReflectionClassProxyTest');
     $this->addTestSuite('\\pdepend\\reflection\\ReflectionClassCacheTest');
     $this->addTestSuite('\\pdepend\\reflection\\ReflectionClassProxyContextTest');
     $this->addTest(api\AllTests::suite());
     $this->addTest(factories\AllTests::suite());
     $this->addTest(parser\AllTests::suite());
     $this->addTest(queries\AllTests::suite());
     $this->addTest(resolvers\AllTests::suite());
     $this->addTestSuite('\\pdepend\\reflection\\ReflectionSessionTest');
     $this->addTestSuite('\\pdepend\\reflection\\ReflectionSessionInstanceTest');
     $this->addTest(integration\AllTests::suite());
     $this->addTest(regression\AllTests::suite());
 }
示例#10
0
 /**
  * Constructs a new test suite instance.
  */
 public function __construct()
 {
     $this->setName('org::pdepend::reflection::api::AllTests');
     \PHPUnit_Util_Filter::addDirectoryToWhitelist(realpath(dirname(__FILE__) . '/../../source/'));
     $this->addTestSuite('\\pdepend\\reflection\\api\\NullReflectionClassTest');
     $this->addTestSuite('\\pdepend\\reflection\\api\\StaticReflectionValueTest');
     $this->addTestSuite('\\pdepend\\reflection\\api\\StaticReflectionParameterTest');
     $this->addTestSuite('\\pdepend\\reflection\\api\\StaticReflectionPropertyTest');
     $this->addTestSuite('\\pdepend\\reflection\\api\\StaticReflectionInterfaceTest');
     $this->addTestSuite('\\pdepend\\reflection\\api\\StaticReflectionClassTest');
     $this->addTestSuite('\\pdepend\\reflection\\api\\StaticReflectionMethodTest');
     $this->addTestSuite('\\pdepend\\reflection\\api\\CompatibilityNullReflectionClassTest');
     $this->addTestSuite('\\pdepend\\reflection\\api\\CompatibilityReflectionClassTest');
     $this->addTestSuite('\\pdepend\\reflection\\api\\CompatibilityReflectionInterfaceTest');
     $this->addTestSuite('\\pdepend\\reflection\\api\\CompatibilityReflectionMethodTest');
     $this->addTestSuite('\\pdepend\\reflection\\api\\CompatibilityReflectionParameterTest');
     $this->addTestSuite('\\pdepend\\reflection\\api\\CompatibilityReflectionPropertyTest');
 }
示例#11
0
 public static function suite()
 {
     PHPUnit_Util_Filter::addDirectoryToWhitelist(DWOO_DIRECTORY . 'plugins/builtin');
     PHPUnit_Util_Filter::addDirectoryToWhitelist(DWOO_DIRECTORY . 'Dwoo');
     PHPUnit_Util_Filter::addFileToWhitelist(DWOO_DIRECTORY . 'Dwoo.php');
     PHPUnit_Util_Filter::removeDirectoryFromWhitelist(DWOO_DIRECTORY . 'Dwoo/Adapters');
     $suite = new self('Dwoo - Unit Tests Report');
     foreach (new DirectoryIterator(dirname(__FILE__)) as $file) {
         if (!$file->isDot() && !$file->isDir() && (string) $file !== 'DwooTests.php' && substr((string) $file, -4) === '.php') {
             require_once $file->getPathname();
             $class = basename($file, '.php');
             // to have an optional test suite, it should implement a public static function isRunnable
             // that returns true only if all the conditions are met to run it successfully, for example
             // it can check that an external library is present
             if (!method_exists($file, 'isRunnable') || call_user_func(array($file, 'isRunnable'))) {
                 $suite->addTestSuite($class);
             }
         }
     }
     return $suite;
 }
示例#12
0
 /**
  * look for test units and run them
  */
 public static function suite()
 {
     $testorder = array('CoreTests', 'ClearCompiledTests', 'ClearCacheTests', 'StringResourceTests', 'FileResourceTests', 'DoubleQuotedStringTests', 'CompileAssignTests', 'AttributeTests');
     $smarty_libs_dir = dirname(__FILE__) . '/../../distribution/libs';
     if (method_exists('PHPUnit_Util_Filter', $smarty_libs_dir)) {
         // Older versions of PHPUnit did not have this function,
         // which is used when determining which PHP files are
         // included in the PHPUnit code coverage result.
         PHPUnit_Util_Filter::addDirectoryToWhitelist($smarty_libs_dir);
         PHPUnit_Util_Filter::removeDirectoryFromWhitelist('./');
         // PHPUnit_Util_Filter::addDirectoryToWhitelist('../libs/plugins');
     }
     $suite = new self('Smarty 3 - Unit Tests Report');
     // load test which should run in specific order
     foreach ($testorder as $class) {
         require_once $class . '.php';
         $suite->addTestSuite($class);
     }
     $_classes = array();
     foreach (new DirectoryIterator(dirname(__FILE__)) as $file) {
         if (!$file->isDot() && !$file->isDir() && (string) $file !== 'smartytests.php' && (string) $file !== 'smartytestssingle.php' && (string) $file !== 'smartytestsfile.php' && substr((string) $file, -4) === '.php') {
             $class = basename($file, '.php');
             if (!in_array($class, $testorder)) {
                 require_once $file->getPathname();
                 // to have an optional test suite, it should implement a public static function isRunnable
                 // that returns true only if all the conditions are met to run it successfully, for example
                 // it can check that an external library is present
                 if (!method_exists($class, 'isRunnable') || call_user_func(array($class, 'isRunnable'))) {
                     $_classes[] = $class;
                 }
             }
         }
     }
     sort($_classes);
     foreach ($_classes as $class) {
         $suite->addTestSuite($class);
     }
     return $suite;
 }
示例#13
0
 * Copyright 2009, 2010, 2011, 2014 Yuriy Timofeev <*****@*****.**>
 * @author Yuriy Timofeev <*****@*****.**>
 * @package webacula
 * @license http://www.gnu.org/licenses/gpl-3.0.html GNU Public License
 */
require_once dirname(__FILE__) . '/application/bootstrap.php';
require_once dirname(__FILE__) . '/application/controllers/AllTests.php';
require_once dirname(__FILE__) . '/application/models/AllTests.php';
/* какие каталоги учитывать при построении отчета */
if (PHPUnit_Runner_Version::id() >= '3.5.0') {
    // PHPUnit 3.5.5
    PHP_CodeCoverage_Filter::getInstance()->addDirectoryToWhitelist('../application');
    PHP_CodeCoverage_Filter::getInstance()->removeFileFromWhitelist('../application/views/helpers');
} else {
    // PHPUnit 3.4
    PHPUnit_Util_Filter::addDirectoryToWhitelist('../application');
    PHPUnit_Util_Filter::removeFileFromWhitelist('../application/views/helpers');
}
class AllTests
{
    public static function main()
    {
        $parameters = array();
        PHPUnit_TextUI_TestRunner::run(self::suite(), $parameters);
    }
    public static function suite()
    {
        $suite = new PHPUnit_Framework_TestSuite('Webacula Test Suite');
        $suite->addTest(ControllersAllTests::suite());
        $suite->addTest(ModelsAllTests::suite());
        return $suite;
示例#14
0
}
if (defined('TESTS_GENERATE_REPORT') && TESTS_GENERATE_REPORT === true && version_compare(PHPUnit_Runner_Version::id(), '3.1.6', '>=')) {
    /*
     * Add Zend Framework 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($zfCoreLibrary);
    /*
     * Add Void 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($voidCoreLibrary);
    /*
     * Omit from code coverage reports the contents of the tests directory
     */
    foreach (array('.php', '.phtml', '.csv', '.inc') as $suffix) {
        PHPUnit_Util_Filter::addDirectoryToFilter($voidCoreTests, $suffix);
    }
    PHPUnit_Util_Filter::addDirectoryToFilter(PEAR_INSTALL_DIR);
    PHPUnit_Util_Filter::addDirectoryToFilter(PHP_LIBDIR);
}
/**
 * Start output buffering, if enabled
 */
if (defined('TESTS_ZEND_OB_ENABLED') && constant('TESTS_ZEND_OB_ENABLED')) {
    ob_start();
}
示例#15
0
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 *
 * @category  Zend
 * @package   Zend_Image
 * @author    Stanislav Seletskiy <*****@*****.**>
 * @author    Leonid Shagabutdinov <*****@*****.**>
 * @copyright Copyright (c) 2010
 * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License
 * @version   $Id$
 */
date_default_timezone_set('Asia/Novosibirsk');
error_reporting(E_ALL | E_STRICT);
define('ROOT_PATH', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR);
define('LIBRARY_PATH', ROOT_PATH . 'library' . DIRECTORY_SEPARATOR);
define('TESTS_PATH', ROOT_PATH . 'tests' . DIRECTORY_SEPARATOR);
set_include_path(implode(PATH_SEPARATOR, array(LIBRARY_PATH, TESTS_PATH, get_include_path())));
/*
 * PHPUnit
 */
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';
PHPUnit_Util_Filter::addDirectoryToWhitelist(LIBRARY_PATH);
示例#16
0
 /**
  * Constructs a new test suite instance.
  */
 public function __construct()
 {
     $this->setName('org::pdepend::reflection::integration::AllTests');
     \PHPUnit_Util_Filter::addDirectoryToWhitelist(realpath(dirname(__FILE__) . '/../../source/'));
     $this->addTestSuite('\\pdepend\\reflection\\integration\\ReflectionSessionIntegrationTest');
 }
示例#17
0
 /**
  * Initializes the test environment.
  *
  * @return void
  */
 public static function init()
 {
     // Is it not installed?
     if (is_file(dirname(__FILE__) . '/../../../PHP/Depend.php')) {
         $path = realpath(dirname(__FILE__) . '/../../..');
         $path .= PATH_SEPARATOR . get_include_path();
         set_include_path($path);
         $whitelist = realpath(dirname(__FILE__) . '/../../../PHP') . '/';
         PHPUnit_Util_Filter::addDirectoryToWhitelist($whitelist);
     }
     // Set test path
     $path = realpath(dirname(__FILE__) . '/../..');
     $path .= PATH_SEPARATOR . get_include_path();
     set_include_path($path);
     include_once 'PHP/Depend/Code/Filter/Collection.php';
     self::initVersionCompatibility();
 }
<?php

define('DIR_SF_REPLICA', realpath(dirname(__FILE__) . '/..'));
// Replica
require_once DIR_SF_REPLICA . '/lib/vendor/Replica/include.php';
// Symfony
$sfDir = DIR_SF_REPLICA . '/../../lib/vendor/symfony/lib';
require_once $sfDir . '/config/sfConfig.class.php';
sfConfig::set('sf_symfony_lib_dir', $sfDir);
// Plugin
require_once DIR_SF_REPLICA . '/lib/sfReplicaThumbnail.php';
require_once DIR_SF_REPLICA . '/lib/image/sfReplicaImageDoctrine.php';
require_once DIR_SF_REPLICA . '/lib/helper/ReplicaHelper.php';
// Doctrine
require_once DIR_SF_REPLICA . '/../../lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine.php';
spl_autoload_register(array('Doctrine', 'autoload'));
Doctrine_Manager::connection('mysql://*****:*****@localhost/test');
// Test
require_once DIR_SF_REPLICA . '/test/sfReplicaThumbnailTestCase.php';
PHPUnit_Util_Filter::addDirectoryToWhitelist(DIR_SF_REPLICA . '/lib');
示例#19
0
<?php

define("TEST_CASE", true);
define("SABEL_BASE", dirname(realpath(__FILE__)));
define("DS", DIRECTORY_SEPARATOR);
define("SBL_LOG_INFO", 0x1);
define("SBL_LOG_DEBUG", 0x2);
define("SBL_LOG_WARN", 0x4);
define("SBL_LOG_ERR", 0x8);
define("SBL_LOG_ALL", 0xff);
define("SBL_LOG_LEVEL", SBL_LOG_ALL);
if (in_array("-db", $_SERVER["argv"], true)) {
    PHPUnit_Util_Filter::addDirectoryToWhitelist(SABEL_BASE . DS . "sabel" . DS . "db");
} else {
    PHPUnit_Util_Filter::addDirectoryToWhitelist(SABEL_BASE . DS . "sabel");
    PHPUnit_Util_Filter::removeFileFromWhitelist(SABEL_BASE . DS . "sabel" . DS . "Sakle.php");
    PHPUnit_Util_Filter::removeDirectoryFromWhitelist(SABEL_BASE . DS . "sabel" . DS . "db");
    PHPUnit_Util_Filter::removeDirectoryFromWhitelist(SABEL_BASE . DS . "sabel" . DS . "sakle");
    PHPUnit_Util_Filter::removeDirectoryFromWhitelist(SABEL_BASE . DS . "sabel" . DS . "test");
    PHPUnit_Util_Filter::removeDirectoryFromWhitelist(SABEL_BASE . DS . "sabel" . DS . "cookie");
    PHPUnit_Util_Filter::removeFileFromWhitelist(SABEL_BASE . DS . "sabel" . DS . "response" . DS . "header" . DS . "Http.php");
}
define("TEST_DATA_DIR", SABEL_BASE . DS . "Test" . DS . "data");
define("TEST_APP_DIR", TEST_DATA_DIR . DS . "application");
define("MODULES_DIR_NAME", "app");
define("VIEW_DIR_NAME", "views");
define("LOG_DIR_PATH", TEST_APP_DIR . DS . "logs");
define("MODULES_DIR_PATH", TEST_APP_DIR . DS . "app");
define("COMPILE_DIR_PATH", TEST_APP_DIR . DS . "data" . DS . "compiled");
define("PRODUCTION", 0x1);
define("TEST", 0x2);
示例#20
0
/*
 * Prepend the library/, tests/, and models/ directories to the
 * include_path. This allows the tests to run out of the box.
 */
$path = array($models, $library, $tests, get_include_path());
set_include_path(implode(PATH_SEPARATOR, $path));
/**
 * Register autoloader
 */
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();
/*
 * Add library/ and models/ 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.
 */
if (defined('TESTS_GENERATE_REPORT') && TESTS_GENERATE_REPORT === true && version_compare(PHPUnit_Runner_Version::id(), '3.1.6', '>=')) {
    PHPUnit_Util_Filter::addDirectoryToWhitelist($library);
    PHPUnit_Util_Filter::addDirectoryToWhitelist($models);
    PHPUnit_Util_Filter::addDirectoryToWhitelist($controllers);
}
/**
 * Store application root in registry
 */
Zend_Registry::set('testRoot', $root);
Zend_Registry::set('testBootstrap', $root . '/application/bootstrap.php');
/*
 * Unset global variables that are no longer needed.
 */
unset($root, $library, $models, $controllers, $tests, $path);
示例#21
0
require_once PHPCB_SOURCE . '/Util/Autoloader.php';
require_once 'PHPUnit/Framework/TestSuite.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once 'PHPUnit/Util/Filter.php';
require_once dirname(__FILE__) . '/src/JSGeneratorTest.php';
require_once dirname(__FILE__) . '/src/HTMLGeneratorTest.php';
require_once dirname(__FILE__) . '/src/ErrorHandlerTest.php';
require_once dirname(__FILE__) . '/src/XMLGeneratorTest.php';
require_once dirname(__FILE__) . '/src/XMLHandlerTest.php';
require_once dirname(__FILE__) . '/src/FDHandlerTest.php';
require_once dirname(__FILE__) . '/src/PluginErrorTest.php';
require_once dirname(__FILE__) . '/src/Plugins/ErrorPMDTest.php';
require_once dirname(__FILE__) . '/src/Plugins/ErrorCPDTest.php';
require_once dirname(__FILE__) . '/src/Plugins/ErrorCheckstyleTest.php';
require_once dirname(__FILE__) . '/src/Plugins/ErrorPadawanTest.php';
PHPUnit_Util_Filter::addDirectoryToWhitelist(realpath(PHPCB_SOURCE));
/**
 * CbAlltests
 *
 * @category   PHP_CodeBrowser
 * @package    PHP_CodeBrowser
 * @subpackage PHPUnit
 * @author     Elger Thiele <*****@*****.**>
 * @copyright  2007-2009 Mayflower GmbH
 * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
 * @version    Release: @package_version@
 * @link       http://www.phpunit.de/
 * @since      Class available since 1.0
 */
class CbAllTests extends PHPUnit_Framework_TestSuite
{
示例#22
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'] . '/';
     }
 }
示例#23
0
if (defined('TESTS_ZEND_STANDARD_TRUNK_PATH')) {
    $zfStandardTrunkRoot = realpath(TESTS_ZEND_STANDARD_TRUNK_PATH);
} else {
    $zfStandardTrunkRoot = realpath(dirname(__FILE__) . '/../../trunk/');
}
$zfStandardTrunkLibrary = $zfStandardTrunkRoot . '/library';
$zfStandardTrunkTests = $zfStandardTrunkRoot . '/tests';
/*
 * 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($zfStandardIncubatorLibrary, $zfStandardIncubatorTests, $zfStandardTrunkLibrary, $zfStandardTrunkTests, get_include_path());
set_include_path(implode(PATH_SEPARATOR, $path));
/*
 * Add Zend Framework 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.
 */
if (TESTS_GENERATE_REPORT === true && version_compare(PHPUnit_Runner_Version::id(), '3.1.6', '>=')) {
    PHPUnit_Util_Filter::addDirectoryToWhitelist($zfStandardTrunkLibrary);
    PHPUnit_Util_Filter::addDirectoryToWhitelist($zfStandardIncubatorLibrary);
    PHPUnit_Util_Filter::addDirectoryToFilter(sys_get_temp_dir());
    PHPUnit_Util_Filter::addDirectoryToFilter(dirname(__FILE__));
}
/*
 * Unset global variables that are no longer needed.
 */
unset($zfStandardIncubatorRoot, $zfStandardIncubatorLibrary, $zfStandardIncubatorTests, $zfStandardTrunkRoot, $zfStandardTrunkLibrary, $zfStandardTrunkTests, $path);
示例#24
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;
 }
示例#25
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;
 }
示例#26
0
    $libDir = realpath(TESTS_BASE_DIR . '/../lib');
    if (!file_exists($libDir) || !is_dir($libDir)) {
        die('Bootstrapping failed. Could not determine lib dir.');
    }
    define('TESTS_LIB_DIR', $libDir);
    unset($libDir);
}
if (!defined('TESTS_APP_DIR')) {
    $appDir = realpath(TESTS_BASE_DIR . '/../application');
    if (!file_exists($appDir) || !is_dir($appDir)) {
        die('Bootstrapping failed. Could not determine app dir.');
    }
    define('TESTS_APP_DIR', $appDir);
    unset($appDir);
}
$loadLib = TESTS_LIB_DIR . '/loadlib.php';
require_once $loadLib;
unset($loadLib);
$loadApp = TESTS_APP_DIR . '/loadapp.php';
require_once $loadApp;
unset($loadApp);
PHPUnit_Util_Filter::addFileToFilter(__FILE__);
PHPUnit_Util_Filter::addDirectoryToFilter(TESTS_DIR);
PHPUnit_Util_Filter::addDirectoryToWhitelist(TESTS_LIB_DIR);
PHPUnit_Util_Filter::addDirectoryToWhitelist(TESTS_APP_DIR);
// config
if (file_exists(TESTS_BASE_DIR . '/config.php')) {
    require_once TESTS_BASE_DIR . '/config.php';
} else {
    require_once TESTS_BASE_DIR . '/config.dist.php';
}
示例#27
0
 * @license     http://www.gnu.org/licenses/lgpl.html     Lesser GPL
 * @version     $Id$
 */
error_reporting(E_ALL | E_STRICT);
chdir(dirname(__FILE__));
require_once 'PHPUnit/Util/Filter.php';
require_once 'PHPUnit/Framework/TestSuite.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once 'PHPUnit/Extensions/Database/TestCase.php';
if (file_exists('cfhCompile.compiled.php')) {
    require_once 'cfhCompile.compiled.php';
    PHPUnit_Util_Filter::addFileToWhitelist('cfhCompile.compiled.php');
} else {
    require_once '../library/cfhCompile/Loader.php';
    cfhCompile_Loader::registerAutoload();
    PHPUnit_Util_Filter::addDirectoryToWhitelist(realpath('../library/'));
    PHPUnit_Util_Filter::addFileToFilter(__FILE__);
}
/**
 * Main Unit Test Class.
 *
 * @category    cfh
 * @package     cfhCompile
 * @subpackage  UnitTests
 * @copyright   Copyright (c) 2007 - 2008 William Bailey <*****@*****.**>.
 */
class AllTests
{
    public static function suite($dir = NULL)
    {
        $base = realpath(dirname(__FILE__));
示例#28
0
 private function handleCoverageFilter($file)
 {
     if ($this->consider_covers_files == false) {
         return;
     }
     $data = file_get_contents($file);
     foreach (explode("\n", $data) as $line) {
         $file = str_replace(array('BASE', 'APP', 'LIB', 'FWK', '*'), array(AK_BASE_DIR, AK_APP_DIR, AK_LIB_DIR, AK_FRAMEWORK_DIR, ''), $line);
         if (is_file($file)) {
             $this->consider_covers_files == 'white' ? PHPUnit_Util_Filter::addFileToWhitelist($file) : PHPUnit_Util_Filter::addFileToFilter($file);
         } elseif (is_dir($file)) {
             $this->consider_covers_files == 'white' ? PHPUnit_Util_Filter::addDirectoryToWhitelist($file) : PHPUnit_Util_Filter::addDirectoryToFilter($file);
         }
     }
 }
示例#29
0
/*
 * 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);
示例#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);