本文整理汇总了PHP中TestController::getViewManager方法的典型用法代码示例。如果您正苦于以下问题:PHP TestController::getViewManager方法的具体用法?PHP TestController::getViewManager怎么用?PHP TestController::getViewManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestController
的用法示例。
在下文中一共展示了TestController::getViewManager方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testControl
/**
* Test controller
* @TODO Possibly load the resulting markup as a DOM object and test various children in it; this would enforce valid markup
*/
function testControl()
{
$config = Config::getInstance();
$controller = new TestController(true);
$results = $controller->go();
//test if view variables were set correctly
$v_mgr = $controller->getViewManager();
$this->assertEqual($v_mgr->getTemplateDataItem('test'), 'Testing, testing, 123');
$this->assertEqual($v_mgr->getTemplateDataItem('app_title'), 'ThinkTank');
$this->assertEqual($results, '<a href="' . $config->getValue('site_root_path') . 'index.php">ThinkTank</a>: Testing, testing, 123 | Not logged in', "controller output");
}
示例2: testExceptionHandling
/**
* 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']);
}