示例#1
0
 function __construct()
 {
     $this->dropTables('all');
     AkUnitTestSuite::cleanupTmpDir();
     $Config = new AkConfig();
     $Config->clearStaticCache('database');
     parent::__construct();
 }
示例#2
0
文件: config.php 项目: bermi/admin
 public function __destruct()
 {
     if (!ADMIN_PLUGIN_RUNNING_ON_APPLICATION_SCOPE) {
         AdminPluginInstaller::setTokenKey('some long and random secret value to avoid being hacked, used for login urls and API calls');
     }
     parent::__destruct();
     AkUnitTestSuite::cleanupTmpDir();
     $this->dropTables('all');
 }
示例#3
0
文件: cache.php 项目: bermi/akelos
 public function test_all_caches()
 {
     $cacheHandlers = array('cache_lite' => 1, 'akadodbcache' => 2);
     $memcacheEnabled = AkConfig::getOption('memcached_enabled', false);
     AkUnitTestSuite::createTestingDatabaseIfNotAvailable();
     if ($memcacheEnabled) {
         $cacheHandlers['akmemcache'] = 3;
     }
     $unitTests = array('_testInit', '_getAndSaveTests', '_removeTests', '_cleanTests');
     foreach ($cacheHandlers as $class => $type) {
         foreach ($unitTests as $test) {
             unset($this->Cache);
             $this->Cache = new AkCache();
             $this->{$test}($type, $class);
         }
         $this->Cache->clean($this->group);
     }
 }
示例#4
0
if ($db_type = empty($options['db']) ? false : $options['db']) {
    define('AK_DATABASE_SETTINGS_NAMESPACE', $db_type);
    unset($options['db']);
}
if (empty($options)) {
    $Logger->message('Invalid test name');
    echo "Invalid test name\n";
    return false;
}
$valid_options = array('config', 'base_path', 'namespace', 'TestSuite', 'reporter' => 'TextReporter', 'files');
$options['files'] = array();
$suite = '';
foreach ($options as $k => $v) {
    if (!in_array($k, $valid_options)) {
        if (!is_bool($v)) {
            $v = rtrim($v, DS);
            if (strstr($v, DS) || strstr($v, '/')) {
                $options['files'][] = $v . '.php';
            } else {
                $suite .= $v . ' ';
            }
            unset($options[$k]);
        }
    }
}
if (empty($options['suite']) && !empty($suite)) {
    $options['suite'] = trim($suite);
}
$options = array_diff($options, array(''));
AkUnitTestSuite::runFromOptions($options);
示例#5
0
文件: config.php 项目: bermi/akelos
 public function __destruct()
 {
     parent::__destruct();
     AkUnitTestSuite::cleanupTmpDir();
     $this->dropTables('all');
 }
示例#6
0
文件: config.php 项目: bermi/akelos
 public function __destruct()
 {
     parent::__destruct();
     AkUnitTestSuite::cleanupTmpDir();
 }
