本文整理汇总了PHP中UserController::getViewManager方法的典型用法代码示例。如果您正苦于以下问题:PHP UserController::getViewManager方法的具体用法?PHP UserController::getViewManager怎么用?PHP UserController::getViewManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserController
的用法示例。
在下文中一共展示了UserController::getViewManager方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testExistentUserWithInstance
public function testExistentUserWithInstance()
{
$builders = $this->buildData();
$this->simulateLogin('me@example.com');
$_GET['u'] = 'someuser1';
$_GET['n'] = 'twitter';
$_GET['i'] = 'instancetestuser';
$controller = new UserController(true);
$this->assertTrue(isset($controller));
$results = $controller->control();
$this->assertPattern("/someuser1/", $results);
//test if view variables were set correctly
$v_mgr = $controller->getViewManager();
$this->assertEqual($v_mgr->getTemplateDataItem('controller_title'), 'User Details: someuser1');
$this->assertEqual($v_mgr->getTemplateDataItem('logo_link'), 'index.php');
$this->assertEqual($controller->getCacheKeyString(), 'user.index.tpl-me@example.com-someuser1-twitter-instancetestuser');
}
示例2: testUserPostPaging
public function testUserPostPaging()
{
$builders = $this->buildData();
$i = 0;
while ($i < 43) {
//3 pages of posts, 2 pages of 20 + 1 page of 3
$builders[] = FixtureBuilder::build('posts', array('author_username' => 'someuser1', 'author_user_id' => 10, 'network' => 'twitter', 'post_id' => 200 + $i));
$i++;
}
$this->simulateLogin('me@example.com');
$_GET['u'] = 'someuser1';
$_GET['n'] = 'twitter';
$_GET['i'] = 'instancetestuser';
//First page
$controller = new UserController(true);
$this->assertTrue(isset($controller));
$results = $controller->control();
$this->assertPattern("/someuser1/", $results);
//test if view variables were set correctly
$v_mgr = $controller->getViewManager();
$this->assertEqual($v_mgr->getTemplateDataItem('controller_title'), 'User Details: someuser1');
//enough posts to warrant a next page link
$this->assertEqual($v_mgr->getTemplateDataItem('next_page'), 2);
$this->assertEqual($v_mgr->getTemplateDataItem('last_page'), null);
$this->assertEqual($controller->getCacheKeyString(), '.htuser.index.tpl-me@example.com-someuser1-twitter-instancetestuser');
//Second page
$_GET['page'] = '2';
$controller = new UserController(true);
$this->assertTrue(isset($controller));
$results = $controller->control();
$this->assertPattern("/someuser1/", $results);
//test if view variables were set correctly
$v_mgr = $controller->getViewManager();
$this->assertEqual($v_mgr->getTemplateDataItem('controller_title'), 'User Details: someuser1');
//enough posts to warrant a next page link
$this->assertEqual($v_mgr->getTemplateDataItem('next_page'), 3);
$this->assertEqual($v_mgr->getTemplateDataItem('last_page'), 1);
$this->assertEqual($controller->getCacheKeyString(), '.htuser.index.tpl-me@example.com-someuser1-twitter-instancetestuser-2');
//Third (last) page
$_GET['page'] = '3';
$controller = new UserController(true);
$this->assertTrue(isset($controller));
$results = $controller->control();
$this->assertPattern("/someuser1/", $results);
//test if view variables were set correctly
$v_mgr = $controller->getViewManager();
$this->assertEqual($v_mgr->getTemplateDataItem('controller_title'), 'User Details: someuser1');
//enough posts to warrant a next page link
$this->assertEqual($v_mgr->getTemplateDataItem('next_page'), null);
$this->assertEqual($v_mgr->getTemplateDataItem('last_page'), 2);
$this->assertEqual($controller->getCacheKeyString(), '.htuser.index.tpl-me@example.com-someuser1-twitter-instancetestuser-3');
}