'kupshop.localhost', 'QUERY_STRING' => '', 'SCRIPT_NAME' => 'index.php', 'REMOTE_ADDR' => '127.0.0.1', ]; $shop_dir = getenv('SHOP') ?: __DIR__.'/../../../shop'; chdir($shop_dir); // Disable stack traces of exception ini_set('xdebug.show_exception_trace', 0); $cfg['Cache']['prefix'] = 'tests'; switch (TEST_SUITE) { case 'shop': require_once './vendor/autoload.php'; if (file_exists('./config/config.php')) { require_once './config/config.php'; } else { require_once './include/config.php'; } $testConfig = './tests/functional/test.config.php'; is_readable($testConfig) && require_once $testConfig; require_once './include/functions.php'; break; case 'engine_units_float': require_once __DIR__.'/test.units_float.config.php'; require_once '../engine/web/functions.php'; $cfg['Addr']['print'] = 'www.kupshop.local/'; $cfg['Addr']['full'] = 'https://'.$cfg['Addr']['print']; $cfg['Path']['smarty_tpl']['templates'] = 'nic'; // Non-existent folder to skip shop templates break; case 'engine': require_once __DIR__.'/test.config.php'; require_once './engine/web/functions.php'; $cfg['Addr']['print'] = 'www.kupshop.local/'; $cfg['Addr']['full'] = 'https://'.$cfg['Addr']['print']; $cfg['Path']['smarty_tpl']['templates'] = 'nic'; // Non-existent folder to skip shop templates break; } if (QUERY_LOG) { sqlGetConnection() ->getConfiguration() ->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger()); } require_once $cfg['Path']['shared_version'].'web/lang/lang.cs.php'; function mutingErrorHandler($errno, $errstr, $errfile, $errline, $errcontext = null) { // TODO(hauschwitz): opravit deprecation warningy místo vypínání if ($errno === E_DEPRECATED || $errno === E_USER_DEPRECATED) { return true; } if (stripos($errfile, '.tpl.php') !== false) { return true; } if (stripos($errfile, 'smarty_internal_templatebase') !== false) { return true; } $errorHandler = new PHPUnit\Util\ErrorHandler(false, true, true, true); return $errorHandler($errno, $errstr, $errfile, $errline); } /** * @return string */ function getTestSuite() { $args = $GLOBALS['argv']; $testSuiteParamIndex = array_search('--testsuite', $args); if ($testSuiteParamIndex) { return $args[$testSuiteParamIndex + 1]; } return 'engine'; } $GLOBALS['previous'] = set_error_handler('mutingErrorHandler'); spl_autoload_register(function ($className) { $fileName = __DIR__.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $className).'.php'; if (!file_exists($fileName)) { return; } require $fileName; }); if (TEST_SUITE == 'shop') { // Autoloader for shop tests spl_autoload_register(function ($className) { $fileName = 'tests/functional'.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $className).'.php'; if (!file_exists($fileName)) { return; } require $fileName; }); } // Prepare database global $db; $db = new \KupShop\DevelopmentBundle\Util\Tests\DatabaseUtils(); $db->prepare();