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


PHP Stub::exactly方法代码示例

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


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

示例1: testMe

 public function testMe()
 {
     /** @var CacheItemPoolInterface $pool */
     $pool = Stub::makeEmpty(CacheItemPoolInterface::class, ['getItem' => Stub::atLeastOnce(function () {
         return Stub::makeEmpty(CacheItemInterface::class, ['isHit' => Stub::once(function () {
             return false;
         }), 'set' => Stub::once(function () {
         }), 'get' => Stub::once(function () {
         })]);
     }), 'save' => Stub::exactly(2, function () {
     })]);
     $router = new \axisy\router\ContainerCacheable($pool, ['foo' => function () {
     }, 'bar' => function () {
     }]);
     try {
         $router->route('foo');
     } catch (ErrorException $e) {
     }
 }
开发者ID:axisy,项目名称:router,代码行数:19,代码来源:CacheTest.php

示例2: matcherProvider

 public static function matcherProvider()
 {
     return array(array(0, Stub::never()), array(1, Stub::once()), array(2, Stub::atLeastOnce()), array(3, Stub::exactly(3)), array(1, Stub::once(function () {
         return true;
     }), true), array(2, Stub::atLeastOnce(function () {
         return array();
     }), array()), array(1, Stub::exactly(1, function () {
         return null;
     }), null), array(1, Stub::exactly(1, function () {
         return 'hello world!';
     }), 'hello world!'));
 }
开发者ID:hitechdk,项目名称:Codeception,代码行数:12,代码来源:StubTest.php

示例3: testWebDriverWaits

 public function testWebDriverWaits()
 {
     $fakeWd = Stub::make(self::WEBDRIVER_CLASS, ['wait' => Stub::exactly(12, function () {
         return new \Codeception\Util\Maybe();
     })]);
     $module = Stub::make(self::MODULE_CLASS, ['webDriver' => $fakeWd]);
     $module->waitForElement(WebDriverBy::partialLinkText('yeah'));
     $module->waitForElement(['id' => 'user']);
     $module->waitForElement(['css' => '.user']);
     $module->waitForElement('//xpath');
     $module->waitForElementVisible(WebDriverBy::partialLinkText('yeah'));
     $module->waitForElementVisible(['id' => 'user']);
     $module->waitForElementVisible(['css' => '.user']);
     $module->waitForElementVisible('//xpath');
     $module->waitForElementNotVisible(WebDriverBy::partialLinkText('yeah'));
     $module->waitForElementNotVisible(['id' => 'user']);
     $module->waitForElementNotVisible(['css' => '.user']);
     $module->waitForElementNotVisible('//xpath');
 }
开发者ID:surjit,项目名称:Codeception,代码行数:19,代码来源:WebDriverTest.php

示例4: testWebDriverWaits

 public function testWebDriverWaits()
 {
     $fakeWd = Stub::make('\\Codeception\\Module\\WebDriver', ['wait' => Stub::exactly(12, function () {
         return new \Codeception\Util\Maybe();
     })]);
     $this->module->webDriver = $fakeWd;
     $this->module->waitForElement(WebDriverBy::partialLinkText('yeah'));
     $this->module->waitForElement(['id' => 'user']);
     $this->module->waitForElement(['css' => '.user']);
     $this->module->waitForElement('//xpath');
     $this->module->waitForElementVisible(WebDriverBy::partialLinkText('yeah'));
     $this->module->waitForElementVisible(['id' => 'user']);
     $this->module->waitForElementVisible(['css' => '.user']);
     $this->module->waitForElementVisible('//xpath');
     $this->module->waitForElementNotVisible(WebDriverBy::partialLinkText('yeah'));
     $this->module->waitForElementNotVisible(['id' => 'user']);
     $this->module->waitForElementNotVisible(['css' => '.user']);
     $this->module->waitForElementNotVisible('//xpath');
 }
开发者ID:augustus-amalejo,项目名称:palittayo,代码行数:19,代码来源:WebDriverTest.php


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