本文整理汇总了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');
}