本文整理匯總了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) {
}
}
示例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!'));
}
示例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');
}
示例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');
}