• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP set_controller函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中set_controller函数的典型用法代码示例。如果您正苦于以下问题:PHP set_controller函数的具体用法?PHP set_controller怎么用?PHP set_controller使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了set_controller函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: testCheckForm

 /**
  * @dataProvider formProvider
  */
 public function testCheckForm($username = '', $password = '', $verifycode = '', $err = '', $ajax_status = '', $alter_mes = '', $warnings_key = '')
 {
     $this->CI = set_controller('ajax/login');
     $this->CI->session->set_userdata('auth_code', $this->app_authcode);
     $_GET['username'] = $username;
     $_GET['password'] = $password;
     $_GET['verifycode'] = $verifycode;
     $_GET['err'] = $err;
     // init
     $this->CI->ajax->warnings = array();
     $this->CI->ajax->errors = array();
     $this->CI->ajax->successes = array();
     // ob 忽略输出
     ob_start();
     $result = $this->CI->check_form();
     ob_end_clean();
     $status = $this->CI->ajax->status_code;
     $mes = '';
     if (count($this->CI->ajax->warnings) != 0) {
         $mes = $this->CI->ajax->warnings[$warnings_key];
     }
     // error mes path
     if (count($this->CI->ajax->errors) != 0) {
         $mes = $this->CI->ajax->errors[$warnings_key];
     }
     // error mes path
     if (count($this->CI->ajax->successes) != 0) {
         $mes = $this->CI->ajax->successes[$warnings_key];
     }
     // 断言
     $this->assertEquals($mes, $alter_mes);
     $this->assertEquals($status, $ajax_status);
 }
开发者ID:TheOne1006,项目名称:phpunit_for_ci_2.1.x,代码行数:36,代码来源:ajaxLoginTest.php


示例2: testAfterReg

 public function testAfterReg()
 {
     $this->CI = set_controller('ajax/register');
     //全局变量 侵入
     $data_success_with_invite = array('phone' => '18810556559', 'password' => '123456', 'smsCode' => '123456', 'verifycode' => '1234', 'invite_uid' => '2');
     //全局变量 侵入
     foreach ($data_success_with_invite as $key => $value) {
         $_GET[$key] = $value;
     }
     // 图片验证码 1234
     $this->CI->session->set_userdata('auth_code', $this->authcode);
     // 短信验证码 123456
     $this->CI->session->set_userdata('smsCode', $this->smscode);
     // 引入 safe_md5(),用于校验 cookie 中的md5
     $this->CI->load->helper('string');
     $_COOKIE['phone_send'] = safe_md5($data_success_with_invite['phone']);
     // init
     $this->CI->ajax->warnings = array();
     $this->CI->ajax->errors = array();
     $this->CI->ajax->successes = array();
     // ob 忽略输出
     // ob_start();
     $this->CI->do_reg();
     ob_end_clean();
     $status = $this->CI->ajax->status_code;
     $mes = '';
     $this->assertEquals(200, $status);
 }
开发者ID:TheOne1006,项目名称:phpunit_for_ci_2.1.x,代码行数:28,代码来源:ajaxRegAfterTest.php


示例3: __construct

 /**
  * setUp function.
  *
  * @access public
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     // Set the tested controller
     $this->_ci =& set_controller('welcome');
     $this->_ci->router->class = 'welcome';
 }
开发者ID:NaszvadiG,项目名称:Base-CodeIgniter-App,代码行数:13,代码来源:welcome_Test.php


示例4: setUp

 public function setUp()
 {
     parent::setUp();
     $this->CI = set_controller('ums');
     $this->dbfixt('razor_channel_product');
     $this->dbfixt('razor_event_defination');
 }
开发者ID:way-2-go,项目名称:razor,代码行数:7,代码来源:postusinglogTest.php


示例5: setUp

 /**
  * Setup PHPUnit & load any required dependencies
  * @covers Ajax::__construct
  */
 public function setUp()
 {
     // Set the tested controller
     $this->CI = set_controller('ajax');
     parent::tearDown();
     parent::setUp();
     $this->CI->load->model('narrative_model');
 }
开发者ID:Kaoticshadow,项目名称:SOEN390_ATeam,代码行数:12,代码来源:Ajax_Test.php


示例6: testImg

 public function testImg()
 {
     $this->CI = set_controller('index');
     $authcode = '1234';
     $this->CI->session->set_userdata('auth_code', $authcode);
     $result = $this->_lib_authcode->check($authcode);
     $this->assertEquals($result, TRUE);
 }
