Esempio n. 1
0
 /**
  * Test cache key, no params
  * @TODO Possibly load the resulting markup as a DOM object and test various children in it; this would enforce valid markup
  */
 function testCacheKeyNoRequestParams()
 {
     $config = Config::getInstance();
     $config->setValue('cache_pages', true);
     $controller = new TestController(true);
     $results = $controller->go();
     $this->assertEqual($controller->getCacheKeyString(), '');
 }
 /**
  * Test exception handling
  */
 public function testExceptionHandling()
 {
     $_GET['throwexception'] = 'yesindeedy';
     $controller = new TestController(true);
     $results = $controller->go();
     $v_mgr = $controller->getViewManager();
     $config = Config::getInstance();
     $this->assertEqual('Testing exception handling!', $v_mgr->getTemplateDataItem('error_msg'));
     $this->assertPattern('/<html/', $results);
     $_GET['json'] = true;
     $results = $controller->go();
     $this->debug($results);
     $this->assertFalse(strpos($results, '<html'));
     $this->assertPattern('/{/', $results);
     $this->assertPattern('/Testing exception handling/', $results);
     $this->assertEqual('Exception', $v_mgr->getTemplateDataItem('error_type'));
     unset($_GET['json']);
     $_GET['text'] = true;
     $results = $controller->go();
     $this->assertFalse(strpos($results, '<html'));
     $this->assertFalse(strpos($results, '{'));
     $this->assertPattern('/Testing exception handling/', $results);
     $this->assertEqual('Exception', $v_mgr->getTemplateDataItem('error_type'));
     unset($_GET['text']);
 }