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) { } }
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!')); }
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'); }
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'); }