function loadMockery() { require_once 'Mockery/Loader.php'; require_once 'Hamcrest/Hamcrest.php'; $loader = new Mockery\Loader(); $loader->register(); }
public function _start() { $this->getTest()->diag('Harvest Followers test is starting'); $loader = new \Mockery\Loader(); $loader->register(); // database $appconfiguration = ProjectConfiguration::getApplicationConfiguration('frontend', 'test', true); new sfDatabaseManager($appconfiguration); // Ugly workaround for clearing all data beforehand // FIXME: Create a better solution Propel::getConnection()->exec('TRUNCATE TABLE follower'); }
<?php error_reporting(E_ALL | E_STRICT); ini_set('display_errors', 1); $root = realpath(dirname(dirname(__FILE__))); $library = "{$root}/Services"; $tests = "{$root}/tests"; $path = array($library, $tests, get_include_path()); set_include_path(implode(PATH_SEPARATOR, $path)); $vendorFilename = dirname(__FILE__) . '/../vendor/autoload.php'; if (file_exists($vendorFilename)) { /* composer install */ require $vendorFilename; } else { /* hope you have it installed somewhere. */ require_once 'Mockery/Loader.php'; } $loader = new \Mockery\Loader(); $loader->register(); require_once 'Twilio.php'; unset($root, $library, $tests, $path);
public function tearDown() { spl_autoload_unregister('\\Mockery\\Loader::loadClass'); $loader = new \Mockery\Loader(); $loader->register(); }
$applicationPath = realpath(dirname(__FILE__) . '/../../application/'); $modulePath = realpath(dirname(__FILE__) . '/../../modules/'); $libraryPath = realpath(dirname(__FILE__) . '/../../library/'); $testLibraryPath = realpath(dirname(__FILE__) . '/library/'); $configPath = realpath($libraryPath . '/../config'); // Is usually done in the application's bootstrap and is used by some of our internals if (!defined('ICINGAWEB_APPDIR')) { define('ICINGAWEB_APPDIR', $applicationPath); } if (!defined('ICINGA_LIBDIR')) { define('ICINGA_LIBDIR', $libraryPath); } // This is needed to get the Zend Plugin loader working set_include_path(implode(PATH_SEPARATOR, array($libraryPath, get_include_path()))); require_once 'Mockery/Loader.php'; $mockeryLoader = new \Mockery\Loader(); $mockeryLoader->register(); require_once $libraryPath . '/Icinga/Test/ClassLoader.php'; $loader = new Icinga\Test\ClassLoader(); $loader->registerNamespace('Tests', $testLibraryPath); $loader->registerNamespace('Icinga', $libraryPath . '/Icinga'); $loader->registerNamespace('Icinga\\Forms', $applicationPath . '/forms'); $modules = scandir($modulePath); foreach ($modules as $module) { if ($module === '.' || $module === '..') { continue; } $moduleNamespace = 'Icinga\\Module\\' . ucfirst($module); $moduleLibraryPath = $modulePath . '/' . $module . '/library/' . ucfirst($module); if (is_dir($moduleLibraryPath)) { $loader->registerNamespace($moduleNamespace, $moduleLibraryPath);
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 Mutagenesis 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); } /** * Setup autoloaders! */ require_once 'Mutagenesis/Loader.php'; $loader = new \Mutagenesis\Loader(); $loader->register(); require_once 'Mockery/Loader.php'; $loader = new \Mockery\Loader(); $loader->register(true); /* * Unset global variables that are no longer needed. */ unset($root, $library, $tests, $path);