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


PHP UnitTestCase::pdo方法代码示例

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


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

示例1: testCheckCaptcha

 /**
  * @depends testMakeCaptcha
  */
 public function testCheckCaptcha()
 {
     $capTime = $_SERVER['REQUEST_TIME'];
     $this->assertEquals(self::EXIST_MOBILE, $this->mdu->checkCaptcha('15280255990', 1, '1234', $capTime));
     $this->assertEquals(self::EXIST_MOBILE, $this->mdu->checkCaptcha('15280255990', 11, '1234', $capTime));
     $this->assertEquals(self::NON_EXIST_MOBILE, $this->mdu->checkCaptcha('15280255992', 3, '1234', $capTime));
     $this->assertEquals(self::NON_EXIST_MOBILE, $this->mdu->checkCaptcha('15280255992', 7, '1234', $capTime));
     $this->assertEquals(self::NON_EXIST_MOBILE, $this->mdu->checkCaptcha('15280255992', 9, '1234', $capTime));
     parent::pdo()->exec('UPDATE cloud_mobi_captcha SET `mc_captcha` = "6789", `mc_validtime` = 10 WHERE `mc_mobi` = "15280255991"');
     $this->assertEquals(self::ERROR_CAPTCHA, $this->mdu->checkCaptcha('15280255991', 1, '1234', $capTime));
     $this->assertEquals(self::INVALID_CAPTCHA, $this->mdu->checkCaptcha('15280255991', 1, '6789', $capTime));
     // 当前时间小于验证码添加时间
     $mcAddtime = $capTime + 60;
     parent::pdo()->exec('UPDATE cloud_mobi_captcha SET `mc_validtime` = 0, `mc_addtime` = ' . $mcAddtime . ' WHERE `mc_mobi` = "15280255991"');
     $this->assertEquals(self::INVALID_CAPTCHA, $this->mdu->checkCaptcha('15280255991', 1, '6789', $capTime));
     // 验证码过期
     $mcAddtime = $capTime - $this->di['sysconfig']['capTime'] - 1000;
     parent::pdo()->exec('UPDATE cloud_mobi_captcha SET `mc_validtime` = 0, `mc_addtime` = ' . $mcAddtime . ' WHERE `mc_mobi` = "15280255991"');
     $this->assertEquals(self::INVALID_CAPTCHA, $this->mdu->checkCaptcha('15280255991', 1, '6789', $capTime));
     // 验证码有效
     $mcAddtime = $capTime - $this->di['sysconfig']['capTime'] + 1000;
     parent::pdo()->exec('UPDATE cloud_mobi_captcha SET `mc_validtime` = 0, `mc_addtime` = ' . $mcAddtime . ' WHERE `mc_mobi` = "15280255991"');
     $this->assertEquals(self::SUCCESS, $this->mdu->checkCaptcha('15280255991', 1, '6789', $capTime));
 }
开发者ID:nicklos17,项目名称:appserver,代码行数:27,代码来源:CaptchaModuleTest.php


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