示例#7
0
defined('AK_TESTING_NAMESPACE') || define('AK_TESTING_NAMESPACE', 'akelos');
defined('AK_TESTING_URL') || define('AK_TESTING_URL', 'http://akelos.tests');
include_once AK_FRAMEWORK_DIR . DS . 'autoload.php';
if (AK_CLI && !AK_WIN) {
    // will try to set the right mode for tmp folders, git does not kee trac of this for us
    foreach ((array) glob(AK_BASE_DIR . DS . 'tmp' . DS . '*' . DS . '*/') as $__folder) {
        `chmod 777 {$__folder}`;
    }
    unset($__folder);
}
if (!AkConfig::getOption('testing_url', false)) {
    AkConfig::setOption('testing_url', AK_TESTING_URL);
}
AkUnitTestSuite::checkIfTestingWebserverIsAccesible(array('base_path' => AK_TEST_DIR . DS . AK_TESTING_NAMESPACE));
AkUnitTestSuite::createTestingDatabaseIfNotAvailable();
AkUnitTestSuite::ensureTmpDirPermissions();
try {
    ob_start();
    if (!class_exists('BaseActionController')) {
        class BaseActionController extends AkActionController
        {
        }
    }
    if (!class_exists('ApplicationController')) {
        class ApplicationController extends BaseActionController
        {
            public $layout = false;
        }
    }
    if (!class_exists('BaseActiveRecord')) {
        class BaseActiveRecord extends AkActiveRecord
示例#8
0
文件: suite.php 项目: bermi/akelos
 static function getTestTitle($options)
 {
     AkConfig::setOption('testing_url', AK_TESTING_URL);
     AkConfig::setOption('memcached_enabled', AkMemcache::isServerUp());
     AkUnitTestSuite::checkIfTestingWebserverIsAccesible($options);
     $dabase_settings = AK_DATABASE_SETTINGS_NAMESPACE == 'database' ? Ak::getSetting('database', 'type') : AK_DATABASE_SETTINGS_NAMESPACE;
     return "PHP " . phpversion() . ", Environment: " . AK_ENVIRONMENT . ", Database: " . $dabase_settings . (AkConfig::getOption('memcached_enabled', false) ? ', Memcached: enabled' : '') . (AkConfig::getOption('webserver_enabled', false) ? ', Testing URL: ' . AkConfig::getOption('testing_url') : ', Testing URL: DISABLED!!!') . "\n" . "Error reporting set to: " . AkConfig::getErrorReportingLevelDescription() . "\n" . trim($options['description']) . '';
 }
示例#9
0
    echo "Invalid test name\n";
    return false;
}
$valid_options = array('config', 'base_path', 'namespace', 'TestSuite', 'reporter' => 'TextReporter', 'files');
$controllers = array();
foreach ($options as $k => $v) {
    if (!in_array($k, $valid_options)) {
        if (!is_bool($v)) {
            $v = rtrim($v, DS);
            $options['files'][] = $options['base_path'] . DS . $v . '_controller_test.php';
            unset($options[$k]);
        }
    }
}
if (empty($options['files'])) {
    $controller_files = glob($options['base_path'] . DS . '*_controller_test.php');
    foreach ($controller_files as $k => $controller) {
        if (is_file($controller)) {
            $options['files'][] = $controller;
        }
    }
}
if (empty($options['description']) && !empty($options['files'])) {
    $description = array();
    foreach ($options['files'] as $file) {
        $description[] = trim(str_replace(array($options['base_path'], DS, '_controller_test.php'), '', $file), DS);
    }
    $options['description'] = AkTextHelper::pluralize(count($description), 'Fixture for controller ', 'Fixtures for controllers ') . '(' . join(', ', $description) . ')';
}
AkUnitTestSuite::runFunctionalFromOptions($options);
示例#10
0
文件: config.php 项目: bermi/akelos
<?php

if (!defined('AK_BASE_DIR') && !defined('AK_FRAMEWORK_DIR')) {
    define('AK_FRAMEWORK_DIR', realpath(dirname(__FILE__) . '/../../'));
    if (is_dir(AK_FRAMEWORK_DIR . DIRECTORY_SEPARATOR . 'app_layout')) {
        define('AK_BASE_DIR', AK_FRAMEWORK_DIR . DIRECTORY_SEPARATOR . 'app_layout');
    }
}
require_once dirname(__FILE__) . '/../shared/config/config.php';
AkConfig::setOption('testing_url', 'http://akelos.tests/akelos');
AkConfig::setOption('action_controller.session', array("key" => "_myapp_session", "secret" => "c1ef4792-42c5-b484-819e-16750c71cddb"));
AkUnitTestSuite::checkIfTestingWebserverIsAccesible(array('base_path' => dirname(__FILE__)));
AkConfig::setOption('memcached_enabled', AkMemcache::isServerUp());
if (AK_WEB_REQUEST && !(AK_REMOTE_IP == '127.0.0.1' || AK_REMOTE_IP == '::1')) {
    die('Web tests can only be called from localhost(127.0.0.1), you can change this beahviour in ' . __FILE__);
}
示例#11
0
文件: run_tests.php 项目: bermi/admin
<?php

include_once dirname(__FILE__) . '/plugins/admin/config.php';
$_model_files = glob(dirname(__FILE__) . DS . 'plugins' . DS . 'admin' . DS . 'cases' . DS . '*.php');
$_included_files = get_included_files();
if (count($_included_files) == count(array_diff($_included_files, $_model_files))) {
    $Suite = new AkUnitTestSuite('Admin Plugin Tests');
    foreach ($_model_files as $file) {
        $Suite->addFile($file);
    }
}
if (isset($argv[1]) && $argv[1] == '-ci') {
    exit($Suite->run(new AkXUnitXmlReporter()));
} else {
    $Suite->run(new AkelosTextReporter());
}