當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。