public function index()
 {
     $this->base_dir = AK_BASE_DIR;
     $this->akelos_dir = AK_FRAMEWORK_DIR;
     $this->tasks_dir = AK_TASKS_DIR;
     $this->has_configuration = file_exists(AkConfig::getDir('config') . DS . 'config.php');
     $this->has_routes = file_exists(AkConfig::getDir('config') . DS . 'routes.php');
     $this->has_database = file_exists(AkConfig::getDir('config') . DS . 'database.yml');
     $this->using_root_path = $this->Request->getPath() == '/';
     $this->new_install = !$this->has_configuration || !$this->has_routes || $this->using_root_path;
     $this->environment = AK_ENVIRONMENT;
     $this->memcached_on = AkMemcache::isServerUp();
     $this->constants = AkDebug::get_constants();
     $this->langs = Ak::langs();
     $this->database_settings = Ak::getSettings('database', false);
     $this->server_user = trim(AK_WIN ? `ECHO %USERNAME%` : `whoami`);
     $this->local_ips = AkConfig::getOption('local_ips', array('localhost', '127.0.0.1', '::1'));
     $paths = array(AK_APP_DIR . DS . 'locales');
     $this->invalid_permissions = array();
     foreach ($paths as $path) {
         if (is_dir($path) && !@file_put_contents($path . DS . '__test_file')) {
             $this->invalid_permissions[] = $path;
         } else {
             @unlink($path . DS . '__test_file');
         }
     }
 }
示例#2
0
 public function test_flush_group()
 {
     if (!is_a($this->memcache, 'AkCache')) {
         $this->fail('Caching is not enabled. Please enable caching for the unit test');
         return;
     }
     $retrieved = $this->memcache->get('test_id_10', 'strings');
     $this->assertTrue($retrieved != null);
     $this->memcache->clean('strings');
     $retrieved = $this->memcache->get('test_id_10', 'strings');
     $this->assertTrue($retrieved == null);
     $retrieved = $this->memcache->get('test_id_9', 'strings');
     $this->assertTrue($retrieved == null);
     $retrieved = $this->memcache->get('test_id_8', 'strings');
     $this->assertTrue($retrieved == null);
     $retrieved = $this->memcache->get('test_id_2', 'integers');
     $this->assertTrue($retrieved != null);
 }
示例#3
0
 public function test_all_caches()
 {
     $cacheHandlers = array('cache_lite' => 1, 'akadodbcache' => 2);
     $memcacheEnabled = AkConfig::getOption('memcached_enabled', AkMemcache::isServerUp());
     if ($memcacheEnabled) {
         $cacheHandlers['akmemcache'] = 3;
     }
     $unitTests = array('_test_cache_with_string_key', '_test_cache_with_string_key_cached');
     if ($this->controller->_CacheHandler instanceof AkCacheHandler) {
         foreach ($cacheHandlers as $class => $type) {
             $this->controller->_CacheHandler->setCacheStore($type);
             $this->_test_init();
             foreach ($unitTests as $test) {
                 $this->{$test}($class);
             }
         }
     } else {
         $this->fail('CacheHandler is not initialized. Please enable the caching system for the unit-test');
     }
 }
示例#4
0
文件: ci-test.php 项目: joeymetal/v1
 function _checkMemcacheInstallation($socket = null)
 {
     if ($socket == null) {
         $socket = $this->settings['memcached-socket'];
         if (empty($socket)) {
             return true;
         }
     }
     require_once AK_BASE_DIR . DS . 'lib' . DS . 'AkCache' . DS . 'AkMemcache.php';
     $memcache = new AkMemcache();
     return @$memcache->init(array('servers' => array($socket)));
 }
示例#5
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']) . '';
 }
示例#6
0
文件: memcache.php 项目: bermi/akelos
 static function isServerUp($options = array())
 {
     $options['silent_mode'] = true;
     $Memcached = new AkMemcache();
     return $Memcached->init($options) != false;
 }
示例#7
0
 public function __construct()
 {
     parent::__construct();
     $this->memcached_enabled = AkConfig::getOption('memcached_enabled', AkMemcache::isServerUp());
 }
示例#8
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__);
}