当前位置: 首页>>代码示例>>PHP>>正文


PHP UserController::control方法代码示例

本文整理汇总了PHP中UserController::control方法的典型用法代码示例。如果您正苦于以下问题:PHP UserController::control方法的具体用法?PHP UserController::control怎么用?PHP UserController::control使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserController的用法示例。


在下文中一共展示了UserController::control方法的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');
 }
开发者ID:rayyan,项目名称:ThinkUp,代码行数:17,代码来源:TestOfUserController.php

示例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');
 }
开发者ID:JWFoxJr,项目名称:ThinkUp,代码行数:52,代码来源:TestOfUserController.php


注:本文中的UserController::control方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。