开发者ID:TheOne1006,项目名称:phpunit_for_ci_2.1.x,代码行数:8,代码来源:Lib_authcode_Test.php


示例7: index

 public function index()
 {
     $this->CI = set_controller('unit_testing');
     $this->CI->usertesting();
     // Fetch the buffered output
     $out = output();
     // Check if the content is OK
     $this->assertSame(0, preg_match('/(error|notice)/i', $out));
     //        echo $this->unit->report();
 }
开发者ID:TheHexa1,项目名称:AMS,代码行数:10,代码来源:citest.php


示例8: testIndex

 public function testIndex()
 {
     // igone error
     ob_start();
     $this->CI = set_controller('index');
     ob_end_clean();
     // Call the controllers method
     $result = $this->CI->test();
     // $this->_controller->test();
     //
     // var_dump($result);
     // // Check if the content is OK
     $this->assertEquals('1', '1');
 }
开发者ID:TheOne1006,项目名称:phpunit_for_ci_2.1.x,代码行数:14,代码来源:indexTest.php


示例9: testIsLoginAndDoReg

 public function testIsLoginAndDoReg()
 {
     $_COOKIE['uid'] = '1';
     $_COOKIE['keep_code'] = '123123';
     // igone error
     ob_start();
     $this->CI = set_controller('ajax/register');
     ob_end_clean();
     // $this->CI->do_reg();
     $this->CI->lang->load('regANDlogin', 'chinese');
     // 断言
     $this->assertEquals($this->CI->ajax->errors['register_errors'], $this->CI->lang->line('reg_user_status_is_login'));
     $this->assertEquals(400, $this->CI->ajax->status_code);
 }
开发者ID:TheOne1006,项目名称:phpunit_for_ci_2.1.x,代码行数:14,代码来源:ajaxRegIsLoginTest.php


示例10: test_CI_Unit_Test_Class

 public function test_CI_Unit_Test_Class()
 {
     $test_path = APPPATH . 'controllers';
     $test_folder = 'tests';
     $has_failed = FALSE;
     foreach (glob("{$test_path}/{$test_folder}/*.php") as $filename) {
         $filename = basename($filename, '.php');
         $this->CI = set_controller("{$test_folder}/{$filename}");
         echo "\nCI Unit Testing Class: {$test_folder}/{$filename}\n";
         if ($this->_run_ci_unit_test() === FALSE) {
             $has_failed = TRUE;
         }
     }
     if ($has_failed) {
         $this->fail();
     }
 }
开发者ID:shuzilin,项目名称:CIUnit,代码行数:17,代码来源:CI_Unit_Test_class_Test.php


示例11: testRegWithOutLogin

 /**
  * @dataProvider regFormProvider
  */
 public function testRegWithOutLogin($input_data, $expect_status, $mes_key, $expect_message)
 {
     // ob 忽略输出
     // ob_start();
     $this->CI = set_controller('ajax/register');
     // ob_end_clean();
     $this->CI->session->set_userdata('LOGINuser_id', '');
     //全局变量 侵入
     foreach ($input_data as $key => $value) {
         $_GET[$key] = $value;
     }
     // 图片验证码 1234
     $this->CI->session->set_userdata('auth_code', $this->authcode);
     // 短信验证码 123456
     $this->CI->session->set_userdata('smsCode', $this->smscode);
     // 引入 safe_md5(),用于校验 cookie 中的md5
     $this->CI->load->helper('string');
     $_COOKIE['phone_send'] = safe_md5($input_data['phone']);
     // init
     $this->CI->ajax->warnings = array();
     $this->CI->ajax->errors = array();
     $this->CI->ajax->successes = array();
     // ob 忽略输出
     // ob_start();
     $this->CI->do_reg();
     // ob_end_clean();
     $status = $this->CI->ajax->status_code;
     $mes = '';
     if (count($this->CI->ajax->errors) != 0) {
         $mes = $this->CI->ajax->errors[$mes_key];
     }
     if (count($this->CI->ajax->successes) != 0) {
         $mes = $this->CI->ajax->successes[$mes_key];
     }
     // 断言
     $this->assertEquals($expect_status, $status);
     $this->assertEquals($expect_message, $mes);
 }
开发者ID:TheOne1006,项目名称:phpunit_for_ci_2.1.x,代码行数:41,代码来源:ajaxRegisterTest.php


