diff --git a/src/components/tests/GxActiveFixture.php b/src/components/tests/GxActiveFixture.php new file mode 100644 index 0000000..b9f19b2 --- /dev/null +++ b/src/components/tests/GxActiveFixture.php @@ -0,0 +1,85 @@ + + */ + +namespace dlds\giixer\components\tests; + +/** + * ActiveFixture represents a fixture backed up by a [[modelClass|ActiveRecord class]] or a [[tableName|database table]]. + * + */ +class GxActiveFixture extends \yii\test\ActiveFixture +{ + + /** + * @var boolean indicates if table will be reseted + */ + public $reset = true; + + /** + * @var boolean indicates if foreign keys will be checked + */ + public $resetIntegrity = true; + + /** + /** + * Loads the fixture. + * + * The default implementation will first clean up the table by calling [[resetTable()]]. + * It will then populate the table with the data returned by [[getData()]]. + * + * If you override this method, you should consider calling the parent implementation + * so that the data returned by [[getData()]] can be populated into the table. + */ + public function load() + { + if ($this->reset) { + $this->resetTable(); + } + + $this->data = []; + $table = $this->getTableSchema(); + foreach ($this->getData() as $alias => $row) { + $primaryKeys = $this->db->schema->insert($table->fullName, $row); + $this->data[$alias] = array_merge($row, $primaryKeys); + } + } + + /** + * Removes all existing data from the specified table and resets sequence number to 1 (if any). + * This method is called before populating fixture data into the table associated with this fixture. + */ + protected function resetTable() + { + $table = $this->getTableSchema(); + + if (!$this->resetIntegrity) { + $this->truncateTable($table); + } else { + $this->db->createCommand()->delete($table->fullName)->execute(); + if ($table->sequenceName !== null) { + $this->db->createCommand()->resetSequence($table->fullName, 1)->execute(); + } + } + } + + /** + * Truncates table + * --- + * Ignores db foreign keys + * --- + * @param array $fixtures + */ + protected function truncateTable(\yii\db\TableSchema $table) + { + $this->db->createCommand()->checkIntegrity(false)->execute(); + $this->db->createCommand()->truncateTable($table->fullName)->execute(); + $this->db->createCommand()->checkIntegrity(true)->execute(); + } + +} diff --git a/src/components/tests/GxUnitTesterActions.php b/src/components/tests/GxUnitTesterActions.php new file mode 100644 index 0000000..ec26dc7 --- /dev/null +++ b/src/components/tests/GxUnitTesterActions.php @@ -0,0 +1,3268 @@ +getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that two variables are not equal + * + * @param $expected + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertNotEquals() + */ + public function assertNotEquals($expected, $actual, $message = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that two variables are same + * + * @param $expected + * @param $actual + * @param string $message + * @return mixed|void + * @see \Codeception\Module\Asserts::assertSame() + */ + public function assertSame($expected, $actual, $message = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that two variables are not same + * + * @param $expected + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertNotSame() + */ + public function assertNotSame($expected, $actual, $message = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that actual is greater than expected + * + * @param $expected + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertGreaterThan() + */ + public function assertGreaterThan($expected, $actual, $message = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that actual is greater or equal than expected + * + * @param $expected + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() + */ + public function assertGreaterThanOrEqual($expected, $actual, $message = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that actual is less than expected + * + * @param $expected + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertLessThan() + */ + public function assertLessThan($expected, $actual, $message = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that actual is less or equal than expected + * + * @param $expected + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertLessThanOrEqual() + */ + public function assertLessThanOrEqual($expected, $actual, $message = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that haystack contains needle + * + * @param $needle + * @param $haystack + * @param string $message + * @see \Codeception\Module\Asserts::assertContains() + */ + public function assertContains($needle, $haystack, $message = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that haystack doesn't contain needle. + * + * @param $needle + * @param $haystack + * @param string $message + * @see \Codeception\Module\Asserts::assertNotContains() + */ + public function assertNotContains($needle, $haystack, $message = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that string match with pattern + * + * @param string $pattern + * @param string $string + * @param string $message + * @see \Codeception\Module\Asserts::assertRegExp() + */ + public function assertRegExp($pattern, $string, $message = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that string not match with pattern + * + * @param string $pattern + * @param string $string + * @param string $message + * @see \Codeception\Module\Asserts::assertNotRegExp() + */ + public function assertNotRegExp($pattern, $string, $message = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that variable is empty. + * + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertEmpty() + */ + public function assertEmpty($actual, $message = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that variable is not empty. + * + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertNotEmpty() + */ + public function assertNotEmpty($actual, $message = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that variable is NULL + * + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertNull() + */ + public function assertNull($actual, $message = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that variable is not NULL + * + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertNotNull() + */ + public function assertNotNull($actual, $message = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that condition is positive. + * + * @param $condition + * @param string $message + * @see \Codeception\Module\Asserts::assertTrue() + */ + public function assertTrue($condition, $message = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that condition is negative. + * + * @param $condition + * @param string $message + * @see \Codeception\Module\Asserts::assertFalse() + */ + public function assertFalse($condition, $message = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if file exists + * + * @param string $filename + * @param string $message + * @see \Codeception\Module\Asserts::assertFileExists() + */ + public function assertFileExists($filename, $message = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if file doesn't exist + * + * @param string $filename + * @param string $message + * @see \Codeception\Module\Asserts::assertFileNotExists() + */ + public function assertFileNotExists($filename, $message = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @param $expected + * @param $actual + * @param $description + * @see \Codeception\Module\Asserts::assertGreaterOrEquals() + */ + public function assertGreaterOrEquals($expected, $actual, $description = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @param $expected + * @param $actual + * @param $description + * @see \Codeception\Module\Asserts::assertLessOrEquals() + */ + public function assertLessOrEquals($expected, $actual, $description = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @param $actual + * @param $description + * @see \Codeception\Module\Asserts::assertIsEmpty() + */ + public function assertIsEmpty($actual, $description = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @param $key + * @param $actual + * @param $description + * @see \Codeception\Module\Asserts::assertArrayHasKey() + */ + public function assertArrayHasKey($key, $actual, $description = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @param $key + * @param $actual + * @param $description + * @see \Codeception\Module\Asserts::assertArrayNotHasKey() + */ + public function assertArrayNotHasKey($key, $actual, $description = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @param $class + * @param $actual + * @param $description + * @see \Codeception\Module\Asserts::assertInstanceOf() + */ + public function assertInstanceOf($class, $actual, $description = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @param $class + * @param $actual + * @param $description + * @see \Codeception\Module\Asserts::assertNotInstanceOf() + */ + public function assertNotInstanceOf($class, $actual, $description = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @param $type + * @param $actual + * @param $description + * @see \Codeception\Module\Asserts::assertInternalType() + */ + public function assertInternalType($type, $actual, $description = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Fails the test with message. + * + * @param $message + * @see \Codeception\Module\Asserts::fail() + */ + public function fail($message) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); + } + + /** + * Handles and checks exception called inside callback function. + * Either exception class name or exception instance should be provided. + * + * ```php + * expectException(MyException::class, function() { + * $this->doSomethingBad(); + * }); + * + * $I->expectException(new MyException(), function() { + * $this->doSomethingBad(); + * }); + * ``` + * If you want to check message or exception code, you can pass them with exception instance: + * ```php + * expectException(new MyException("Don't do bad things"), function() { + * $this->doSomethingBad(); + * }); + * ``` + * + * @param $exception string or \Exception + * @param $callback + */ + public function expectException($exception, $callback) + { + $code = null; + $msg = null; + if (is_object($exception)) { + /** @var $exception \Exception * */ + $class = get_class($exception); + $msg = $exception->getMessage(); + $code = $exception->getCode(); + } else { + $class = $exception; + } + try { + $callback(); + } catch (\Exception $e) { + if (!$e instanceof $class) { + $this->fail(sprintf("Exception of class $class expected to be thrown, but %s caught with msg \"%s\"", get_class($e), $e->getMessage())); + } + if (null !== $msg and $e->getMessage() !== $msg) { + $this->fail(sprintf( + "Exception of $class expected to be '$msg', but actual message was '%s'", $e->getMessage() + )); + } + if (null !== $code and $e->getCode() !== $code) { + $this->fail(sprintf( + "Exception of $class expected to have code $code, but actual code was %s", $e->getCode() + )); + } + $this->assertTrue(true); // increment assertion counter + return; + } + $this->fail("Expected exception to be thrown, but nothing was caught"); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Authorizes user on a site without submitting login form. + * Use it for fast pragmatic authorization in functional tests. + * + * ```php + * amLoggedInAs(1); + * + * // User object is passed as parameter + * $admin = \app\models\User::findByUsername('admin'); + * $I->amLoggedInAs($admin); + * ``` + * Requires `user` component to be enabled and configured. + * + * @param $user + * @throws ModuleException + * @see \Codeception\Module\Yii2::amLoggedInAs() + */ + public function amLoggedInAs($user) + { + return $this->getScenario()->runStep(new \Codeception\Step\Condition('amLoggedInAs', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Creates and loads fixtures from a config. + * Signature is the same as for `fixtures()` method of `yii\test\FixtureTrait` + * + * ```php + * haveFixtures(, + * 'posts' => PostsFixture::className(), + * 'user' => [ + * 'class' => UserFixture::className(), + * 'dataFile' => '@tests/_data/models/user.php' + * ], + * ); + * ``` + * + * @param $fixtures + * @part fixtures + * @see \Codeception\Module\Yii2::haveFixtures() + */ + public function haveFixtures($fixtures) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('haveFixtures', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Returns all loaded fixtures. + * Array of fixture instances + * + * @part fixtures + * @return array + * @see \Codeception\Module\Yii2::grabFixtures() + */ + public function grabFixtures() + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabFixtures', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Gets a fixture by name. + * Returns a Fixture instance. If a fixture is an instance of `\yii\test\BaseActiveFixture` a second parameter + * can be used to return a specific model: + * + * ```php + * haveFixtures(['users' => UserFixture::className()]); + * + * $users = $I->grabFixture('users'); + * + * // get first user by key, if a fixture is instance of ActiveFixture + * $user = $I->grabFixture('users', 'user1'); + * ``` + * + * @param $name + * @return mixed + * @throws ModuleException if a fixture is not found + * @part fixtures + * @see \Codeception\Module\Yii2::grabFixture() + */ + public function grabFixture($name, $index = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabFixture', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Inserts record into the database. + * + * ``` php + * haveRecord('app\models\User', array('name' => 'Davert')); + * ?> + * ``` + * + * @param $model + * @param array $attributes + * @return mixed + * @part orm + * @see \Codeception\Module\Yii2::haveRecord() + */ + public function haveRecord($model, $attributes = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('haveRecord', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that record exists in database. + * + * ``` php + * $I->seeRecord('app\models\User', array('name' => 'davert')); + * ``` + * + * @param $model + * @param array $attributes + * @part orm + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\Yii2::seeRecord() + */ + public function canSeeRecord($model, $attributes = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeRecord', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that record exists in database. + * + * ``` php + * $I->seeRecord('app\models\User', array('name' => 'davert')); + * ``` + * + * @param $model + * @param array $attributes + * @part orm + * @see \Codeception\Module\Yii2::seeRecord() + */ + public function seeRecord($model, $attributes = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeRecord', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that record does not exist in database. + * + * ``` php + * $I->dontSeeRecord('app\models\User', array('name' => 'davert')); + * ``` + * + * @param $model + * @param array $attributes + * @part orm + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\Yii2::dontSeeRecord() + */ + public function cantSeeRecord($model, $attributes = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeRecord', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that record does not exist in database. + * + * ``` php + * $I->dontSeeRecord('app\models\User', array('name' => 'davert')); + * ``` + * + * @param $model + * @param array $attributes + * @part orm + * @see \Codeception\Module\Yii2::dontSeeRecord() + */ + public function dontSeeRecord($model, $attributes = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeRecord', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Retrieves record from database + * + * ``` php + * $category = $I->grabRecord('app\models\User', array('name' => 'davert')); + * ``` + * + * @param $model + * @param array $attributes + * @return mixed + * @part orm + * @see \Codeception\Module\Yii2::grabRecord() + */ + public function grabRecord($model, $attributes = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabRecord', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Converting $page to valid Yii 2 URL + * + * Allows input like: + * + * ```php + * amOnPage(['site/view','page'=>'about']); + * $I->amOnPage('index-test.php?site/index'); + * $I->amOnPage('http://localhost/index-test.php?site/index'); + * ``` + * + * @param $page string|array parameter for \yii\web\UrlManager::createUrl() + * @see \Codeception\Module\Yii2::amOnPage() + */ + public function amOnPage($page) + { + return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnPage', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Similar to amOnPage but accepts route as first argument and params as second + * + * ``` + * $I->amOnRoute('site/view', ['page' => 'about']); + * ``` + * + * @see \Codeception\Module\Yii2::amOnRoute() + */ + public function amOnRoute($route, $params = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnRoute', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Gets a component from Yii container. Throws exception if component is not available + * + * ```php + * grabComponent('mailer'); + * ``` + * + * @param $component + * @return mixed + * @throws ModuleException + * @see \Codeception\Module\Yii2::grabComponent() + */ + public function grabComponent($component) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabComponent', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that email is sent. + * + * ```php + * seeEmailIsSent(); + * + * // check that only 3 emails were sent + * $I->seeEmailIsSent(3); + * ``` + * + * @param int $num + * @throws ModuleException + * @part email + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\Yii2::seeEmailIsSent() + */ + public function canSeeEmailIsSent($num = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeEmailIsSent', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that email is sent. + * + * ```php + * seeEmailIsSent(); + * + * // check that only 3 emails were sent + * $I->seeEmailIsSent(3); + * ``` + * + * @param int $num + * @throws ModuleException + * @part email + * @see \Codeception\Module\Yii2::seeEmailIsSent() + */ + public function seeEmailIsSent($num = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeEmailIsSent', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that no email was sent + * + * @part email + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\Yii2::dontSeeEmailIsSent() + */ + public function cantSeeEmailIsSent() + { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeEmailIsSent', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that no email was sent + * + * @part email + * @see \Codeception\Module\Yii2::dontSeeEmailIsSent() + */ + public function dontSeeEmailIsSent() + { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeEmailIsSent', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Returns array of all sent email messages. + * Each message implements `yii\mail\Message` interface. + * Useful to perform additional checks using `Asserts` module: + * + * ```php + * seeEmailIsSent(); + * $messages = $I->grabSentEmails(); + * $I->assertEquals('admin@site,com', $messages[0]->getTo()); + * ``` + * + * @part email + * @return array + * @throws ModuleException + * @see \Codeception\Module\Yii2::grabSentEmails() + */ + public function grabSentEmails() + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabSentEmails', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Returns last sent email: + * + * ```php + * seeEmailIsSent(); + * $message = $I->grabLastSentEmail(); + * $I->assertEquals('admin@site,com', $message->getTo()); + * ``` + * @part email + * @see \Codeception\Module\Yii2::grabLastSentEmail() + */ + public function grabLastSentEmail() + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabLastSentEmail', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Returns a list of regex patterns for recognized domain names + * + * @return array + * @see \Codeception\Module\Yii2::getInternalDomains() + */ + public function getInternalDomains() + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('getInternalDomains', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Authenticates user for HTTP_AUTH + * + * @param $username + * @param $password + * @see \Codeception\Lib\InnerBrowser::amHttpAuthenticated() + */ + public function amHttpAuthenticated($username, $password) + { + return $this->getScenario()->runStep(new \Codeception\Step\Condition('amHttpAuthenticated', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Sets the HTTP header to the passed value - which is used on + * subsequent HTTP requests through PhpBrowser. + * + * Example: + * ```php + * setHeader('X-Requested-With', 'Codeception'); + * $I->amOnPage('test-headers.php'); + * ?> + * ``` + * + * @param string $name the name of the request header + * @param string $value the value to set it to for subsequent + * requests + * @see \Codeception\Lib\InnerBrowser::haveHttpHeader() + */ + public function haveHttpHeader($name, $value) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('haveHttpHeader', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Deletes the header with the passed name. Subsequent requests + * will not have the deleted header in its request. + * + * Example: + * ```php + * haveHttpHeader('X-Requested-With', 'Codeception'); + * $I->amOnPage('test-headers.php'); + * // ... + * $I->deleteHeader('X-Requested-With'); + * $I->amOnPage('some-other-page.php'); + * ?> + * ``` + * + * @param string $name the name of the header to delete. + * @see \Codeception\Lib\InnerBrowser::deleteHeader() + */ + public function deleteHeader($name) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('deleteHeader', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Perform a click on a link or a button, given by a locator. + * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string. + * For buttons, the "value" attribute, "name" attribute, and inner text are searched. + * For links, the link text is searched. + * For images, the "alt" attribute and inner text of any parent links are searched. + * + * The second parameter is a context (CSS or XPath locator) to narrow the search. + * + * Note that if the locator matches a button of type `submit`, the form will be submitted. + * + * ``` php + * click('Logout'); + * // button of form + * $I->click('Submit'); + * // CSS button + * $I->click('#form input[type=submit]'); + * // XPath + * $I->click('//form/*[@type=submit]'); + * // link in context + * $I->click('Logout', '#nav'); + * // using strict locator + * $I->click(['link' => 'Login']); + * ?> + * ``` + * + * @param $link + * @param $context + * @see \Codeception\Lib\InnerBrowser::click() + */ + public function click($link, $context = null) + { + return $this->getScenario()->runStep(new \Codeception\Step\Action('click', func_get_args())); + } + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current page contains the given string (case insensitive). + * + * You can specify a specific HTML element (via CSS or XPath) as the second + * parameter to only search within that element. + * + * ``` php + * see('Logout'); // I can suppose user is logged in + * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page + * $I->see('Sign Up', '//body/h1'); // with XPath + * ``` + * + * Note that the search is done after stripping all HTML tags from the body, + * so `$I->see('strong')` will return true for strings like: + * + * - `
I am Stronger than thou
` + * - `` + * + * But will *not* be true for strings like: + * + * - `Home` + * - `I am Stronger than thou
` + * - `` + * + * But will *not* be true for strings like: + * + * - `Home` + * - `I am Stronger than thou
` + * - `` + * + * But will ignore strings like: + * + * - `Home` + * - `I am Stronger than thou
` + * - `` + * + * But will ignore strings like: + * + * - `Home` + * - `