Beispiel #1
0
<?php

$config = ['id' => 'yii2-user-test', 'basePath' => dirname(__DIR__), 'bootstrap' => ['scheduler'], 'extensions' => require VENDOR_DIR . '/yiisoft/extensions.php', 'aliases' => ['@vendor' => VENDOR_DIR, '@bower' => VENDOR_DIR . '/bower', '@tests' => dirname(__DIR__) . '/../', '@tests/config' => '@tests/_config'], 'modules' => ['scheduler' => ['class' => 'webtoolsnz\\scheduler\\Module']], 'components' => ['assetManager' => ['basePath' => __DIR__ . '/../assets'], 'log' => null, 'cache' => null, 'request' => ['enableCsrfValidation' => false, 'enableCookieValidation' => false], 'db' => require __DIR__ . '/db.php', 'mailer' => ['class' => 'yii\\swiftmailer\\Mailer', 'useFileTransport' => true]]];
if (defined('YII_APP_BASE_PATH')) {
    $config = Codeception\Configuration::mergeConfigs($config, require YII_APP_BASE_PATH . '/tests/codeception/config/config.php');
}
return $config;
<?php

// Here you can initialize variables that will for your tests
\Codeception\Configuration::$lock = true;
function make_container()
{
    return \Codeception\Util\Stub::make('Codeception\\Lib\\ModuleContainer');
}
require_once \Codeception\Configuration::dataDir() . 'DummyOverloadableClass.php';
Beispiel #3
0
} else {
    __c3_error(sprintf("Codeception config file '%s' not found", $config_file));
}
try {
    \Codeception\Configuration::config($config_file);
} catch (\Exception $e) {
    __c3_error($e->getMessage());
}
if (!defined('C3_CODECOVERAGE_MEDIATE_STORAGE')) {
    // workaround for 'zend_mm_heap corrupted' problem
    gc_disable();
    if ((int) ini_get('memory_limit') < 384) {
        ini_set('memory_limit', '384M');
    }
    define('C3_CODECOVERAGE_MEDIATE_STORAGE', Codeception\Configuration::logDir() . 'c3tmp');
    define('C3_CODECOVERAGE_PROJECT_ROOT', Codeception\Configuration::projectDir());
    define('C3_CODECOVERAGE_TESTNAME', $_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE']);
    function __c3_build_html_report(PHP_CodeCoverage $codeCoverage, $path)
    {
        $writer = new PHP_CodeCoverage_Report_HTML();
        $writer->process($codeCoverage, $path . 'html');
        if (file_exists($path . '.tar')) {
            unlink($path . '.tar');
        }
        $phar = new PharData($path . '.tar');
        $phar->setSignatureAlgorithm(Phar::SHA1);
        $files = $phar->buildFromDirectory($path . 'html');
        array_map('unlink', $files);
        if (in_array('GZ', Phar::getSupportedCompression())) {
            if (file_exists($path . '.tar.gz')) {
                unlink($path . '.tar.gz');
Beispiel #4
0
<?php

$config = Codeception\Configuration::config()['config'];
putenv('ENV_FILE=' . $config['environment_file']);
require __DIR__ . '/../bootstrap.php';
$url = parse_url($config['test_entry_url']);
$file = PROJECT_PATH . '/' . $config['test_entry_file'];
define('YII_TEST_ENTRY_FILE', $file);
define('YII_TEST_ENTRY_URL', $url['path']);
Yii::setAlias('@tests', __DIR__);
$_SERVER['SCRIPT_FILENAME'] = YII_TEST_ENTRY_FILE;
$_SERVER['SCRIPT_NAME'] = YII_TEST_ENTRY_URL;
$_SERVER['SERVER_NAME'] = $url['host'];
$_SERVER['SERVER_PORT'] = (string) ($url['port'] ?: 80);