本文整理汇总了PHP中AkConfig类的典型用法代码示例。如果您正苦于以下问题:PHP AkConfig类的具体用法?PHP AkConfig怎么用?PHP AkConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AkConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
$this->PluginInstaller = new AkPluginInstaller();
$this->PluginInstaller->app_app_dir = AkConfig::getDir('fixtures');
copy($this->template_path, $this->target_path);
$this->PluginInstaller->extension_points = array('PluginInstallerTargetClass' => 'plugin_installer_target_class.php');
}
示例2: index
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');
}
}
}
示例3: _run_from_file
public function _run_from_file($file_name, $all_in_one_test = true)
{
$multiple_expected_php = $multiple_sintags = '';
$tests = explode('===================================', file_get_contents(AkConfig::getDir('fixtures') . DS . $file_name));
foreach ($tests as $test) {
list($sintags, $php) = explode('-----------------------------------', $test);
$sintags = trim($sintags);
$expected_php = trim($php);
if (empty($sintags)) {
return;
} else {
$multiple_sintags .= $sintags;
$multiple_expected_php .= $expected_php;
}
$AkSintags = new AkSintagsParser();
$php = $AkSintags->parse($sintags);
if ($php != $expected_php) {
AkDebug::trace("GENERATED: \n" . $php);
AkDebug::trace("EXPECTED: \n" . $expected_php);
AkDebug::trace("SINTAGS: \n" . $sintags);
}
$this->assertEqual($php, $expected_php);
}
if ($all_in_one_test) {
$AkSintags = new AkSintagsParser();
$php = $AkSintags->parse($multiple_sintags);
if ($php != $multiple_expected_php) {
AkDebug::trace("GENERATED: \n" . $php);
AkDebug::trace("EXPECTED: \n" . $expected_php);
AkDebug::trace("SINTAGS: \n" . $sintags);
}
$this->assertEqual($php, $multiple_expected_php);
}
}
示例4: test_should_fill_the_table_with_yaml_data
public function test_should_fill_the_table_with_yaml_data()
{
$unit_tester = new AkUnitTest();
$unit_tester->installAndIncludeModels(array('TheModel' => 'id,name'));
$TheModel =& $unit_tester->TheModel;
$TheModel->create(array('name' => 'eins'));
$TheModel->create(array('name' => 'zwei'));
$TheModel->create(array('name' => 'drei'));
$TheModel->create(array('name' => 'vier'));
$this->assertEqual($TheModel->count(), 4);
$this->assertTrue($AllRecords = $TheModel->find());
$yaml = $TheModel->toYaml($AllRecords);
$yaml_path = AkConfig::getDir('fixtures') . DS . 'the_models.yml';
$this->assertFalse(file_exists($yaml_path));
AkFileSystem::file_put_contents($yaml_path, $yaml);
$unit_tester->installAndIncludeModels(array('TheModel' => 'id,name'));
try {
$TheModel->find();
} catch (RecordNotFoundException $e) {
$this->pass();
}
$this->assertEqual($TheModel->count(), 0);
$unit_tester->installAndIncludeModels(array('TheModel' => 'id,name'), array('populate' => true));
$this->assertEqual($TheModel->count(), 4);
unlink($yaml_path);
}
示例5: test_should_show_public_dot_404_dot_php
public function test_should_show_public_dot_404_dot_php()
{
$this->setMaximumRedirects(0);
$this->get(AkConfig::getOption('testing_url') . '/action_pack/public/index.php?ak=invalid');
$this->assertResponse(404);
$this->assertText("Exception in InvalidController#index");
}
示例6: test_should_connect_using_custom_namespace
public function test_should_connect_using_custom_namespace()
{
file_put_contents(AkConfig::getDir('config') . '/testing_object_database.yml', AkConfig::getDir('fixtures') . '/sample_config.yml');
$this->db->settings_namespace = 'testing_object_database';
$this->assertTrue($this->db->setupAdapter());
unlink(AkConfig::getDir('config') . '/testing_object_database.yml');
}
示例7: __construct
public function __construct()
{
parent::__construct();
foreach (glob(AkConfig::getDir('config') . '/locales/*.php') as $file) {
$this->original_locales[$file] = file_get_contents($file);
}
}
示例8: test_should_generate_controller_and_auxiliary_files
public function test_should_generate_controller_and_auxiliary_files()
{
$files = array(AkConfig::getDir('controllers') . DS . 'credit_card_controller.php', AkConfig::getDir('helpers') . DS . 'credit_card_helper.php', AkConfig::getDir('test') . DS . 'functional' . DS . 'controllers' . DS . 'credit_card_controller_test.php', AkConfig::getDir('test') . DS . 'unit' . DS . 'helpers' . DS . 'credit_card_helper_test.php', AkConfig::getDir('views') . DS . 'credit_card' . DS . 'open.html.tpl', AkConfig::getDir('views') . DS . 'credit_card' . DS . 'debit.html.tpl', AkConfig::getDir('views') . DS . 'credit_card' . DS . 'credit.html.tpl', AkConfig::getDir('views') . DS . 'credit_card' . DS . 'close.html.tpl');
clearstatcache();
foreach ($files as $file) {
file_exists($file) && unlink($file);
$this->assertFalse(file_exists($file));
}
AkFileSystem::file_put_contents(AkConfig::getDir('views') . DS . 'credit_card' . DS . 'credit.html.tpl', 'foo', array('base_path' => AK_FRAMEWORK_DIR));
clearstatcache();
$this->assertPattern('/collisions/', $this->runGeneratorCommand('controller CreditCard open debit credit close'));
AkFileSystem::file_delete(AkConfig::getDir('views') . DS . 'credit_card' . DS . 'credit.html.tpl', array('base_path' => AK_FRAMEWORK_DIR));
clearstatcache();
foreach ($files as $file) {
$this->assertFalse(file_exists($file));
}
$this->assertPattern('/ files have been created/', $this->runGeneratorCommand('controller CreditCard open debit credit close'));
clearstatcache();
foreach ($files as $file) {
$this->assertTrue(file_exists($file));
if (!file_exists($file)) {
AkDebug::trace($file);
}
@unlink($file);
}
}
示例9: createTemplate
public function createTemplate($file_name, $content = 'Dummy')
{
$file_name = str_replace('/', DS, $file_name);
$file_name = AkConfig::getDir('views') . DS . $file_name;
$this->assertTrue((bool) AkFileSystem::file_put_contents($file_name, $content));
$this->created_files[] = $file_name;
}
示例10: test_get_methods_filtered
public function test_get_methods_filtered()
{
$file = AkConfig::getDir('fixtures') . DS . 'reflection_test_class.php';
$class = new AkReflectionClass(file_get_contents($file));
$filteredMethods = $class->getMethods(array('tags' => array('WingsPluginInstallAs' => '.*')));
$this->assertEqual(1, count($filteredMethods));
$this->assertEqual('testFunction2', $filteredMethods[0]->getName());
}
示例11: __construct
function __construct()
{
if (!($this->webserver_enabled = AkConfig::getOption('webserver_enabled', false))) {
return;
}
$this->url = AkConfig::getOption('testing_url') . '/active_resource/public/index.php?ak=http_requests';
parent::__construct();
}
示例12: __construct
public function __construct()
{
AkConfig::setDir('suite', dirname(__FILE__));
if (!ADMIN_PLUGIN_RUNNING_ON_APPLICATION_SCOPE) {
$this->rebaseAppPaths(realpath(dirname(__FILE__) . str_repeat(DS . '..', 3) . DS . 'installer' . DS . 'admin_files'));
}
AkUnitTestSuite::cleanupTmpDir();
}
示例13: __construct
public function __construct()
{
AkConfig::setDir('suite', dirname(__FILE__));
$this->rebaseAppPaths();
$this->db = new AkOdbAdapter();
$this->db->connect(array('type' => 'mongo_db', 'database' => 'akelos_testing'));
defined('AK_TESTING_MONGO_DB_IS_CONNECTED') || define('AK_TESTING_MONGO_DB_IS_CONNECTED', $this->db->isConnected());
}
示例14: testPickLayoutIfActionameMatches
public function testPickLayoutIfActionameMatches()
{
$this->createViewTemplate('index.html');
$this->createTemplate('layouts/application.tpl');
$controller = $this->createControllerFor('index');
$controller->setLayout('application', array('only' => 'index'));
$this->expectRender(array('index.html', AkConfig::getDir('views') . DS . 'layouts/application.tpl'));
$controller->defaultRender();
}
示例15: test_setup
public function test_setup()
{
$original_fixtures = AkConfig::getDir('fixtures');
AkConfig::setDir('fixtures', AkConfig::getDir('suite') . DS . 'fixtures');
$this->uninstallAndInstallMigration('AdminPlugin');
$this->Extension = new Extension();
$this->populateTables('extensions');
AkConfig::setDir('fixtures', $original_fixtures);
}