示例12: __construct

 function __construct()
 {
     $this->CI =& set_controller('MY_Controller');
     $this->CI->load->library('Spyc');
 }
开发者ID:mefisto2009,项目名称:GameAP,代码行数:5,代码来源:generate.php


示例13: setUp

 function setUp()
 {
     $this->CI = set_controller('welcome');
 }
开发者ID:ibnoe,项目名称:kosimpin,代码行数:4,代码来源:testWelcome.php


示例14: setUp

 protected function setUp()
 {
     $this->CI =& set_controller();
     $this->CI->load->library('Spyc');
 }
开发者ID:hharrysidhu,项目名称:OpenVBX,代码行数:5,代码来源:testSpyc.php


示例15: define

}
// The path to CIUnit
if (is_dir($ciunit_folder)) {
    define('CIUPATH', $ciunit_folder . '/');
} else {
    if (!is_dir(APPPATH . 'third_party/' . $ciunit_folder)) {
        exit("Your CIUnit folder path does not appear to be set correctly. Please open the following file and correct this: " . SELF);
    }
    define('CIUPATH', APPPATH . 'third_party/' . $ciunit_folder);
}
// The path to the Tests folder
define('TESTSPATH', realpath($tests_folder) . '/');
/*
 * --------------------------------------------------------------------
 * LOAD THE BOOTSTRAP FILE
 * --------------------------------------------------------------------
 *
 * And away we go...
 *
 */
// Load the CIUnit CodeIgniter Core
require_once CIUPATH . 'core/CodeIgniter.php';
// Load the CIUnit Framework
require_once CIUPATH . 'libraries/CIUnit.php';
//=== and off we go ===
$CI =& set_controller('CIU_Controller', CIUPATH . 'core/');
$CI->load->add_package_path(CIUPATH);
CIUnit::$spyc = new Spyc();
require_once CIUPATH . 'libraries/Fixture.php';
$CI->fixture = new Fixture();
CIUnit::$fixture =& $CI->fixture;
开发者ID:celc,项目名称:ciunit,代码行数:31,代码来源:bootstrap_phpunit.php


示例16: setUp

 public function setUp()
 {
     parent::setUp();
     $this->CI = set_controller('twiml');
 }
开发者ID:hharrysidhu,项目名称:OpenVBX,代码行数:5,代码来源:OpenVBX_Applet.php


示例17: setUp

 public function setUp()
 {
     // Set the tested controller
     $this->CI = set_controller('admin/dashboard');
 }
开发者ID:iHamburg,项目名称:kqserver,代码行数:5,代码来源:dashboardTest.php


示例18: output

function &get_controller()
{
    return CIUnit::get_controller();
}
/**
* retrieves the cached output from the output class
* and resets it
*/
function output()
{
    return CIUnit::$controller->output->pop_output();
}
/**
* retrieves the cached template vars from the loader class (stored here for assignment to views)
* and resets them
*/
function viewvars()
{
    if (isset(CIUnit::$controller->load->_ci_cached_vars)) {
        $out = CIUnit::$controller->load->_ci_cached_vars;
        CIUnit::$controller->load->_ci_cached_vars = array();
        return $out;
    }
    return array();
}
//=== and off we go ===
$CI =& set_controller();
// $CI->load->library('fooStack/Spyc');
// CIUnit::$spyc = &$CI->spyc;
$CI->load->library('fooStack/Fixture');
CIUnit::$fixture =& $CI->fixture;
开发者ID:AgusJogja,项目名称:perpustakaanku,代码行数:31,代码来源:CIUnit.php


示例19: __construct

 function __construct()
 {
     $this->CI =& set_controller('CI_Controller');
     $this->CI->load->database();
 }
开发者ID:BellyWong,项目名称:razor,代码行数:5,代码来源:generate.php


示例20: testDifferentControllers

 function testDifferentControllers()
 {
     $default_controller =& set_controller('Controller_fixt', TESTSPATH . 'fixtures/');
     $second_controller =& set_controller('Controller_fixt2', TESTSPATH . 'fixtures/');
     $default_controller =& set_controller('Controller_fixt', TESTSPATH . 'fixtures/');
     $this->assertEquals('Controller_fixt', get_class($default_controller));
     $this->assertEquals('Controller_fixt2', get_class($second_controller));
 }
开发者ID:AgusJogja,项目名称:perpustakaanku,代码行数:8,代码来源:testCIUnit.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP set_cookie函数代码示例发布时间:2022-05-15
下一篇:
PHP set_context函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap