function testGetRulesFromIni() { $cache_manager = new PartialPageCacheManager(); registerTestingIni( 'partial_page_cache.ini', ' [rule1] server_id = test1 optional[] = test1 required[] = test2 [rule2] server_id = wow groups[] = members groups[] = visitors [not_valid_rule] bla-bla = bla-bla ' ); $this->assertEqual($cache_manager->getRules(), array( array('server_id' => 'test1', 'optional' => array('test1'), 'required' => array('test2')), array('server_id' => 'wow', 'groups' => array('members', 'visitors')) ) ); clearTestingIni(); }
function testGetPackagesFromIni() { registerTestingIni( 'packages.ini', ' packages[] = {PACKAGES_DIR_FOR_PACKAGES_INFO_TEST}test1 packages[] = {PACKAGES_DIR_FOR_PACKAGES_INFO_TEST}test2 ' ); $this->assertEqual($this->info->getPackages(), array( array('path' => PACKAGES_DIR_FOR_PACKAGES_INFO_TEST . 'test1', 'name' => 'PACKAGE1_FOR_PACKAGES_INFO_TEST'), array('path' => PACKAGES_DIR_FOR_PACKAGES_INFO_TEST . 'test2', 'name' => 'PACKAGE2_FOR_PACKAGES_INFO_TEST') ) ); $this->assertTrue(defined('PACKAGE1_FOR_PACKAGES_INFO_TEST_DIR')); $this->assertTrue(defined('PACKAGE2_FOR_PACKAGES_INFO_TEST_DIR')); $this->assertEqual(constant('PACKAGE1_FOR_PACKAGES_INFO_TEST_DIR'), PACKAGES_DIR_FOR_PACKAGES_INFO_TEST . 'test1'); $this->assertEqual(constant('PACKAGE2_FOR_PACKAGES_INFO_TEST_DIR'), PACKAGES_DIR_FOR_PACKAGES_INFO_TEST . 'test2'); clearTestingIni(); }
function testGetRulesFromIni() { $cache_manager = new FullPageCacheManager(); registerTestingIni( 'full_page_cache.ini', ' [rule1] path_regex = /root/test1 optional[] = test1 optional[] = test2 [rule2] path_regex = /root/test2 groups[] = members groups[] = visitors [not_valid_rule] path_regex = /root/test3 ' ); $this->assertEqual($cache_manager->getRules(), array( array('path_regex' => '/root/test1', 'optional' => array('test1', 'test2')), array('path_regex' => '/root/test2', 'groups' => array('members', 'visitors')) ) ); clearTestingIni(); }
function tearDown() { DebugMock :: tally(); unset($this->resolver); clearTestingIni(); PackagesInfo :: instance()->reset(); }
function testLoadPolicyFailedNoOptions() { registerTestingIni('acl.ini', ' user[] = some user data '); $authorizer = new MockSimpleACLAuthorizer($this); $authorizer->expectNever('attachPolicy'); $this->loader->load($authorizer); $authorizer->tally(); clearTestingIni(); }
function tearDown() { DebugMock :: tally(); clearTestingIni(); }
function testGetJobsFromIni() { $cron_manager = new CronManager(); registerTestingIni( 'cron.ini', ' [cron-job1] handle = test1.php interval = 10 [cron-job2] handle = test2.php interval = 20 [not_valid_cron-job] bla-bla = bla-bla ' ); $this->assertEqual($cron_manager->getJobs(), array( 'cron-job1' => array('handle' => 'test1.php', 'interval' => 10), 'cron-job2' => array('handle' => 'test2.php', 'interval' => 20) ) ); clearTestingIni(); }
function tearDown() { clearTestingIni(); }
function testGetRulesFromIni() { $cache_manager = new ImageCacheManager(); registerTestingIni( 'image_cache.ini', ' [rule1] path_regex = /root/test1 [rule2] path_regex = /root/test2 groups[] = members groups[] = visitors [not_valid_rule] path_regex = /root/test3 ' ); $this->toolkit->setReturnValue('getINI', getIni('image_cache.ini'), array('image_cache.ini')); $this->assertEqual($cache_manager->getRules(), array( array('path_regex' => '/root/test1'), array('path_regex' => '/root/test2', 'groups' => array('members', 'visitors')) ) ); clearTestingIni(); }
function tearDown() { clearTestingIni(); Limb::restoreToolkit(); }
function testRunOkActionNotFound() { registerTestingIni('404.service.ini', 'default_action = display [display]'); $toolkit =& Limb :: toolkit(); $request =& $toolkit->getRequest(); $response = $toolkit->getResponse(); $this->fc->expectOnce('next'); $this->service_resolver->expectOnce('resolve', array($request)); $this->service_resolver->setReturnReference('resolve', $this->service); $this->action_resolver->expectOnce('resolve', array($request)); $this->action_resolver->setReturnValue('resolve', $action = 'do'); $this->service->expectOnce('actionExists', array($action)); $this->service->setReturnValue('actionExists', false); $filter = new ServiceActionMappingFilter(); $filter->run($this->fc, $request, $response); $service404 = $toolkit->getService(); $this->assertEqual($service404->getName(), '404'); $this->assertEqual($service404->getCurrentAction(), 'display'); clearTestingIni(); }