From 01531e1c61374d2f37b1853f6e6f8eb85d66c644 Mon Sep 17 00:00:00 2001 From: Gintautas Miselis Date: Sun, 21 Aug 2022 14:54:53 +0300 Subject: [PATCH] Document parameters and return types --- composer.json | 11 +- docs/modules/AMQP.md | 92 ++- docs/modules/Apc.md | 29 +- docs/modules/Asserts.md | 922 ++++++++++++++++-------- docs/modules/Cli.md | 35 +- docs/modules/DataFactory.md | 26 +- docs/modules/Db.md | 88 ++- docs/modules/Doctrine2.md | 119 ++-- docs/modules/FTP.md | 150 +++- docs/modules/Filesystem.md | 83 ++- docs/modules/Laminas.md | 518 ++++++++++---- docs/modules/Laravel.md | 853 +++++++++++++++------- docs/modules/Lumen.md | 641 ++++++++++++----- docs/modules/Memcache.md | 28 +- docs/modules/Mezzio.md | 476 +++++++++---- docs/modules/MongoDb.md | 80 ++- docs/modules/PhpBrowser.md | 501 +++++++++---- docs/modules/Queue.md | 102 +-- docs/modules/REST.md | 619 +++++++++------- docs/modules/Redis.md | 82 ++- docs/modules/SOAP.md | 97 ++- docs/modules/Symfony.md | 917 ++++++++++++++++-------- docs/modules/WebDriver.md | 812 ++++++++++++++------- docs/modules/Yii2.md | 629 ++++++++++++----- docs/reference/Autoload.md | 20 +- docs/reference/Commands.md | 220 +++--- docs/reference/Fixtures.md | 24 +- docs/reference/HttpCode.md | 6 +- docs/reference/InitTemplate.md | 172 ++++- docs/reference/JsonType.md | 28 +- docs/reference/Locator.md | 114 ++- docs/reference/Mock.md | 116 +-- docs/reference/Module.md | 1205 +++++++++++++++++++++++--------- docs/reference/Stub.md | 140 ++-- docs/reference/XmlBuilder.md | 46 +- 35 files changed, 7042 insertions(+), 2959 deletions(-) diff --git a/composer.json b/composer.json index a46d85ff3..b7b0a4284 100644 --- a/composer.json +++ b/composer.json @@ -32,12 +32,17 @@ "codeception/module-yii2": "*", "codeception/util-robohelpers": "dev-master", "knplabs/github-api": "^3.0", - "guzzlehttp/guzzle": "^7.0.1", - "http-interop/http-factory-guzzle": "^1.0" + "guzzlehttp/guzzle": "^7.0.1" }, "require-dev": { - "consolidation/robo": "3.x-dev" + "consolidation/robo": "dev-document-method-parameters" }, + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/Naktibalda/robo.git" + } + ], "config": { "platform": { "ext-phalcon": "4.1.1" diff --git a/docs/modules/AMQP.md b/docs/modules/AMQP.md index 78ff97370..8528a4ffb 100644 --- a/docs/modules/AMQP.md +++ b/docs/modules/AMQP.md @@ -69,7 +69,15 @@ To use this module with Composer you need "php-amqplib/php-amqplib": "~2.4"< ### Actions #### bindQueueToExchange - + +* `param string` $queue +* `param string` $exchange +* `param string` $routing_key +* `param bool` $nowait +* `param ?array` $arguments +* `param ?int` $ticket +* `return mixed` + Binds a queue to an exchange This is an alias of method `queue_bind` of `PhpAmqpLib\Channel\AMQPChannel`. @@ -86,9 +94,19 @@ $I->bindQueueToExchange( {% endhighlight %} - #### declareExchange - + +* `param string` $exchange +* `param string` $type +* `param bool` $passive +* `param bool` $durable +* `param bool` $auto_delete +* `param bool` $internal +* `param bool` $nowait +* `param ?array` $arguments +* `param ?int` $ticket +* `return mixed` + Declares an exchange This is an alias of method `exchange_declare` of `PhpAmqpLib\Channel\AMQPChannel`. @@ -104,9 +122,18 @@ $I->declareExchange( {% endhighlight %} - #### declareQueue - + +* `param string` $queue +* `param bool` $passive +* `param bool` $durable +* `param bool` $exclusive +* `param bool` $auto_delete +* `param bool` $nowait +* `param ?array` $arguments +* `param ?int` $ticket +* `return mixed` + Declares queue, creates if needed This is an alias of method `queue_declare` of `PhpAmqpLib\Channel\AMQPChannel`. @@ -121,9 +148,11 @@ $I->declareQueue( {% endhighlight %} - #### dontSeeQueueIsEmpty - + +* `param string` $queue +* `return void` + Checks if queue is not empty. {% highlight php %} @@ -136,7 +165,10 @@ $I->dontSeeQueueIsEmpty('queue.emails'); #### grabMessageFromQueue - + +* `param string` $queue +* `return ?\PhpAmqpLib\Message\AMQPMessage` + Takes last message from queue. {% highlight php %} @@ -148,7 +180,9 @@ $message = $I->grabMessageFromQueue('queue.emails'); #### purgeAllQueues - + +* `return void` + Purge all queues defined in config. {% highlight php %} @@ -160,7 +194,10 @@ $I->purgeAllQueues(); #### purgeQueue - + +* `param string` $queueName +* `return void` + Purge a specific queue defined in config. {% highlight php %} @@ -172,7 +209,12 @@ $I->purgeQueue('queue.emails'); #### pushToExchange - + +* `param string` $exchange +* `param \PhpAmqpLib\Message\AMQPMessage|string` $message +* `param ?string` $routing_key +* `return void` + Sends message to exchange by sending exchange name, message and (optionally) a routing key @@ -187,7 +229,11 @@ $I->pushToExchange('exchange.emails', new AMQPMessage('Thanks!'), 'severity'); #### pushToQueue - + +* `param string` $queue +* `param \PhpAmqpLib\Message\AMQPMessage|string` $message +* `return void` + Sends message to queue {% highlight php %} @@ -200,12 +246,19 @@ $I->pushToQueue('queue.jobs', new AMQPMessage('create')); #### scheduleQueueCleanup - + +* `param string` $queue +* `return void` + Add a queue to purge list #### seeMessageInQueueContainsText - + +* `param string` $queue +* `param string` $text +* `return void` + Checks if message containing text received. **This method drops message from queue** @@ -221,7 +274,11 @@ $I->seeMessageInQueueContainsText('queue.emails','davert'); #### seeNumberOfMessagesInQueue - + +* `param string` $queue +* `param int` $expected +* `return void` + Checks that queue have expected number of message {% highlight php %} @@ -234,7 +291,10 @@ $I->seeNumberOfMessagesInQueue('queue.emails',1); #### seeQueueIsEmpty - + +* `param string` $queue +* `return void` + Checks that queue is empty {% highlight php %} diff --git a/docs/modules/Apc.md b/docs/modules/Apc.md index 4fcd19d21..5ab0da129 100644 --- a/docs/modules/Apc.md +++ b/docs/modules/Apc.md @@ -58,7 +58,11 @@ Be sure you don't use the production server to connect. ### Actions #### dontSeeInApc - + +* `param string` $key +* `param mixed` $value +* `return void` + Checks item in APCu doesn't exist or is the same as expected. Examples: @@ -76,12 +80,17 @@ $I->dontSeeInApc('users_count', 200); #### flushApc - + +* `return void` + Clears the APCu cache #### grabValueFromApc - + +* `param string` $key +* `return mixed` + Grabs value from APCu by key. Example: @@ -95,7 +104,12 @@ $users_count = $I->grabValueFromApc('users_count'); #### haveInApc - + +* `param string` $key +* `param mixed` $value +* `param int` $expiration +* `return string` + Stores an item `$value` with `$key` on the APCu. Examples: @@ -121,7 +135,11 @@ $I->haveInApc($entries, null); #### seeInApc - + +* `param string` $key +* `param mixed` $value +* `return void` + Checks item in APCu exists and the same as expected. Examples: @@ -137,5 +155,4 @@ $I->seeInApc('users_count', 200); {% endhighlight %} -

 

Module reference is taken from the source code. Help us to improve documentation. Edit module reference
diff --git a/docs/modules/Asserts.md b/docs/modules/Asserts.md index 05a9a3212..a7e15e013 100644 --- a/docs/modules/Asserts.md +++ b/docs/modules/Asserts.md @@ -37,826 +37,1148 @@ Special module for using asserts in your tests. ### Actions #### assertArrayHasKey - -Asserts that an array has a specified key. - * `param int|string` $key - * `param array|ArrayAccess` $array +* `param int|string` $key +* `param array|ArrayAccess` $array +* `param string` $message + +Asserts that an array has a specified key. #### assertArrayNotHasKey - -Asserts that an array does not have a specified key. - * `param int|string` $key - * `param array|ArrayAccess` $array +* `param int|string` $key +* `param array|ArrayAccess` $array +* `param string` $message + +Asserts that an array does not have a specified key. #### assertClassHasAttribute - + +* `param string` $attributeName +* `param string` $className +* `param string` $message + Asserts that a class has a specified attribute. #### assertClassHasStaticAttribute - + +* `param string` $attributeName +* `param string` $className +* `param string` $message + Asserts that a class has a specified static attribute. #### assertClassNotHasAttribute - + +* `param string` $attributeName +* `param string` $className +* `param string` $message + Asserts that a class does not have a specified attribute. #### assertClassNotHasStaticAttribute - + +* `param string` $attributeName +* `param string` $className +* `param string` $message + Asserts that a class does not have a specified static attribute. #### assertContains - -Asserts that a haystack contains a needle. - * `param mixed` $needle +* `param mixed` $needle +* `param iterable` $haystack +* `param string` $message + +Asserts that a haystack contains a needle. #### assertContainsEquals - - * `param mixed` $needle + +* `param mixed` $needle +* `param iterable` $haystack +* `param string` $message #### assertContainsOnly - + +* `param string` $type +* `param iterable` $haystack +* `param ?bool` $isNativeType +* `param string` $message + Asserts that a haystack contains only values of a given type. #### assertContainsOnlyInstancesOf - + +* `param string` $className +* `param iterable` $haystack +* `param string` $message + Asserts that a haystack contains only instances of a given class name. #### assertCount - -Asserts the number of elements of an array, Countable or Traversable. - * `param Countable|iterable` $haystack +* `param Countable|iterable` $haystack +* `param int` $expectedCount +* `param string` $message + +Asserts the number of elements of an array, Countable or Traversable. #### assertDirectoryDoesNotExist - + +* `param string` $directory +* `param string` $message + Asserts that a directory does not exist. #### assertDirectoryExists - + +* `param string` $directory +* `param string` $message + Asserts that a directory exists. #### assertDirectoryIsNotReadable - + +* `param string` $directory +* `param string` $message + Asserts that a directory exists and is not readable. #### assertDirectoryIsNotWritable - + +* `param string` $directory +* `param string` $message + Asserts that a directory exists and is not writable. #### assertDirectoryIsReadable - + +* `param string` $directory +* `param string` $message + Asserts that a directory exists and is readable. #### assertDirectoryIsWritable - + +* `param string` $directory +* `param string` $message + Asserts that a directory exists and is writable. #### assertDoesNotMatchRegularExpression - + +* `param string` $pattern +* `param string` $string +* `param string` $message + Asserts that a string does not match a given regular expression. #### assertEmpty - -Asserts that a variable is empty. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is empty. #### assertEquals - -Asserts that two variables are equal. - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that two variables are equal. #### assertEqualsCanonicalizing - -Asserts that two variables are equal (canonicalizing). - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that two variables are equal (canonicalizing). #### assertEqualsIgnoringCase - -Asserts that two variables are equal (ignoring case). - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that two variables are equal (ignoring case). #### assertEqualsWithDelta - -Asserts that two variables are equal (with delta). - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param float` $delta +* `param string` $message + +Asserts that two variables are equal (with delta). #### assertFalse - -Asserts that a condition is false. - * `param mixed` $condition +* `param mixed` $condition +* `param string` $message + +Asserts that a condition is false. #### assertFileDoesNotExist - + +* `param string` $filename +* `param string` $message + Asserts that a file does not exist. #### assertFileEquals - + +* `param string` $expected +* `param string` $actual +* `param string` $message + Asserts that the contents of one file is equal to the contents of another file. #### assertFileEqualsCanonicalizing - + +* `param string` $expected +* `param string` $actual +* `param string` $message + Asserts that the contents of one file is equal to the contents of another file (canonicalizing). #### assertFileEqualsIgnoringCase - + +* `param string` $expected +* `param string` $actual +* `param string` $message + Asserts that the contents of one file is equal to the contents of another file (ignoring case). #### assertFileExists - + +* `param string` $filename +* `param string` $message + Asserts that a file exists. #### assertFileIsNotReadable - + +* `param string` $file +* `param string` $message + Asserts that a file exists and is not readable. #### assertFileIsNotWritable - + +* `param string` $file +* `param string` $message + Asserts that a file exists and is not writable. #### assertFileIsReadable - + +* `param string` $file +* `param string` $message + Asserts that a file exists and is readable. #### assertFileIsWritable - + +* `param string` $file +* `param string` $message + Asserts that a file exists and is writable. #### assertFileNotEquals - + +* `param string` $expected +* `param string` $actual +* `param string` $message + Asserts that the contents of one file is not equal to the contents of another file. #### assertFileNotEqualsCanonicalizing - + +* `param string` $expected +* `param string` $actual +* `param string` $message + Asserts that the contents of one file is not equal to the contents of another file (canonicalizing). #### assertFileNotEqualsIgnoringCase - + +* `param string` $expected +* `param string` $actual +* `param string` $message + Asserts that the contents of one file is not equal to the contents of another file (ignoring case). #### assertFileNotExists - + +* `param string` $filename +* `param string` $message + Asserts that a file does not exist. #### assertFinite - -Asserts that a variable is finite. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is finite. #### assertGreaterOrEquals - -Asserts that a value is greater than or equal to another value. - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that a value is greater than or equal to another value. #### assertGreaterThan - -Asserts that a value is greater than another value. - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that a value is greater than another value. #### assertGreaterThanOrEqual - -Asserts that a value is greater than or equal to another value. - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that a value is greater than or equal to another value. #### assertInfinite - -Asserts that a variable is infinite. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is infinite. #### assertInstanceOf - -Asserts that a variable is of a given type. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $expected +* `param string` $message + +Asserts that a variable is of a given type. #### assertIsArray - -Asserts that a variable is of type array. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is of type array. #### assertIsBool - -Asserts that a variable is of type bool. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is of type bool. #### assertIsCallable - -Asserts that a variable is of type callable. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is of type callable. #### assertIsClosedResource - -Asserts that a variable is of type resource and is closed. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is of type resource and is closed. #### assertIsEmpty - -Asserts that a variable is empty. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is empty. #### assertIsFloat - -Asserts that a variable is of type float. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is of type float. #### assertIsInt - -Asserts that a variable is of type int. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is of type int. #### assertIsIterable - -Asserts that a variable is of type iterable. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is of type iterable. #### assertIsNotArray - -Asserts that a variable is not of type array. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not of type array. #### assertIsNotBool - -Asserts that a variable is not of type bool. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not of type bool. #### assertIsNotCallable - -Asserts that a variable is not of type callable. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not of type callable. #### assertIsNotClosedResource - -Asserts that a variable is not of type resource. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not of type resource. #### assertIsNotFloat - -Asserts that a variable is not of type float. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not of type float. #### assertIsNotInt - -Asserts that a variable is not of type int. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not of type int. #### assertIsNotIterable - -Asserts that a variable is not of type iterable. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not of type iterable. #### assertIsNotNumeric - -Asserts that a variable is not of type numeric. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not of type numeric. #### assertIsNotObject - -Asserts that a variable is not of type object. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not of type object. #### assertIsNotReadable - + +* `param string` $filename +* `param string` $message + Asserts that a file/dir exists and is not readable. #### assertIsNotResource - -Asserts that a variable is not of type resource. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not of type resource. #### assertIsNotScalar - -Asserts that a variable is not of type scalar. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not of type scalar. #### assertIsNotString - -Asserts that a variable is not of type string. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not of type string. #### assertIsNotWritable - + +* `param string` $filename +* `param string` $message + Asserts that a file/dir exists and is not writable. #### assertIsNumeric - -Asserts that a variable is of type numeric. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is of type numeric. #### assertIsObject - -Asserts that a variable is of type object. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is of type object. #### assertIsReadable - + +* `param string` $filename +* `param string` $message + Asserts that a file/dir is readable. #### assertIsResource - -Asserts that a variable is of type resource. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is of type resource. #### assertIsScalar - -Asserts that a variable is of type scalar. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is of type scalar. #### assertIsString - -Asserts that a variable is of type string. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is of type string. #### assertIsWritable - + +* `param string` $filename +* `param string` $message + Asserts that a file/dir exists and is writable. #### assertJson - + +* `param string` $actualJson +* `param string` $message + Asserts that a string is a valid JSON string. #### assertJsonFileEqualsJsonFile - + +* `param string` $expectedFile +* `param string` $actualFile +* `param string` $message + Asserts that two JSON files are equal. #### assertJsonFileNotEqualsJsonFile - + +* `param string` $expectedFile +* `param string` $actualFile +* `param string` $message + Asserts that two JSON files are not equal. #### assertJsonStringEqualsJsonFile - + +* `param string` $expectedFile +* `param string` $actualJson +* `param string` $message + Asserts that the generated JSON encoded object and the content of the given file are equal. #### assertJsonStringEqualsJsonString - + +* `param string` $expectedJson +* `param string` $actualJson +* `param string` $message + Asserts that two given JSON encoded objects or arrays are equal. #### assertJsonStringNotEqualsJsonFile - + +* `param string` $expectedFile +* `param string` $actualJson +* `param string` $message + Asserts that the generated JSON encoded object and the content of the given file are not equal. #### assertJsonStringNotEqualsJsonString - + +* `param string` $expectedJson +* `param string` $actualJson +* `param string` $message + Asserts that two given JSON encoded objects or arrays are not equal. #### assertLessOrEquals - -Asserts that a value is smaller than or equal to another value. - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that a value is smaller than or equal to another value. #### assertLessThan - -Asserts that a value is smaller than another value. - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that a value is smaller than another value. #### assertLessThanOrEqual - -Asserts that a value is smaller than or equal to another value. - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that a value is smaller than or equal to another value. #### assertMatchesRegularExpression - + +* `param string` $pattern +* `param string` $string +* `param string` $message + Asserts that a string matches a given regular expression. #### assertNan - -Asserts that a variable is nan. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is nan. #### assertNotContains - -Asserts that a haystack does not contain a needle. - * `param mixed` $needle +* `param mixed` $needle +* `param iterable` $haystack +* `param string` $message + +Asserts that a haystack does not contain a needle. #### assertNotContainsEquals -__not documented__ + +* `param ` $needle +* `param iterable` $haystack +* `param string` $message #### assertNotContainsOnly - + +* `param string` $type +* `param iterable` $haystack +* `param ?bool` $isNativeType +* `param string` $message + Asserts that a haystack does not contain only values of a given type. #### assertNotCount - -Asserts the number of elements of an array, Countable or Traversable. - * `param Countable|iterable` $haystack +* `param Countable|iterable` $haystack +* `param int` $expectedCount +* `param string` $message + +Asserts the number of elements of an array, Countable or Traversable. #### assertNotEmpty - -Asserts that a variable is not empty. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not empty. #### assertNotEquals - -Asserts that two variables are not equal. - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that two variables are not equal. #### assertNotEqualsCanonicalizing - -Asserts that two variables are not equal (canonicalizing). - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that two variables are not equal (canonicalizing). #### assertNotEqualsIgnoringCase - -Asserts that two variables are not equal (ignoring case). - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that two variables are not equal (ignoring case). #### assertNotEqualsWithDelta - -Asserts that two variables are not equal (with delta). - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param float` $delta +* `param string` $message + +Asserts that two variables are not equal (with delta). #### assertNotFalse - -Asserts that a condition is not false. - * `param mixed` $condition +* `param mixed` $condition +* `param string` $message + +Asserts that a condition is not false. #### assertNotInstanceOf - -Asserts that a variable is not of a given type. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $expected +* `param string` $message + +Asserts that a variable is not of a given type. #### assertNotNull - -Asserts that a variable is not null. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not null. #### assertNotRegExp - + +* `param string` $pattern +* `param string` $string +* `param string` $message + Asserts that a string does not match a given regular expression. #### assertNotSame - -Asserts that two variables do not have the same type and value. - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that two variables do not have the same type and value. #### assertNotSameSize - -Assert that the size of two arrays (or `Countable` or `Traversable` objects) is not the same. - * `param Countable|iterable` $expected - * `param Countable|iterable` $actual +* `param Countable|iterable` $expected +* `param Countable|iterable` $actual +* `param string` $message + +Assert that the size of two arrays (or `Countable` or `Traversable` objects) is not the same. #### assertNotTrue - -Asserts that a condition is not true. - * `param mixed` $condition +* `param mixed` $condition +* `param string` $message + +Asserts that a condition is not true. #### assertNull - -Asserts that a variable is null. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is null. #### assertObjectHasAttribute - + +* `param string` $attributeName +* `param object` $object +* `param string` $message + Asserts that an object has a specified attribute. #### assertObjectNotHasAttribute - + +* `param string` $attributeName +* `param object` $object +* `param string` $message + Asserts that an object does not have a specified attribute. #### assertRegExp - + +* `param string` $pattern +* `param string` $string +* `param string` $message + Asserts that a string matches a given regular expression. #### assertSame - -Asserts that two variables have the same type and value. - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that two variables have the same type and value. #### assertSameSize - -Assert that the size of two arrays (or `Countable` or `Traversable` objects) is the same. - * `param Countable|iterable` $expected - * `param Countable|iterable` $actual +* `param Countable|iterable` $expected +* `param Countable|iterable` $actual +* `param string` $message + +Assert that the size of two arrays (or `Countable` or `Traversable` objects) is the same. #### assertStringContainsString -__not documented__ + +* `param string` $needle +* `param string` $haystack +* `param string` $message #### assertStringContainsStringIgnoringCase -__not documented__ + +* `param string` $needle +* `param string` $haystack +* `param string` $message #### assertStringEndsNotWith - + +* `param string` $suffix +* `param string` $string +* `param string` $message + Asserts that a string ends not with a given suffix. #### assertStringEndsWith - + +* `param string` $suffix +* `param string` $string +* `param string` $message + Asserts that a string ends with a given suffix. #### assertStringEqualsFile - + +* `param string` $expectedFile +* `param string` $actualString +* `param string` $message + Asserts that the contents of a string is equal to the contents of a file. #### assertStringEqualsFileCanonicalizing - + +* `param string` $expectedFile +* `param string` $actualString +* `param string` $message + Asserts that the contents of a string is equal to the contents of a file (canonicalizing). #### assertStringEqualsFileIgnoringCase - + +* `param string` $expectedFile +* `param string` $actualString +* `param string` $message + Asserts that the contents of a string is equal to the contents of a file (ignoring case). #### assertStringMatchesFormat - + +* `param string` $format +* `param string` $string +* `param string` $message + Asserts that a string matches a given format string. #### assertStringMatchesFormatFile - + +* `param string` $formatFile +* `param string` $string +* `param string` $message + Asserts that a string matches a given format file. #### assertStringNotContainsString -__not documented__ + +* `param string` $needle +* `param string` $haystack +* `param string` $message #### assertStringNotContainsStringIgnoringCase -__not documented__ + +* `param string` $needle +* `param string` $haystack +* `param string` $message #### assertStringNotEqualsFile - + +* `param string` $expectedFile +* `param string` $actualString +* `param string` $message + Asserts that the contents of a string is not equal to the contents of a file. #### assertStringNotEqualsFileCanonicalizing - + +* `param string` $expectedFile +* `param string` $actualString +* `param string` $message + Asserts that the contents of a string is not equal to the contents of a file (canonicalizing). #### assertStringNotEqualsFileIgnoringCase - + +* `param string` $expectedFile +* `param string` $actualString +* `param string` $message + Asserts that the contents of a string is not equal to the contents of a file (ignoring case). #### assertStringNotMatchesFormat - + +* `param string` $format +* `param string` $string +* `param string` $message + Asserts that a string does not match a given format string. #### assertStringNotMatchesFormatFile - + +* `param string` $formatFile +* `param string` $string +* `param string` $message + Asserts that a string does not match a given format string. #### assertStringStartsNotWith - + +* `param string` $prefix +* `param string` $string +* `param string` $message + Asserts that a string starts not with a given prefix. #### assertStringStartsWith - + +* `param string` $prefix +* `param string` $string +* `param string` $message + Asserts that a string starts with a given prefix. #### assertThat - -Evaluates a PHPUnit\Framework\Constraint matcher object. - * `param mixed` $value +* `param mixed` $value +* `param \PHPUnit\Framework\Constraint\Constraint` $constraint +* `param string` $message + +Evaluates a PHPUnit\Framework\Constraint matcher object. #### assertThatItsNot - -Evaluates a PHPUnit\Framework\Constraint matcher object. - * `param mixed` $value +* `param mixed` $value +* `param \PHPUnit\Framework\Constraint\Constraint` $constraint +* `param string` $message + +Evaluates a PHPUnit\Framework\Constraint matcher object. #### assertTrue - -Asserts that a condition is true. - * `param mixed` $condition +* `param mixed` $condition +* `param string` $message + +Asserts that a condition is true. #### assertXmlFileEqualsXmlFile - + +* `param string` $expectedFile +* `param string` $actualFile +* `param string` $message + Asserts that two XML files are equal. #### assertXmlFileNotEqualsXmlFile - + +* `param string` $expectedFile +* `param string` $actualFile +* `param string` $message + Asserts that two XML files are not equal. #### assertXmlStringEqualsXmlFile - -Asserts that two XML documents are equal. - * `param DOMDocument|string` $actualXml +* `param DOMDocument|string` $actualXml +* `param string` $expectedFile +* `param string` $message + +Asserts that two XML documents are equal. #### assertXmlStringEqualsXmlString - -Asserts that two XML documents are equal. - * `param DOMDocument|string` $expectedXml - * `param DOMDocument|string` $actualXml +* `param DOMDocument|string` $expectedXml +* `param DOMDocument|string` $actualXml +* `param string` $message + +Asserts that two XML documents are equal. #### assertXmlStringNotEqualsXmlFile - -Asserts that two XML documents are not equal. - * `param DOMDocument|string` $actualXml +* `param DOMDocument|string` $actualXml +* `param string` $expectedFile +* `param string` $message + +Asserts that two XML documents are not equal. #### assertXmlStringNotEqualsXmlString - -Asserts that two XML documents are not equal. - * `param DOMDocument|string` $expectedXml - * `param DOMDocument|string` $actualXml +* `param DOMDocument|string` $expectedXml +* `param DOMDocument|string` $actualXml +* `param string` $message + +Asserts that two XML documents are not equal. #### expectThrowable - + +* `param \Throwable|string` $throwable +* `param callable` $callback +* `return void` + Handles and checks throwables (Exceptions/Errors) called inside the callback function. + Either throwable class name or throwable instance should be provided. {% highlight php %} @@ -882,21 +1204,25 @@ $I->expectThrowable(new MyError("Don't do bad things"), function() { {% endhighlight %} - * `param \Throwable|string` $throwable - #### fail - + +* `param string` $message + Fails a test with the given message. #### markTestIncomplete - + +* `param string` $message + Mark the test as incomplete. #### markTestSkipped - + +* `param string` $message + Mark the test as skipped.

 

Module reference is taken from the source code. Help us to improve documentation. Edit module reference
diff --git a/docs/modules/Cli.md b/docs/modules/Cli.md index 62edf57a1..2f37ee9e2 100644 --- a/docs/modules/Cli.md +++ b/docs/modules/Cli.md @@ -44,18 +44,28 @@ Wrapper for basic shell commands and shell output ### Actions #### dontSeeInShellOutput - + +* `param string` $text +* `return void` + Checks that output from latest command doesn't contain text #### grabShellOutput - + +* `return string` + Returns the output from latest command #### runShellCommand - + +* `param string` $command +* `param bool` $failNonZero +* `return void` + Executes a shell command. + Fails if exit code is > 0. You can disable this by passing `false` as second argument {% highlight php %} @@ -70,12 +80,18 @@ $I->runShellCommand('phpunit', false); #### seeInShellOutput - + +* `param string` $text +* `return void` + Checks that output from last executed command contains text #### seeResultCodeIs - + +* `param int` $code +* `return void` + Checks result code. To verify a result code > 0, you need to pass `false` as second argument to `runShellCommand()` {% highlight php %} @@ -87,7 +103,10 @@ $I->seeResultCodeIs(0); #### seeResultCodeIsNot - + +* `param int` $code +* `return void` + Checks result code {% highlight php %} @@ -99,6 +118,8 @@ $I->seeResultCodeIsNot(0); #### seeShellOutputMatches -__not documented__ + +* `param string` $regex +* `return void`

 

Module reference is taken from the source code. Help us to improve documentation. Edit module reference
diff --git a/docs/modules/DataFactory.md b/docs/modules/DataFactory.md index e8c6bcad9..7634b8683 100644 --- a/docs/modules/DataFactory.md +++ b/docs/modules/DataFactory.md @@ -192,7 +192,11 @@ class CustomStore implements StoreInterface ### Actions #### have - + +* `param string` $name +* `param array` $extraAttrs +* `return object` + Generates and saves a record,. {% highlight php %} @@ -206,7 +210,12 @@ Returns an instance of created user. #### haveMultiple - + +* `param string` $name +* `param int` $times +* `param array` $extraAttrs +* `return object[]` + Generates and saves a record multiple times. {% highlight php %} @@ -216,11 +225,13 @@ $I->haveMultiple('User', 10, ['is_active' => true]); // create 10 active users {% endhighlight %} - * `return object[]` - #### make - + +* `param string` $name +* `param array` $extraAttrs +* `return object` + Generates a record instance. This does not save it in the database. Use `have` for that. @@ -236,7 +247,8 @@ Returns an instance of created user without creating a record in database. #### onReconfigure - -@throws ModuleException + +* `param ` $settings +* `throws ModuleException`

 

Module reference is taken from the source code. Help us to improve documentation. Edit module reference
diff --git a/docs/modules/Db.md b/docs/modules/Db.md index 93715fc15..52d3e7000 100644 --- a/docs/modules/Db.md +++ b/docs/modules/Db.md @@ -283,7 +283,11 @@ SELECT COUNT(*) FROM `users` WHERE `name` IS NULL AND `email` IS NOT NULL ### Actions #### amConnectedToDatabase - + +* `param string` $databaseKey +* `throws ModuleConfigException` +* `return void` + Make sure you are connected to the right database. {% highlight php %} @@ -296,11 +300,13 @@ $I->seeNumRecords(30, 'books'); //executed on db_books database {% endhighlight %} -@throws ModuleConfigException - #### dontSeeInDatabase - + +* `param string` $table +* `param array` $criteria +* `return void` + Effect is opposite to ->seeInDatabase Asserts that there is no record with the given column values in a database. @@ -328,8 +334,14 @@ Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`. #### grabColumnFromDatabase - + +* `param string` $table +* `param string` $column +* `param array` $criteria +* `return array` + Fetches all values from the column in database. + Provide table name, desired column and criteria. {% highlight php %} @@ -341,8 +353,14 @@ $mails = $I->grabColumnFromDatabase('users', 'email', array('name' => 'RebOOter' #### grabFromDatabase - + +* `param string` $table +* `param string` $column +* `param array` $criteria +* `return mixed` Returns a single column value or false + Fetches a single column value from a database. + Provide table name, desired column and criteria. {% highlight php %} @@ -363,22 +381,24 @@ $user = $I->grabFromDatabase('users', ['email like' => 'miles%']); Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`. - * `return mixed` Returns a single column value or false - #### grabNumRecords - -Returns the number of rows in a database - * `param string` $table Table name - * `param array` $criteria Search criteria [Optional] - * `return int` +* `param string` $table Table name +* `param array` $criteria Search criteria [Optional] +* `return int` + +Returns the number of rows in a database #### haveInDatabase - -Inserts an SQL record into a database. This record will be erased after the test, -unless you've configured "skip_cleanup_if_failed", and the test fails. + +* `param string` $table +* `param array` $data +* `return int` + +Inserts an SQL record into a database. This record will be erased after the test, +unless you've configured "skip_cleanup_if_failed", and the test fails. {% highlight php %} @@ -389,7 +409,12 @@ $I->haveInDatabase('users', array('name' => 'miles', 'email' => 'miles@davis.com #### performInDatabase - + +* `param ` $databaseKey +* `param ActionSequence|array|callable` $actions +* `throws ModuleConfigException` +* `return void` + Can be used with a callback if you don't want to change the current database in your test. {% highlight php %} @@ -425,14 +450,15 @@ Choose the syntax you like the most and use it, Actions executed from array or ActionSequence will print debug output for actions, and adds an action name to exception on failure. - * `param` $databaseKey - * `param ActionSequence|array|callable` $actions -@throws ModuleConfigException - #### seeInDatabase - + +* `param string` $table +* `param array` $criteria +* `return void` + Asserts that a row with the given column values exists. + Provide table name and column values. {% highlight php %} @@ -457,7 +483,12 @@ Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`. #### seeNumRecords - + +* `param int` $expectedNumber Expected number +* `param string` $table Table name +* `param array` $criteria Search criteria [Optional] +* `return void` + Asserts that the given number of records were found in the database. {% highlight php %} @@ -467,13 +498,14 @@ $I->seeNumRecords(1, 'users', ['name' => 'davert']) {% endhighlight %} - * `param int` $expectedNumber Expected number - * `param string` $table Table name - * `param array` $criteria Search criteria [Optional] - #### updateInDatabase - + +* `param string` $table +* `param array` $data +* `param array` $criteria +* `return void` + Update an SQL record into a database. {% highlight php %} diff --git a/docs/modules/Doctrine2.md b/docs/modules/Doctrine2.md index e7567b219..129669e75 100644 --- a/docs/modules/Doctrine2.md +++ b/docs/modules/Doctrine2.md @@ -147,7 +147,9 @@ Note that key is ignored, because actual field name is part of criteria and/or e ### Actions #### clearEntityManager - + +* `return void` + Performs $em->clear(): {% highlight php %} @@ -158,22 +160,31 @@ $I->clearEntityManager(); #### dontSeeInRepository - -Flushes changes to database and performs `findOneBy()` call for current repository. - * `param class-string` $entity - * `param array` $params - * `return void` +* `param class-string` $entity +* `param array` $params +* `return void` + +Flushes changes to database and performs `findOneBy()` call for current repository. #### flushToDatabase - + +* `return void` + Performs $em->flush(); #### grabEntitiesFromRepository - + +* `template` T of object +* `version` 1.1 +* `param class-string` $entity +* `param array` $params . For `IS NULL`, use `['field' => null]` +* `return list` + Selects entities from repository. + It builds query based on array of parameters. You can use entity associations to build complex queries. @@ -186,16 +197,17 @@ $users = $I->grabEntitiesFromRepository(User::class, ['name' => 'davert']); {% endhighlight %} -@template T of object - * `param class-string` $entity - * `param array` $params . For `IS NULL`, use `['field' => null]` - * `return list` - * `Available since` 1.1 - #### grabEntityFromRepository - + +* `template` T of object +* `version` 1.1 +* `param class-string` $entity +* `param array` $params . For `IS NULL`, use `['field' => null]` +* `return T` + Selects a single entity from repository. + It builds query based on array of parameters. You can use entity associations to build complex queries. @@ -208,16 +220,17 @@ $user = $I->grabEntityFromRepository(User::class, ['id' => '1234']); {% endhighlight %} -@template T of object - * `param class-string` $entity - * `param array` $params . For `IS NULL`, use `['field' => null]` - * `return T` - * `Available since` 1.1 - #### grabFromRepository - + +* `version` 1.1 +* `param class-string` $entity +* `param string` $field +* `param array` $params +* `return mixed` + Selects field value from repository. + It builds query based on array of parameters. You can use entity associations to build complex queries. @@ -230,14 +243,14 @@ $email = $I->grabFromRepository(User::class, 'email', ['name' => 'davert']); {% endhighlight %} - * `param class-string` $entity - * `param string` $field - * `param array` $params - * `Available since` 1.1 - #### haveFakeRepository - + +* `param class-string` $className +* `param array $methods +* `param array` $methods +* `return void` + Mocks the repository. With this action you can redefine any method of any repository. @@ -257,13 +270,16 @@ $I->haveFakeRepository(User::class, ['findByUsername' => function($username) { r This creates a stub class for Entity\User repository with redefined method findByUsername, which will always return the NULL value. - * `param class-string` $className - * `param array` $methods - #### haveInRepository - + +* `template` T of object +* `param class-string|T` $classNameOrInstance +* `param array` $data +* `return mixed` + Persists a record into the repository. + This method creates an entity, and sets its properties directly (via reflection). Setters of the entity won't be executed, but you can create almost any entity and save it to the database. If the entity has a constructor, for optional parameters the default value will be used and for non-optional parameters the given fields (with a matching name) will be passed when calling the constructor before the properties get set directly (via reflection). @@ -328,13 +344,15 @@ This works recursively, so you can create deep structures in a single call. Note that `$em->persist()`, `$em->refresh()`, and `$em->flush()` are called every time. -@template T of object - * `param class-string|T` $classNameOrInstance - * `param array` $data - #### loadFixtures - + +* `param class-string|class-string[]|list` $fixtures +* `param bool` $append +* `throws ModuleException` +* `throws ModuleRequireException` +* `return void` + Loads fixtures. Fixture can be specified as a fully qualified class name, an instance, or an array of class names/instances. @@ -359,19 +377,19 @@ $I->loadFixtures(AppFixtures::class, false); This method requires [`doctrine/data-fixtures`](https://github.com/doctrine/data-fixtures) to be installed. - * `param class-string|class-string[]|list` $fixtures - * `param bool` $append -@throws ModuleException -@throws ModuleRequireException - #### onReconfigure - + +* `return void` + HOOK to be executed when config changes with `_reconfigure`. #### refreshEntities - + +* `param object|object[]` $entities +* `return void` + Performs $em->refresh() on every passed entity: {% highlight php %} @@ -384,12 +402,15 @@ $I->refreshEntities([$post1, $post2, $post3]]); This can useful in acceptance tests where entity can become invalid due to external (relative to entity manager used in tests) changes. - * `param object|object[]` $entities - #### seeInRepository - + +* `param class-string` $entity +* `param array` $params +* `return void` + Flushes changes to database, and executes a query with parameters defined in an array. + You can use entity associations to build complex queries. Example: @@ -405,8 +426,4 @@ $I->seeInRepository(Client::class, ['User' => ['Company' => ['name' => 'Codegyre Fails if record for given criteria can\'t be found, - * `param class-string` $entity - * `param array` $params - * `return void` -

 

Module reference is taken from the source code. Help us to improve documentation. Edit module reference
diff --git a/docs/modules/FTP.md b/docs/modules/FTP.md index decb861f9..27294d1f2 100644 --- a/docs/modules/FTP.md +++ b/docs/modules/FTP.md @@ -119,12 +119,18 @@ This module extends the Filesystem module, file contents methods are inherited f ### Actions #### amInPath - + +* `param string` $path +* `return void` + Enters a directory on the ftp system - FTP root directory is used by default #### cleanDir - + +* `param string` $dirname +* `return void` + Erases directory contents on the FTP/SFTP server {% highlight php %} @@ -136,12 +142,19 @@ $I->cleanDir('logs'); #### copyDir - + +* `param string` $src +* `param string` $dst +* `return void` + Currently not supported in this module, overwrite inherited method #### deleteDir - + +* `param string` $dirname +* `return void` + Deletes directory with all subdirectories on the remote FTP/SFTP server {% highlight php %} @@ -153,7 +166,10 @@ $I->deleteDir('vendor'); #### deleteFile - + +* `param string` $filename +* `return void` + Deletes a file on the remote FTP/SFTP system {% highlight php %} @@ -165,23 +181,37 @@ $I->deleteFile('composer.lock'); #### deleteThisFile - + +* `return void` + Deletes a file #### dontSeeFileFound - + +* `param string` $filename +* `param string` $path +* `return void` + Checks if file does not exist in path on the remote FTP/SFTP system #### dontSeeFileFoundMatches - + +* `param string` $regex +* `param string` $path +* `return void` + Checks if file does not exist in path on the remote FTP/SFTP system, using regular expression as filename. + DOES NOT OPEN the file when it's exists #### dontSeeInThisFile - + +* `param string` $text +* `return void` + Checks If opened file doesn't contain `text` in it {% highlight php %} @@ -194,7 +224,9 @@ $I->dontSeeInThisFile('codeception/codeception'); #### grabDirectory - + +* `return string` + Grabber method to return current working directory {% highlight php %} @@ -206,7 +238,11 @@ $pwd = $I->grabDirectory(); #### grabFileCount - + +* `param bool` $ignore - suppress '.', '..' and '.thumbs.db' +* `param string` $path +* `return int` + Grabber method for returning file/folders count in directory {% highlight php %} @@ -217,11 +253,13 @@ $count = $I->grabFileCount('TEST', false); // Include . .. .thumbs.db {% endhighlight %} - * `param bool` $ignore - suppress '.', '..' and '.thumbs.db' - #### grabFileList - + +* `param bool` $ignore - suppress '.', '..' and '.thumbs.db' +* `param string` $path +* `return array` + Grabber method for returning file/folders listing in an array {% highlight php %} @@ -232,11 +270,12 @@ $count = $I->grabFileList('TEST', false); // Include . .. .thumbs.db {% endhighlight %} - * `param bool` $ignore - suppress '.', '..' and '.thumbs.db' - #### grabFileModified - + +* `param string` $filename +* `return int` + Grabber method to return last modified timestamp {% highlight php %} @@ -248,7 +287,10 @@ $time = $I->grabFileModified('test.txt'); #### grabFileSize - + +* `param string` $filename +* `return int` + Grabber method to return file size {% highlight php %} @@ -260,7 +302,11 @@ $size = $I->grabFileSize('test.txt'); #### loginAs - + +* `param string` $user +* `param string` $password +* `return void` + Change the logged in user mid-way through your test, this closes the current connection to the server and initialises and new connection. @@ -277,7 +323,10 @@ $I->loginAs('user','password'); #### makeDir - + +* `param string` $dirname +* `return void` + Create a directory on the server {% highlight php %} @@ -289,7 +338,10 @@ $I->makeDir('vendor'); #### openFile - + +* `param string` $filename +* `return void` + Opens a file (downloads from the remote FTP/SFTP system to a tmp directory for processing) and stores it's content. @@ -305,7 +357,11 @@ $I->seeInThisFile('codeception/codeception'); #### renameDir - + +* `param string` $dirname +* `param string` $rename +* `return void` + Rename/Move directory on the FTP/SFTP server {% highlight php %} @@ -317,7 +373,11 @@ $I->renameDir('vendor', 'vendor_old'); #### renameFile - + +* `param string` $filename +* `param string` $rename +* `return void` + Rename/Move file on the FTP/SFTP server {% highlight php %} @@ -329,8 +389,12 @@ $I->renameFile('composer.lock', 'composer_old.lock'); #### seeFileContentsEqual - + +* `param string` $text +* `return void` + Checks the strict matching of file contents. + Unlike `seeInThisFile` will fail if file has something more than expected lines. Better to use with HEREDOC strings. Matching is done after removing "\r" chars from file content. @@ -345,8 +409,13 @@ $I->seeFileContentsEqual('3192'); #### seeFileFound - + +* `param string` $filename +* `param string` $path +* `return void` + Checks if file exists in path on the remote FTP/SFTP system. + DOES NOT OPEN the file when it's exists {% highlight php %} @@ -358,8 +427,13 @@ $I->seeFileFound('UserModel.php','app/models'); #### seeFileFoundMatches - + +* `param string` $regex +* `param string` $path +* `return void` + Checks if file exists in path on the remote FTP/SFTP system, using regular expression as filename. + DOES NOT OPEN the file when it's exists {% highlight php %} @@ -371,7 +445,10 @@ $I->seeFileFoundMatches('/^UserModel_([0-9]{6}).php$/','app/models'); #### seeInThisFile - + +* `param string` $text +* `return void` + Checks If opened file has `text` in it. Usage: @@ -386,7 +463,10 @@ $I->seeInThisFile('codeception/codeception'); #### seeNumberNewLines - + +* `param int` $number New lines +* `return void` + Checks If opened file has the `number` of new lines. Usage: @@ -399,17 +479,23 @@ $I->seeNumberNewLines(5); {% endhighlight %} - * `param int` $number New lines - #### seeThisFileMatches - + +* `param string` $regex +* `return void` + Checks that contents of currently opened file matches $regex #### writeToFile - + +* `param string` $filename +* `param string` $contents +* `return void` + Saves contents to tmp file and uploads the FTP/SFTP system. + Overwrites current file on server if exists. {% highlight php %} diff --git a/docs/modules/Filesystem.md b/docs/modules/Filesystem.md index 1b89e2cec..72a905126 100644 --- a/docs/modules/Filesystem.md +++ b/docs/modules/Filesystem.md @@ -46,13 +46,20 @@ Module was developed to test Codeception itself. ### Actions #### amInPath - + +* `param string` $path +* `return void` + Enters a directory In local filesystem. + Project root directory is used by default #### cleanDir - + +* `param string` $dirname +* `return void` + Erases directory contents {% highlight php %} @@ -64,7 +71,11 @@ $I->cleanDir('logs'); #### copyDir - + +* `param string` $src +* `param string` $dst +* `return void` + Copies directory with all contents {% highlight php %} @@ -76,7 +87,10 @@ $I->copyDir('vendor','old_vendor'); #### deleteDir - + +* `param string` $dirname +* `return void` + Deletes directory with all subdirectories {% highlight php %} @@ -88,7 +102,10 @@ $I->deleteDir('vendor'); #### deleteFile - + +* `param string` $filename +* `return void` + Deletes a file {% highlight php %} @@ -100,17 +117,26 @@ $I->deleteFile('composer.lock'); #### deleteThisFile - + +* `return void` + Deletes a file #### dontSeeFileFound - + +* `param string` $filename +* `param string` $path +* `return void` + Checks if file does not exist in path #### dontSeeInThisFile - + +* `param string` $text +* `return void` + Checks If opened file doesn't contain `text` in it {% highlight php %} @@ -123,7 +149,10 @@ $I->dontSeeInThisFile('codeception/codeception'); #### openFile - + +* `param string` $filename +* `return void` + Opens a file and stores it's content. Usage: @@ -138,8 +167,12 @@ $I->seeInThisFile('codeception/codeception'); #### seeFileContentsEqual - + +* `param string` $text +* `return void` + Checks the strict matching of file contents. + Unlike `seeInThisFile` will fail if file has something more than expected lines. Better to use with HEREDOC strings. Matching is done after removing "\r" chars from file content. @@ -154,8 +187,13 @@ $I->seeFileContentsEqual('3192'); #### seeFileFound - + +* `param string` $filename +* `param string` $path +* `return void` + Checks if file exists in path. + Opens a file when it's exists {% highlight php %} @@ -167,7 +205,10 @@ $I->seeFileFound('UserModel.php','app/models'); #### seeInThisFile - + +* `param string` $text +* `return void` + Checks If opened file has `text` in it. Usage: @@ -182,7 +223,10 @@ $I->seeInThisFile('codeception/codeception'); #### seeNumberNewLines - + +* `param int` $number New lines +* `return void` + Checks If opened file has the `number` of new lines. Usage: @@ -195,16 +239,21 @@ $I->seeNumberNewLines(5); {% endhighlight %} - * `param int` $number New lines - #### seeThisFileMatches - + +* `param string` $regex +* `return void` + Checks that contents of currently opened file matches $regex #### writeToFile - + +* `param string` $filename +* `param string` $contents +* `return void` + Saves contents to file

 

Module reference is taken from the source code. Help us to improve documentation. Edit module reference
diff --git a/docs/modules/Laminas.md b/docs/modules/Laminas.md index 9bbff6483..3d00c4c06 100644 --- a/docs/modules/Laminas.md +++ b/docs/modules/Laminas.md @@ -76,7 +76,11 @@ modules: #### _findElements *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param mixed` $locator +* `return iterable` + Locates element using available Codeception locator types: * XPath @@ -100,11 +104,14 @@ WebDriver module returns `Facebook\WebDriver\Remote\RemoteWebElement` instances PhpBrowser and Framework modules return `Symfony\Component\DomCrawler\Crawler` instances - #### _getResponseContent *hidden API method, expected to be used from Helper classes* - + +* `api` +* `throws ModuleException` +* `return string` + Returns content of the last response Use it in Helpers when you want to retrieve response of request performed by another module. @@ -119,14 +126,22 @@ public function seeResponseContains($text) {% endhighlight %} -@throws ModuleException - #### _loadPage *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param string` $method +* `param string` $uri +* `param array` $parameters +* `param array` $files +* `param array` $server +* `param ?string` $content +* `return void` + Opens a page with arbitrary request parameters. + Useful for testing multi-step forms on a specific step. {% highlight php %} @@ -140,12 +155,23 @@ public function openCheckoutFormStep2($orderId) { {% endhighlight %} - #### _request *hidden API method, expected to be used from Helper classes* - + +* `api` +* `see` `_loadPage` +* `param string` $method +* `param string` $uri +* `param array` $parameters +* `param array` $files +* `param array` $server +* `param ?string` $content +* `throws ExternalUrlException|ModuleException` +* `return ?string` + Send custom request to a backend using method, uri, parameters, etc. + Use it in Helpers to create special request actions, like accessing API Returns a string with response body. @@ -163,14 +189,15 @@ public function createUserByApi($name) { Does not load the response into the module so you can't interact with response page (click, fill forms). To load arbitrary page for interaction, use `_loadPage` method. -@throws ExternalUrlException|ModuleException -@see `_loadPage` - #### _savePageSource *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param string` $filename +* `return void` + Saves page source of to a file {% highlight php %} @@ -181,28 +208,39 @@ $this->getModule('Laminas')->_savePageSource(codecept_output_dir().'page.html'); #### addFactoryToContainer - -Adds factory to a Laminas container - * `param string|callable|FactoryInterface` $factory - * `[Part]` services +* `part` services +* `param string|callable|FactoryInterface` $factory +* `param string` $name +* `return void` + +Adds factory to a Laminas container #### addServiceToContainer - -Adds service to a Laminas container - * `[Part]` services - * `param array|object` $service +* `part` services +* `param array|object` $service +* `param string` $name +* `return void` + +Adds service to a Laminas container #### amHttpAuthenticated - + +* `param string` $username +* `param string` $password +* `return void` + Authenticates user for HTTP_AUTH #### amOnPage - + +* `param string` $page +* `return void` + Opens the page for the given relative URI. {% highlight php %} @@ -217,7 +255,11 @@ $I->amOnPage('/register'); #### amOnRoute - + +* `param string` $routeName +* `param array` $params +* `return void` + Opens web page using route name and parameters. {% highlight php %} @@ -230,7 +272,11 @@ $I->amOnRoute('posts.show', array('id' => 34)); #### attachFile - + +* `param ` $field +* `param string` $filename +* `return void` + Attaches a file relative to the Codeception `_data` directory to the given file upload field. {% highlight php %} @@ -243,7 +289,10 @@ $I->attachFile('input[@type="file"]', 'prices.xls'); #### checkOption - + +* `param ` $option +* `return void` + Ticks a checkbox. For radio buttons, use the `selectOption` method instead. {% highlight php %} @@ -255,8 +304,13 @@ $I->checkOption('#agree'); #### click - + +* `param string|array` $link +* `param ` $context +* `return void` + 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. @@ -283,11 +337,13 @@ $I->click('Logout', '#nav'); $I->click(['link' => 'Login']); {% endhighlight %} - * `param string|array` $link #### deleteHeader - + +* `param string` $name the name of the header to delete. +* `return void` + Deletes the header with the passed name. Subsequent requests will not have the deleted header in its request. @@ -303,12 +359,15 @@ $I->amOnPage('some-other-page.php'); {% endhighlight %} - * `param string` $name the name of the header to delete. - #### dontSee - + +* `param array|string` $selector optional +* `param string` $text +* `return void` + Checks that the current page doesn't contain the text specified (case insensitive). + Give a locator as the second parameter to match a specific region. {% highlight php %} @@ -335,11 +394,12 @@ But will ignore strings like: For checking the raw source code, use `seeInSource()`. - * `param array|string` $selector optional - #### dontSeeCheckboxIsChecked - + +* `param ` $checkbox +* `return void` + Check that the specified checkbox is unchecked. {% highlight php %} @@ -352,16 +412,23 @@ $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user #### dontSeeCookie - + +* `param ` $cookie +* `param ` $params +* `return mixed|void` + Checks that there isn't a cookie with the given name. -You can set additional cookie params like `domain`, `path` as array passed in last argument. - * `return mixed|void` +You can set additional cookie params like `domain`, `path` as array passed in last argument. #### dontSeeCurrentUrlEquals - + +* `param string` $uri +* `return void` + Checks that the current URL doesn't equal the given string. + Unlike `dontSeeInCurrentUrl`, this only matches the full URL. {% highlight php %} @@ -374,7 +441,10 @@ $I->dontSeeCurrentUrlEquals('/'); #### dontSeeCurrentUrlMatches - + +* `param string` $uri +* `return void` + Checks that current url doesn't match the given regular expression. {% highlight php %} @@ -387,8 +457,13 @@ $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~'); #### dontSeeElement - + +* `param ` $selector +* `param array` $attributes +* `return void` + Checks that the given element is invisible or not present on the page. + You can also specify expected attributes of this element. {% highlight php %} @@ -403,7 +478,10 @@ $I->dontSeeElement('input', ['value' => '123456']); #### dontSeeInCurrentUrl - + +* `param string` $uri +* `return void` + Checks that the current URI doesn't contain the given string. {% highlight php %} @@ -415,8 +493,13 @@ $I->dontSeeInCurrentUrl('/users/'); #### dontSeeInField - + +* `param string|array` $field +* `param ` $value +* `return void` + Checks that an input field or textarea doesn't contain the given value. + For fuzzy locators, the field is matched by label text, CSS and XPath. {% highlight php %} @@ -430,11 +513,14 @@ $I->dontSeeInField('//form/*[@name=search]','Search'); $I->dontSeeInField(['name' => 'search'], 'Search'); {% endhighlight %} - * `param string|array` $field #### dontSeeInFormFields - + +* `param ` $formSelector +* `param array` $params +* `return void` + Checks if the array of form parameters (name => value) are not set on the form matched with the passed selector. @@ -477,7 +563,10 @@ $I->dontSeeInFormFields('#form-id', [ #### dontSeeInSource - + +* `param string` $raw +* `return void` + Checks that the current page contains the given string in its raw source code. @@ -490,15 +579,21 @@ $I->dontSeeInSource('

Green eggs & ham

'); #### dontSeeInTitle - -Checks that the page title does not contain the given string. - * `return mixed|void` +* `param ` $title +* `return mixed|void` + +Checks that the page title does not contain the given string. #### dontSeeLink - + +* `param string` $text +* `param string` $url +* `return void` + Checks that the page doesn't contain a link with the given string. + If the second parameter is given, only links with a matching "href" attribute will be checked. {% highlight php %} @@ -511,7 +606,11 @@ $I->dontSeeLink('Checkout now', '/store/cart.php'); #### dontSeeOptionIsSelected - + +* `param ` $selector +* `param ` $optionText +* `return mixed|void` + Checks that the given option is not selected. {% highlight php %} @@ -521,11 +620,12 @@ $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); {% endhighlight %} - * `return mixed|void` - #### dontSeeResponseCodeIs - + +* `param int` $code +* `return void` + Checks that response code is equal to value provided. {% highlight php %} @@ -540,7 +640,11 @@ $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK); #### fillField - + +* `param ` $field +* `param ` $value +* `return void` + Fills a text field or textarea with the given string. {% highlight php %} @@ -553,7 +657,9 @@ $I->fillField(['name' => 'email'], 'jon@example.com'); #### followRedirect - + +* `return void` + Follow pending redirect if there is one. {% highlight php %} @@ -565,8 +671,13 @@ $I->followRedirect(); #### grabAttributeFrom - + +* `param ` $cssOrXpath +* `param string` $attribute +* `return mixed` + Grabs the value of the given attribute value from the given element. + Fails if element is not found. {% highlight php %} @@ -578,15 +689,24 @@ $I->grabAttributeFrom('#tooltip', 'title'); #### grabCookie - + +* `param string` $cookie +* `param array` $params +* `return mixed` + Grabs a cookie value. + You can set additional cookie params like `domain`, `path` in array passed as last argument. If the cookie is set by an ajax request (XMLHttpRequest), there might be some delay caused by the browser, so try `$I->wait(0.1)`. #### grabFromCurrentUrl - + +* `param ?string` $uri +* `return mixed` + Executes the given regular expression against the current URI and returns the first capturing group. + If no parameters are provided, the full URI is returned. {% highlight php %} @@ -599,7 +719,11 @@ $uri = $I->grabFromCurrentUrl(); #### grabMultiple - + +* `param ` $cssOrXpath +* `param ?string` $attribute +* `return string[]` + Grabs either the text content, or attribute values, of nodes matched by $cssOrXpath and returns them as an array. @@ -622,20 +746,23 @@ $aLinks = $I->grabMultiple('a', 'href'); {% endhighlight %} - * `return string[]` - #### grabPageSource - -Grabs current page source code. -@throws ModuleException if no page was opened. - * `return string` Current page source code. +* `throws ModuleException` if no page was opened. +* `return string` Current page source code. + +Grabs current page source code. #### grabServiceFromContainer - + +* `part` services +* `param string` $service +* `return mixed` + Grabs a service from a Laminas container. + Recommended using for unit testing. {% highlight php %} @@ -643,13 +770,15 @@ Recommended using for unit testing. $em = $I->grabServiceFromContainer('Doctrine\ORM\EntityManager'); {% endhighlight %} - * `[Part]` services - #### grabTextFrom - + +* `param ` $cssOrXPathOrRegex +* `return mixed` + Finds and returns the text contents of the given element. + If a fuzzy locator is used, the element is found using CSS, XPath, and by matching the full page source by regular expression. @@ -664,8 +793,12 @@ $value = $I->grabTextFrom('~grabValueFrom(['name' => 'username']); #### haveHttpHeader - + +* `param string` $name the name of the request header +* `param string` $value the value to set it to for subsequent + requests +* `return void` + Sets the HTTP header to the passed value - which is used on subsequent HTTP requests through PhpBrowser. @@ -705,13 +843,13 @@ $I->haveHttpHeader('Client_Id', 'Codeception'); {% endhighlight %} - * `param string` $name the name of the request header - * `param string` $value the value to set it to for subsequent - requests - #### haveServerParameter - + +* `param string` $name +* `param string` $value +* `return void` + Sets SERVER parameter valid for all next requests. {% highlight php %} @@ -722,7 +860,10 @@ $I->haveServerParameter('name', 'value'); #### makeHtmlSnapshot - + +* `param ?string` $name +* `return void` + Use this method within an [interactive pause](https://codeception.com/docs/02-GettingStarted#Interactive-Pause) to save the HTML source code of the current page. {% highlight php %} @@ -737,22 +878,30 @@ $I->makeHtmlSnapshot(); #### moveBack - -Moves back in history. - * `param int` $numberOfSteps (default value 1) +* `param int` $numberOfSteps (default value 1) +* `return void` + +Moves back in history. #### resetCookie - + +* `param ` $cookie +* `param ` $params +* `return mixed|void` + Unsets cookie with the given name. -You can set additional cookie params like `domain`, `path` in array passed as last argument. - * `return mixed|void` +You can set additional cookie params like `domain`, `path` in array passed as last argument. #### see - + +* `param array|string` $selector optional +* `param string` $text +* `return void` + 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 @@ -782,11 +931,12 @@ But will *not* be true for strings like: For checking the raw source code, use `seeInSource()`. - * `param array|string` $selector optional - #### seeCheckboxIsChecked - + +* `param ` $checkbox +* `return void` + Checks that the specified checkbox is checked. {% highlight php %} @@ -800,8 +950,13 @@ $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); #### seeCookie - + +* `param ` $cookie +* `param ` $params +* `return mixed|void` + Checks that a cookie with the given name is set. + You can set additional cookie params like `domain`, `path` as array passed in last argument. {% highlight php %} @@ -811,12 +966,15 @@ $I->seeCookie('PHPSESSID'); {% endhighlight %} - * `return mixed|void` - #### seeCurrentRouteIs - + +* `param string` $routeName +* `param array` $params +* `return void` + Checks that current url matches route. + {% highlight php %} seeCurrentRouteIs('posts.show', ['id' => 8])); #### seeCurrentUrlEquals - + +* `param string` $uri +* `return void` + Checks that the current URL is equal to the given string. + Unlike `seeInCurrentUrl`, this only matches the full URL. {% highlight php %} @@ -841,7 +1003,10 @@ $I->seeCurrentUrlEquals('/'); #### seeCurrentUrlMatches - + +* `param string` $uri +* `return void` + Checks that the current URL matches the given regular expression. {% highlight php %} @@ -854,8 +1019,13 @@ $I->seeCurrentUrlMatches('~^/users/(\d+)~'); #### seeElement - + +* `param ` $selector +* `param array` $attributes +* `return void` + Checks that the given element exists on the page and is visible. + You can also specify expected attributes of this element. {% highlight php %} @@ -873,7 +1043,10 @@ $I->seeElement(['css' => 'form input'], ['name' => 'login']); #### seeInCurrentUrl - + +* `param string` $uri +* `return void` + Checks that current URI contains the given string. {% highlight php %} @@ -888,8 +1061,13 @@ $I->seeInCurrentUrl('/users/'); #### seeInField - + +* `param string|array` $field +* `param ` $value +* `return void` + Checks that the given input field or textarea *equals* (i.e. not just contains) the given value. + Fields are matched by label text, the "name" attribute, CSS, or XPath. {% highlight php %} @@ -904,11 +1082,13 @@ $I->seeInField(['name' => 'search'], 'Search'); {% endhighlight %} - * `param string|array` $field - #### seeInFormFields - + +* `param ` $formSelector +* `param array` $params +* `return void` + Checks if the array of form parameters (name => value) are set on the form matched with the passed selector. @@ -972,7 +1152,10 @@ $I->seeInFormFields('//form[@id=my-form]', string $form); #### seeInSource - + +* `param string` $raw +* `return void` + Checks that the current page contains the given string in its raw source code. @@ -985,7 +1168,10 @@ $I->seeInSource('

Green eggs & ham

'); #### seeInTitle - + +* `param ` $title +* `return mixed|void` + Checks that the page title contains the given string. {% highlight php %} @@ -995,12 +1181,15 @@ $I->seeInTitle('Blog - Post #1'); {% endhighlight %} - * `return mixed|void` - #### seeLink - + +* `param string` $text +* `param ?string` $url +* `return void` + Checks that there's a link with the specified text. + Give a full URL as the second parameter to match links with that exact URL. {% highlight php %} @@ -1013,7 +1202,11 @@ $I->seeLink('Logout','/logout'); // matches Logout #### seeNumberOfElements - + +* `param int|int[]` $expected +* `param ` $selector +* `return void` + Checks that there are a certain number of elements matched by the given locator on the page. {% highlight php %} @@ -1024,11 +1217,13 @@ $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements {% endhighlight %} - * `param int|int[]` $expected - #### seeOptionIsSelected - + +* `param ` $selector +* `param ` $optionText +* `return mixed|void` + Checks that the given option is selected. {% highlight php %} @@ -1038,16 +1233,19 @@ $I->seeOptionIsSelected('#form input[name=payment]', 'Visa'); {% endhighlight %} - * `return mixed|void` - #### seePageNotFound - + +* `return void` + Asserts that current page has 404 response status code. #### seeResponseCodeIs - + +* `param int` $code +* `return void` + Checks that response code is equal to value provided. {% highlight php %} @@ -1062,32 +1260,48 @@ $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK); #### seeResponseCodeIsBetween - + +* `param int` $from +* `param int` $to +* `return void` + Checks that response code is between a certain range. Between actually means [from <= CODE <= to] #### seeResponseCodeIsClientError - + +* `return void` + Checks that the response code is 4xx #### seeResponseCodeIsRedirection - + +* `return void` + Checks that the response code 3xx #### seeResponseCodeIsServerError - + +* `return void` + Checks that the response code is 5xx #### seeResponseCodeIsSuccessful - + +* `return void` + Checks that the response code 2xx #### selectOption - + +* `param ` $select +* `param ` $option +* `return void` + Selects an option in a select tag or in radio button group. {% highlight php %} @@ -1120,14 +1334,24 @@ $I->selectOption('Which OS do you use?', array('value' => 'windows')); // Only s #### sendAjaxGetRequest - + +* `param string` $uri +* `param array` $params +* `return void` + Sends an ajax GET request with the passed parameters. + See `sendAjaxPostRequest()` #### sendAjaxPostRequest - + +* `param string` $uri +* `param array` $params +* `return void` + Sends an ajax POST request with the passed parameters. + The appropriate HTTP header is added automatically: `X-Requested-With: XMLHttpRequest` Example: @@ -1152,8 +1376,14 @@ $I->sendAjaxPostRequest('/add-task', ['form' => [ #### sendAjaxRequest - + +* `param string` $method +* `param string` $uri +* `param array` $params +* `return void` + Sends an ajax request, using the passed HTTP method. + See `sendAjaxPostRequest()` Example: {% highlight php %} @@ -1165,8 +1395,14 @@ $I->sendAjaxRequest('PUT', '/posts/7', ['title' => 'new title']); #### setCookie - + +* `param ` $name +* `param ` $val +* `param ` $params +* `return mixed|void` + Sets a cookie with the given name and value. + You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument. {% highlight php %} @@ -1176,11 +1412,12 @@ $I->setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3'); {% endhighlight %} - * `return mixed|void` - #### setMaxRedirects - + +* `param int` $maxRedirects +* `return void` + Sets the maximum number of redirects that the Client can follow. {% highlight php %} @@ -1192,8 +1429,12 @@ $I->setMaxRedirects(2); #### setServerParameters - + +* `param array` $params +* `return void` + Sets SERVER parameters valid for all next requests. + this will remove old ones. {% highlight php %} @@ -1204,7 +1445,9 @@ $I->setServerParameters([]); #### startFollowingRedirects - + +* `return void` + Enables automatic redirects to be followed by the client. {% highlight php %} @@ -1216,7 +1459,9 @@ $I->startFollowingRedirects(); #### stopFollowingRedirects - + +* `return void` + Prevents automatic redirects to be followed by the client. {% highlight php %} @@ -1228,7 +1473,12 @@ $I->stopFollowingRedirects(); #### submitForm - + +* `param ` $selector +* `param array` $params +* `param ?string` $button +* `return void` + Submits the given form on the page, with the given form values. Pass the form field's values as an array in the second parameter. @@ -1418,7 +1668,10 @@ $I->submitForm('#my-form', [ #### switchToIframe - + +* `param string` $name +* `return void` + Switch to iframe or frame on the page. Example: @@ -1438,7 +1691,10 @@ $I->switchToIframe("another_frame"); #### uncheckOption - + +* `param ` $option +* `return void` + Unticks a checkbox. {% highlight php %} diff --git a/docs/modules/Laravel.md b/docs/modules/Laravel.md index 71fd5cedc..dd6132d05 100644 --- a/docs/modules/Laravel.md +++ b/docs/modules/Laravel.md @@ -133,7 +133,11 @@ modules: #### _findElements *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param mixed` $locator +* `return iterable` + Locates element using available Codeception locator types: * XPath @@ -157,11 +161,14 @@ WebDriver module returns `Facebook\WebDriver\Remote\RemoteWebElement` instances PhpBrowser and Framework modules return `Symfony\Component\DomCrawler\Crawler` instances - #### _getResponseContent *hidden API method, expected to be used from Helper classes* - + +* `api` +* `throws ModuleException` +* `return string` + Returns content of the last response Use it in Helpers when you want to retrieve response of request performed by another module. @@ -176,14 +183,22 @@ public function seeResponseContains($text) {% endhighlight %} -@throws ModuleException - #### _loadPage *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param string` $method +* `param string` $uri +* `param array` $parameters +* `param array` $files +* `param array` $server +* `param ?string` $content +* `return void` + Opens a page with arbitrary request parameters. + Useful for testing multi-step forms on a specific step. {% highlight php %} @@ -197,12 +212,23 @@ public function openCheckoutFormStep2($orderId) { {% endhighlight %} - #### _request *hidden API method, expected to be used from Helper classes* - + +* `api` +* `see` `_loadPage` +* `param string` $method +* `param string` $uri +* `param array` $parameters +* `param array` $files +* `param array` $server +* `param ?string` $content +* `throws ExternalUrlException|ModuleException` +* `return ?string` + Send custom request to a backend using method, uri, parameters, etc. + Use it in Helpers to create special request actions, like accessing API Returns a string with response body. @@ -220,14 +246,15 @@ public function createUserByApi($name) { Does not load the response into the module so you can't interact with response page (click, fill forms). To load arbitrary page for interaction, use `_loadPage` method. -@throws ExternalUrlException|ModuleException -@see `_loadPage` - #### _savePageSource *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param string` $filename +* `return void` + Saves page source of to a file {% highlight php %} @@ -238,7 +265,11 @@ $this->getModule('Laravel')->_savePageSource(codecept_output_dir().'page.html'); #### amActingAs - + +* `param \Illuminate\Contracts\Auth\Authenticatable` $user +* `param ?string` $guardName +* `return void` + Set the given user object to the current or specified Guard. {% highlight php %} @@ -250,13 +281,22 @@ $I->amActingAs($user); #### amHttpAuthenticated - + +* `param string` $username +* `param string` $password +* `return void` + Authenticates user for HTTP_AUTH #### amLoggedAs - + +* `param Authenticatable|array` $user +* `param string|null` $guardName +* `return void` + Set the currently logged in user for the application. + Unlike 'amActingAs', this method does update the session, fire the login events and remember the user as it assigns the corresponding Cookie. @@ -272,12 +312,14 @@ $I->amLoggedAs( new User ); // can be verified with $I->seeAuthentication(); {% endhighlight %} - * `param Authenticatable|array` $user - * `param string|null` $guardName #### amOnAction - + +* `param string` $action +* `param mixed` $parameters +* `return void` + Opens web page by action name {% highlight php %} @@ -291,12 +333,12 @@ $I->amOnAction(PostsController::class . '@index'); {% endhighlight %} - * `param string` $action - * `param mixed` $parameters - #### amOnPage - + +* `param string` $page +* `return void` + Opens the page for the given relative URI. {% highlight php %} @@ -311,7 +353,11 @@ $I->amOnPage('/register'); #### amOnRoute - + +* `param string` $routeName +* `param mixed` $params +* `return void` + Opens web page using route name and parameters. {% highlight php %} @@ -321,12 +367,13 @@ $I->amOnRoute('posts.create'); {% endhighlight %} - * `param string` $routeName - * `param mixed` $params - #### assertAuthenticatedAs - + +* `param \Illuminate\Contracts\Auth\Authenticatable` $user +* `param ?string` $guardName +* `return void` + Assert that the user is authenticated as the given user. {% highlight php %} @@ -338,7 +385,11 @@ $I->assertAuthenticatedAs($user); #### assertCredentials - + +* `param array` $credentials +* `param ?string` $guardName +* `return void` + Assert that the given credentials are valid. {% highlight php %} @@ -353,7 +404,11 @@ $I->assertCredentials([ #### assertInvalidCredentials - + +* `param array` $credentials +* `param ?string` $guardName +* `return void` + Assert that the given credentials are invalid. {% highlight php %} @@ -368,7 +423,11 @@ $I->assertInvalidCredentials([ #### attachFile - + +* `param ` $field +* `param string` $filename +* `return void` + Attaches a file relative to the Codeception `_data` directory to the given file upload field. {% highlight php %} @@ -381,7 +440,12 @@ $I->attachFile('input[@type="file"]', 'prices.xls'); #### callArtisan - + +* `param string` $command +* `param array` $parameters +* `param ?\Symfony\Component\Console\Output\OutputInterface` $output +* `return string|void` + Call an Artisan command. {% highlight php %} @@ -393,11 +457,12 @@ $I->callArtisan('command:name', ['parameter' => 'value']); {% endhighlight %} Use 3rd parameter to pass in custom `OutputInterface` - * `return string|void` - #### checkOption - + +* `param ` $option +* `return void` + Ticks a checkbox. For radio buttons, use the `selectOption` method instead. {% highlight php %} @@ -409,7 +474,9 @@ $I->checkOption('#agree'); #### clearApplicationHandlers - + +* `return void` + Clear the registered application handlers. {% highlight php %} @@ -421,8 +488,13 @@ $I->clearApplicationHandlers(); #### click - + +* `param string|array` $link +* `param ` $context +* `return void` + 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. @@ -449,11 +521,13 @@ $I->click('Logout', '#nav'); $I->click(['link' => 'Login']); {% endhighlight %} - * `param string|array` $link #### deleteHeader - + +* `param string` $name the name of the header to delete. +* `return void` + Deletes the header with the passed name. Subsequent requests will not have the deleted header in its request. @@ -469,12 +543,13 @@ $I->amOnPage('some-other-page.php'); {% endhighlight %} - * `param string` $name the name of the header to delete. - #### disableEvents - + +* `return void` + Disable events for the next requests. + This method does not disable model events. To disable model events you have to use the disableModelEvents() method. @@ -487,7 +562,9 @@ $I->disableEvents(); #### disableExceptionHandling - + +* `return void` + Disable Laravel exception handling. {% highlight php %} @@ -499,7 +576,10 @@ $I->disableExceptionHandling(); #### disableMiddleware - + +* `param string|array|null` $middleware +* `return void` + Disable middleware for the next requests. {% highlight php %} @@ -509,11 +589,11 @@ $I->disableMiddleware(); {% endhighlight %} - * `param string|array|null` $middleware - #### disableModelEvents - + +* `return void` + Disable model events for the next requests. {% highlight php %} @@ -525,8 +605,13 @@ $I->disableModelEvents(); #### dontSee - + +* `param array|string` $selector optional +* `param string` $text +* `return void` + Checks that the current page doesn't contain the text specified (case insensitive). + Give a locator as the second parameter to match a specific region. {% highlight php %} @@ -553,11 +638,12 @@ But will ignore strings like: For checking the raw source code, use `seeInSource()`. - * `param array|string` $selector optional - #### dontSeeAuthentication - + +* `param ?string` $guardName +* `return void` + Check that user is not authenticated. {% highlight php %} @@ -569,7 +655,10 @@ $I->dontSeeAuthentication(); #### dontSeeCheckboxIsChecked - + +* `param ` $checkbox +* `return void` + Check that the specified checkbox is unchecked. {% highlight php %} @@ -582,16 +671,23 @@ $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user #### dontSeeCookie - + +* `param ` $cookie +* `param ` $params +* `return mixed|void` + Checks that there isn't a cookie with the given name. -You can set additional cookie params like `domain`, `path` as array passed in last argument. - * `return mixed|void` +You can set additional cookie params like `domain`, `path` as array passed in last argument. #### dontSeeCurrentUrlEquals - + +* `param string` $uri +* `return void` + Checks that the current URL doesn't equal the given string. + Unlike `dontSeeInCurrentUrl`, this only matches the full URL. {% highlight php %} @@ -604,7 +700,10 @@ $I->dontSeeCurrentUrlEquals('/'); #### dontSeeCurrentUrlMatches - + +* `param string` $uri +* `return void` + Checks that current url doesn't match the given regular expression. {% highlight php %} @@ -617,8 +716,13 @@ $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~'); #### dontSeeElement - + +* `param ` $selector +* `param array` $attributes +* `return void` + Checks that the given element is invisible or not present on the page. + You can also specify expected attributes of this element. {% highlight php %} @@ -633,7 +737,10 @@ $I->dontSeeElement('input', ['value' => '123456']); #### dontSeeEventTriggered - + +* `param string|object|string[]` $expected +* `return void` + Make sure events did not fire during the test. {% highlight php %} @@ -644,11 +751,12 @@ $I->dontSeeEventTriggered(new App\Events\MyEvent()); $I->dontSeeEventTriggered(['App\MyEvent', 'App\MyOtherEvent']); {% endhighlight %} - * `param string|object|string[]` $expected #### dontSeeFormErrors - + +* `return void` + Assert that there are no form errors bound to the View. {% highlight php %} @@ -660,7 +768,10 @@ $I->dontSeeFormErrors(); #### dontSeeInCurrentUrl - + +* `param string` $uri +* `return void` + Checks that the current URI doesn't contain the given string. {% highlight php %} @@ -672,8 +783,13 @@ $I->dontSeeInCurrentUrl('/users/'); #### dontSeeInField - + +* `param string|array` $field +* `param ` $value +* `return void` + Checks that an input field or textarea doesn't contain the given value. + For fuzzy locators, the field is matched by label text, CSS and XPath. {% highlight php %} @@ -687,11 +803,14 @@ $I->dontSeeInField('//form/*[@name=search]','Search'); $I->dontSeeInField(['name' => 'search'], 'Search'); {% endhighlight %} - * `param string|array` $field #### dontSeeInFormFields - + +* `param ` $formSelector +* `param array` $params +* `return void` + Checks if the array of form parameters (name => value) are not set on the form matched with the passed selector. @@ -734,7 +853,11 @@ $I->dontSeeInFormFields('#form-id', [ #### dontSeeInSession - + +* `param string|array` $key +* `param mixed|null` $value +* `return void` + Assert that a session attribute does not exist, or is not equal to the passed value. {% highlight php %} @@ -745,12 +868,12 @@ $I->dontSeeInSession('attribute', 'value'); {% endhighlight %} - * `param string|array` $key - * `param mixed|null` $value - #### dontSeeInSource - + +* `param string` $raw +* `return void` + Checks that the current page contains the given string in its raw source code. @@ -763,15 +886,21 @@ $I->dontSeeInSource('

Green eggs & ham

'); #### dontSeeInTitle - -Checks that the page title does not contain the given string. - * `return mixed|void` +* `param ` $title +* `return mixed|void` + +Checks that the page title does not contain the given string. #### dontSeeLink - + +* `param string` $text +* `param string` $url +* `return void` + Checks that the page doesn't contain a link with the given string. + If the second parameter is given, only links with a matching "href" attribute will be checked. {% highlight php %} @@ -784,7 +913,11 @@ $I->dontSeeLink('Checkout now', '/store/cart.php'); #### dontSeeOptionIsSelected - + +* `param ` $selector +* `param ` $optionText +* `return mixed|void` + Checks that the given option is not selected. {% highlight php %} @@ -794,12 +927,16 @@ $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); {% endhighlight %} - * `return mixed|void` - #### dontSeeRecord - + +* `part` orm +* `param string|class-string|object` $table +* `param array` $attributes +* `return void` + Checks that record does not exist in database. + You can pass the name of a database table or the class name of an Eloquent model as the first argument. {% highlight php %} @@ -811,13 +948,12 @@ $I->dontSeeRecord('App\Models\User', ['name' => 'Davert']); {% endhighlight %} - * `param string|class-string|object` $table - * `param array` $attributes - * `[Part]` orm - #### dontSeeResponseCodeIs - + +* `param int` $code +* `return void` + Checks that response code is equal to value provided. {% highlight php %} @@ -832,7 +968,10 @@ $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK); #### dontSeeSessionHasValues - + +* `param array` $bindings +* `return void` + Assert that the session does not have a particular list of values. {% highlight php %} @@ -845,7 +984,9 @@ $I->dontSeeSessionHasValues(['key1' => 'value1', 'key2' => 'value2']); #### enableExceptionHandling - + +* `return void` + Enable Laravel exception handling. {% highlight php %} @@ -857,7 +998,10 @@ $I->enableExceptionHandling(); #### enableMiddleware - + +* `param string|array|null` $middleware +* `return void` + Enable the given middleware for the next requests. {% highlight php %} @@ -867,11 +1011,13 @@ $I->enableMiddleware(); {% endhighlight %} - * `param string|array|null` $middleware - #### fillField - + +* `param ` $field +* `param ` $value +* `return void` + Fills a text field or textarea with the given string. {% highlight php %} @@ -884,7 +1030,9 @@ $I->fillField(['name' => 'email'], 'jon@example.com'); #### flushSession - + +* `return void` + Flush all of the current session data. {% highlight php %} @@ -896,7 +1044,9 @@ $I->flushSession(); #### followRedirect - + +* `return void` + Follow pending redirect if there is one. {% highlight php %} @@ -908,7 +1058,9 @@ $I->followRedirect(); #### getApplication - + +* `return \Illuminate\Contracts\Foundation\Application` + Provides access the Laravel application object. {% highlight php %} @@ -920,8 +1072,13 @@ $app = $I->getApplication(); #### grabAttributeFrom - + +* `param ` $cssOrXpath +* `param string` $attribute +* `return mixed` + Grabs the value of the given attribute value from the given element. + Fails if element is not found. {% highlight php %} @@ -933,15 +1090,24 @@ $I->grabAttributeFrom('#tooltip', 'title'); #### grabCookie - + +* `param string` $cookie +* `param array` $params +* `return mixed` + Grabs a cookie value. + You can set additional cookie params like `domain`, `path` in array passed as last argument. If the cookie is set by an ajax request (XMLHttpRequest), there might be some delay caused by the browser, so try `$I->wait(0.1)`. #### grabFromCurrentUrl - + +* `param ?string` $uri +* `return mixed` + Executes the given regular expression against the current URI and returns the first capturing group. + If no parameters are provided, the full URI is returned. {% highlight php %} @@ -954,7 +1120,11 @@ $uri = $I->grabFromCurrentUrl(); #### grabMultiple - + +* `param ` $cssOrXpath +* `param ?string` $attribute +* `return string[]` + Grabs either the text content, or attribute values, of nodes matched by $cssOrXpath and returns them as an array. @@ -977,11 +1147,14 @@ $aLinks = $I->grabMultiple('a', 'href'); {% endhighlight %} - * `return string[]` - #### grabNumRecords - + +* `part` orm +* `param string` $table +* `param array` $attributes +* `return int` + Retrieves number of records from database You can pass the name of a database table or the class name of an Eloquent model as the first argument. @@ -993,21 +1166,25 @@ $I->grabNumRecords('App\Models\User', ['name' => 'Davert']); {% endhighlight %} - * `[Part]` orm - #### grabPageSource - -Grabs current page source code. -@throws ModuleException if no page was opened. - * `return string` Current page source code. +* `throws ModuleException` if no page was opened. +* `return string` Current page source code. + +Grabs current page source code. #### grabRecord - + +* `part` orm +* `param string` $table +* `param array` $attributes +* `return array|EloquentModel` + Retrieves record from database If you pass the name of a database table as the first argument, this method returns an array. + You can also pass the class name of an Eloquent model, in that case this method returns an Eloquent model. {% highlight php %} @@ -1018,15 +1195,14 @@ $record = $I->grabRecord('App\Models\User', ['name' => 'Davert']); // returns El {% endhighlight %} - * `param string` $table - * `param array` $attributes - * `return array|EloquentModel` - * `[Part]` orm - #### grabService - + +* `param string` $class +* `return mixed` + Return an instance of a class from the Laravel service container. + (https://laravel.com/docs/7.x/container) {% highlight php %} @@ -1045,10 +1221,13 @@ $service = $I->grabService('foo'); {% endhighlight %} - #### grabTextFrom - + +* `param ` $cssOrXPathOrRegex +* `return mixed` + Finds and returns the text contents of the given element. + If a fuzzy locator is used, the element is found using CSS, XPath, and by matching the full page source by regular expression. @@ -1063,8 +1242,12 @@ $value = $I->grabTextFrom('~grabValueFrom(['name' => 'username']); #### have - + +* `part` orm +* `see` https://laravel.com/docs/7.x/database-testing#using-factories +* `param string` $model +* `param array` $attributes +* `param string` $name +* `return mixed` + Use Laravel model factory to create a model. {% highlight php %} @@ -1091,14 +1281,14 @@ $I->have('App\Models\User', [], 'admin'); {% endhighlight %} -@see https://laravel.com/docs/7.x/database-testing#using-factories - * `[Part]` orm +#### haveApplicationHandler +* `param callable` $handler +* `return void` -#### haveApplicationHandler - Register a handler than can be used to modify the Laravel application object after it is initialized. + The Laravel application object will be passed as an argument to the handler. {% highlight php %} @@ -1112,8 +1302,14 @@ $I->haveApplicationHandler(function($app) { #### haveBinding - + +* `param string` $abstract +* `param Closure|string|null` $concrete +* `param bool` $shared +* `return void` + Add a binding to the Laravel service container. + (https://laravel.com/docs/7.x/container) {% highlight php %} @@ -1123,14 +1319,16 @@ $I->haveBinding('My\Interface', 'My\Implementation'); {% endhighlight %} - * `param string` $abstract - * `param Closure|string|null` $concrete - * `param bool` $shared - #### haveContextualBinding - + +* `param string` $concrete +* `param string` $abstract +* `param Closure|string` $implementation +* `return void` + Add a contextual binding to the Laravel service container. + (https://laravel.com/docs/7.x/container) {% highlight php %} @@ -1145,13 +1343,14 @@ $app->when('My\Class') {% endhighlight %} - * `param string` $concrete - * `param string` $abstract - * `param Closure|string` $implementation - #### haveHttpHeader - + +* `param string` $name the name of the request header +* `param string` $value the value to set it to for subsequent + requests +* `return void` + Sets the HTTP header to the passed value - which is used on subsequent HTTP requests through PhpBrowser. @@ -1176,13 +1375,12 @@ $I->haveHttpHeader('Client_Id', 'Codeception'); {% endhighlight %} - * `param string` $name the name of the request header - * `param string` $value the value to set it to for subsequent - requests - #### haveInSession - + +* `param array` $data +* `return void` + Set the session to the given array. {% highlight php %} @@ -1194,8 +1392,13 @@ $I->haveInSession(['myKey' => 'MyValue']); #### haveInstance - + +* `param string` $abstract +* `param object` $instance +* `return void` + Add an instance binding to the Laravel service container. + (https://laravel.com/docs/7.x/container) {% highlight php %} @@ -1207,7 +1410,15 @@ $I->haveInstance('App\MyClass', new App\MyClass()); #### haveMultiple - + +* `part` orm +* `see` https://laravel.com/docs/7.x/database-testing#using-factories +* `param string` $model +* `param int` $times +* `param array` $attributes +* `param string` $name +* `return EloquentModel|EloquentCollection` + Use Laravel model factory to create multiple models. {% highlight php %} @@ -1219,15 +1430,17 @@ $I->haveMultiple('App\Models\User', 10, [], 'admin'); {% endhighlight %} -@see https://laravel.com/docs/7.x/database-testing#using-factories - * `return EloquentModel|EloquentCollection` - * `[Part]` orm +#### haveRecord +* `part` orm +* `param string` $table +* `param array` $attributes +* `throws RuntimeException` +* `return EloquentModel|int` -#### haveRecord - Inserts record into the database. + If you pass the name of a database table as the first argument, this method returns an integer ID. You can also pass the class name of an Eloquent model, in that case this method returns an Eloquent model. @@ -1239,15 +1452,13 @@ $user = $I->haveRecord('App\Models\User', ['name' => 'Davert']); // returns Eloq {% endhighlight %} - * `param string` $table - * `param array` $attributes - * `return EloquentModel|int` -@throws RuntimeException - * `[Part]` orm - #### haveServerParameter - + +* `param string` $name +* `param string` $value +* `return void` + Sets SERVER parameter valid for all next requests. {% highlight php %} @@ -1258,8 +1469,13 @@ $I->haveServerParameter('name', 'value'); #### haveSingleton - + +* `param string` $abstract +* `param Closure|string|null` $concrete +* `return void` + Add a singleton binding to the Laravel service container. + (https://laravel.com/docs/7.x/container) {% highlight php %} @@ -1269,12 +1485,11 @@ $I->haveSingleton('App\MyInterface', 'App\MySingleton'); {% endhighlight %} - * `param string` $abstract - * `param Closure|string|null` $concrete - #### logout - + +* `return void` + Logout user. {% highlight php %} @@ -1286,7 +1501,14 @@ $I->logout(); #### make - + +* `part` orm +* `see` https://laravel.com/docs/7.x/database-testing#using-factories +* `param string` $model +* `param array` $attributes +* `param string` $name +* `return EloquentCollection|EloquentModel` + Use Laravel model factory to make a model instance. {% highlight php %} @@ -1298,14 +1520,12 @@ $I->make('App\Models\User', [], 'admin'); {% endhighlight %} -@see https://laravel.com/docs/7.x/database-testing#using-factories - * `return EloquentCollection|EloquentModel` - * `[Part]` orm +#### makeHtmlSnapshot +* `param ?string` $name +* `return void` -#### makeHtmlSnapshot - Use this method within an [interactive pause](https://codeception.com/docs/02-GettingStarted#Interactive-Pause) to save the HTML source code of the current page. {% highlight php %} @@ -1320,7 +1540,15 @@ $I->makeHtmlSnapshot(); #### makeMultiple - + +* `part` orm +* `see` https://laravel.com/docs/7.x/database-testing#using-factories +* `param string` $model +* `param int` $times +* `param array` $attributes +* `param string` $name +* `return EloquentCollection|EloquentModel` + Use Laravel model factory to make multiple model instances. {% highlight php %} @@ -1332,29 +1560,32 @@ $I->makeMultiple('App\Models\User', 10, [], 'admin'); {% endhighlight %} -@see https://laravel.com/docs/7.x/database-testing#using-factories - * `return EloquentCollection|EloquentModel` - * `[Part]` orm +#### moveBack +* `param int` $numberOfSteps (default value 1) +* `return void` -#### moveBack - Moves back in history. - * `param int` $numberOfSteps (default value 1) - #### resetCookie - + +* `param ` $cookie +* `param ` $params +* `return mixed|void` + Unsets cookie with the given name. -You can set additional cookie params like `domain`, `path` in array passed as last argument. - * `return mixed|void` +You can set additional cookie params like `domain`, `path` in array passed as last argument. #### see - + +* `param array|string` $selector optional +* `param string` $text +* `return void` + 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 @@ -1384,11 +1615,12 @@ But will *not* be true for strings like: For checking the raw source code, use `seeInSource()`. - * `param array|string` $selector optional - #### seeAuthentication - + +* `param ?string` $guardName +* `return void` + Checks that a user is authenticated. {% highlight php %} @@ -1400,7 +1632,10 @@ $I->seeAuthentication(); #### seeCheckboxIsChecked - + +* `param ` $checkbox +* `return void` + Checks that the specified checkbox is checked. {% highlight php %} @@ -1414,8 +1649,13 @@ $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); #### seeCookie - + +* `param ` $cookie +* `param ` $params +* `return mixed|void` + Checks that a cookie with the given name is set. + You can set additional cookie params like `domain`, `path` as array passed in last argument. {% highlight php %} @@ -1425,11 +1665,12 @@ $I->seeCookie('PHPSESSID'); {% endhighlight %} - * `return mixed|void` - #### seeCurrentActionIs - + +* `param string` $action +* `return void` + Checks that current url matches action {% highlight php %} @@ -1445,7 +1686,10 @@ $I->seeCurrentActionIs(PostsController::class . '@index'); #### seeCurrentRouteIs - + +* `param string` $routeName +* `return void` + Checks that current url matches route {% highlight php %} @@ -1457,8 +1701,12 @@ $I->seeCurrentRouteIs('posts.index'); #### seeCurrentUrlEquals - + +* `param string` $uri +* `return void` + Checks that the current URL is equal to the given string. + Unlike `seeInCurrentUrl`, this only matches the full URL. {% highlight php %} @@ -1471,7 +1719,10 @@ $I->seeCurrentUrlEquals('/'); #### seeCurrentUrlMatches - + +* `param string` $uri +* `return void` + Checks that the current URL matches the given regular expression. {% highlight php %} @@ -1484,8 +1735,13 @@ $I->seeCurrentUrlMatches('~^/users/(\d+)~'); #### seeElement - + +* `param ` $selector +* `param array` $attributes +* `return void` + Checks that the given element exists on the page and is visible. + You can also specify expected attributes of this element. {% highlight php %} @@ -1503,7 +1759,10 @@ $I->seeElement(['css' => 'form input'], ['name' => 'login']); #### seeEventTriggered - + +* `param string|object|string[]` $expected +* `return void` + Make sure events fired during the test. {% highlight php %} @@ -1514,11 +1773,14 @@ $I->seeEventTriggered(new App\Events\MyEvent()); $I->seeEventTriggered(['App\MyEvent', 'App\MyOtherEvent']); {% endhighlight %} - * `param string|object|string[]` $expected #### seeFormErrorMessage - + +* `param string` $field +* `param ?string` $errorMessage +* `return void` + Assert that a specific form error message is set in the view. If you want to assert that there is a form error message for a specific key @@ -1537,7 +1799,10 @@ $I->seeFormErrorMessage('username', 'Invalid Username'); #### seeFormErrorMessages - + +* `param array` $expectedErrors +* `return void` + Verifies that multiple fields on a form have errors. This method will validate that the expected error message @@ -1571,7 +1836,9 @@ $I->seeFormErrorMessages([ #### seeFormHasErrors - + +* `return void` + Assert that form errors are bound to the View. {% highlight php %} @@ -1583,7 +1850,10 @@ $I->seeFormHasErrors(); #### seeInCurrentUrl - + +* `param string` $uri +* `return void` + Checks that current URI contains the given string. {% highlight php %} @@ -1598,8 +1868,13 @@ $I->seeInCurrentUrl('/users/'); #### seeInField - + +* `param string|array` $field +* `param ` $value +* `return void` + Checks that the given input field or textarea *equals* (i.e. not just contains) the given value. + Fields are matched by label text, the "name" attribute, CSS, or XPath. {% highlight php %} @@ -1614,11 +1889,13 @@ $I->seeInField(['name' => 'search'], 'Search'); {% endhighlight %} - * `param string|array` $field - #### seeInFormFields - + +* `param ` $formSelector +* `param array` $params +* `return void` + Checks if the array of form parameters (name => value) are set on the form matched with the passed selector. @@ -1682,7 +1959,11 @@ $I->seeInFormFields('//form[@id=my-form]', string $form); #### seeInSession - + +* `param string|array` $key +* `param mixed|null` $value +* `return void` + Assert that a session variable exists. {% highlight php %} @@ -1693,12 +1974,12 @@ $I->seeInSession('key', 'value'); {% endhighlight %} - * `param string|array` $key - * `param mixed|null` $value - #### seeInSource - + +* `param string` $raw +* `return void` + Checks that the current page contains the given string in its raw source code. @@ -1711,7 +1992,10 @@ $I->seeInSource('

Green eggs & ham

'); #### seeInTitle - + +* `param ` $title +* `return mixed|void` + Checks that the page title contains the given string. {% highlight php %} @@ -1721,12 +2005,15 @@ $I->seeInTitle('Blog - Post #1'); {% endhighlight %} - * `return mixed|void` - #### seeLink - + +* `param string` $text +* `param ?string` $url +* `return void` + Checks that there's a link with the specified text. + Give a full URL as the second parameter to match links with that exact URL. {% highlight php %} @@ -1739,8 +2026,15 @@ $I->seeLink('Logout','/logout'); // matches Logout #### seeNumRecords - + +* `part` orm +* `param int` $expectedNum +* `param string` $table +* `param array` $attributes +* `return void` + Checks that number of given records were found in database. + You can pass the name of a database table or the class name of an Eloquent model as the first argument. {% highlight php %} @@ -1751,11 +2045,13 @@ $I->seeNumRecords(1, 'App\Models\User', ['name' => 'Davert']); {% endhighlight %} - * `[Part]` orm - #### seeNumberOfElements - + +* `param int|int[]` $expected +* `param ` $selector +* `return void` + Checks that there are a certain number of elements matched by the given locator on the page. {% highlight php %} @@ -1766,11 +2062,13 @@ $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements {% endhighlight %} - * `param int|int[]` $expected - #### seeOptionIsSelected - + +* `param ` $selector +* `param ` $optionText +* `return mixed|void` + Checks that the given option is selected. {% highlight php %} @@ -1780,17 +2078,23 @@ $I->seeOptionIsSelected('#form input[name=payment]', 'Visa'); {% endhighlight %} - * `return mixed|void` - #### seePageNotFound - + +* `return void` + Asserts that current page has 404 response status code. #### seeRecord - + +* `part` orm +* `param string|class-string|object` $table +* `param array` $attributes +* `return void` + Checks that record exists in database. + You can pass the name of a database table or the class name of an Eloquent model as the first argument. {% highlight php %} @@ -1802,13 +2106,12 @@ $I->seeRecord('App\Models\User', ['name' => 'Davert']); {% endhighlight %} - * `param string|class-string|object` $table - * `param array` $attributes - * `[Part]` orm - #### seeResponseCodeIs - + +* `param int` $code +* `return void` + Checks that response code is equal to value provided. {% highlight php %} @@ -1823,32 +2126,47 @@ $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK); #### seeResponseCodeIsBetween - + +* `param int` $from +* `param int` $to +* `return void` + Checks that response code is between a certain range. Between actually means [from <= CODE <= to] #### seeResponseCodeIsClientError - + +* `return void` + Checks that the response code is 4xx #### seeResponseCodeIsRedirection - + +* `return void` + Checks that the response code 3xx #### seeResponseCodeIsServerError - + +* `return void` + Checks that the response code is 5xx #### seeResponseCodeIsSuccessful - + +* `return void` + Checks that the response code 2xx #### seeSessionHasValues - + +* `param array` $bindings +* `return void` + Assert that the session has a given list of values. {% highlight php %} @@ -1861,14 +2179,19 @@ $I->seeSessionHasValues(['key1' => 'value1', 'key2' => 'value2']); #### seedDatabase - -Seed a given database connection. - * `param class-string|class-string[]` $seeders +* `param class-string|class-string[]` $seeders +* `return void` + +Seed a given database connection. #### selectOption - + +* `param ` $select +* `param ` $option +* `return void` + Selects an option in a select tag or in radio button group. {% highlight php %} @@ -1901,14 +2224,24 @@ $I->selectOption('Which OS do you use?', array('value' => 'windows')); // Only s #### sendAjaxGetRequest - + +* `param string` $uri +* `param array` $params +* `return void` + Sends an ajax GET request with the passed parameters. + See `sendAjaxPostRequest()` #### sendAjaxPostRequest - + +* `param string` $uri +* `param array` $params +* `return void` + Sends an ajax POST request with the passed parameters. + The appropriate HTTP header is added automatically: `X-Requested-With: XMLHttpRequest` Example: @@ -1933,8 +2266,14 @@ $I->sendAjaxPostRequest('/add-task', ['form' => [ #### sendAjaxRequest - + +* `param string` $method +* `param string` $uri +* `param array` $params +* `return void` + Sends an ajax request, using the passed HTTP method. + See `sendAjaxPostRequest()` Example: {% highlight php %} @@ -1946,12 +2285,20 @@ $I->sendAjaxRequest('PUT', '/posts/7', ['title' => 'new title']); #### setApplication -__not documented__ + +* `param \Illuminate\Contracts\Foundation\Application` $app +* `return void` #### setCookie - + +* `param ` $name +* `param ` $val +* `param ` $params +* `return mixed|void` + Sets a cookie with the given name and value. + You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument. {% highlight php %} @@ -1961,11 +2308,12 @@ $I->setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3'); {% endhighlight %} - * `return mixed|void` - #### setMaxRedirects - + +* `param int` $maxRedirects +* `return void` + Sets the maximum number of redirects that the Client can follow. {% highlight php %} @@ -1977,8 +2325,12 @@ $I->setMaxRedirects(2); #### setServerParameters - + +* `param array` $params +* `return void` + Sets SERVER parameters valid for all next requests. + this will remove old ones. {% highlight php %} @@ -1989,7 +2341,9 @@ $I->setServerParameters([]); #### startFollowingRedirects - + +* `return void` + Enables automatic redirects to be followed by the client. {% highlight php %} @@ -2001,7 +2355,9 @@ $I->startFollowingRedirects(); #### stopFollowingRedirects - + +* `return void` + Prevents automatic redirects to be followed by the client. {% highlight php %} @@ -2013,7 +2369,12 @@ $I->stopFollowingRedirects(); #### submitForm - + +* `param ` $selector +* `param array` $params +* `param ?string` $button +* `return void` + Submits the given form on the page, with the given form values. Pass the form field's values as an array in the second parameter. @@ -2203,7 +2564,10 @@ $I->submitForm('#my-form', [ #### switchToIframe - + +* `param string` $name +* `return void` + Switch to iframe or frame on the page. Example: @@ -2223,7 +2587,10 @@ $I->switchToIframe("another_frame"); #### uncheckOption - + +* `param ` $option +* `return void` + Unticks a checkbox. {% highlight php %} diff --git a/docs/modules/Lumen.md b/docs/modules/Lumen.md index 8529f5b2f..bf9360791 100644 --- a/docs/modules/Lumen.md +++ b/docs/modules/Lumen.md @@ -74,7 +74,11 @@ for general information on how to load parts of a framework module. #### _findElements *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param mixed` $locator +* `return iterable` + Locates element using available Codeception locator types: * XPath @@ -98,11 +102,14 @@ WebDriver module returns `Facebook\WebDriver\Remote\RemoteWebElement` instances PhpBrowser and Framework modules return `Symfony\Component\DomCrawler\Crawler` instances - #### _getResponseContent *hidden API method, expected to be used from Helper classes* - + +* `api` +* `throws ModuleException` +* `return string` + Returns content of the last response Use it in Helpers when you want to retrieve response of request performed by another module. @@ -117,14 +124,22 @@ public function seeResponseContains($text) {% endhighlight %} -@throws ModuleException - #### _loadPage *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param string` $method +* `param string` $uri +* `param array` $parameters +* `param array` $files +* `param array` $server +* `param ?string` $content +* `return void` + Opens a page with arbitrary request parameters. + Useful for testing multi-step forms on a specific step. {% highlight php %} @@ -138,12 +153,23 @@ public function openCheckoutFormStep2($orderId) { {% endhighlight %} - #### _request *hidden API method, expected to be used from Helper classes* - + +* `api` +* `see` `_loadPage` +* `param string` $method +* `param string` $uri +* `param array` $parameters +* `param array` $files +* `param array` $server +* `param ?string` $content +* `throws ExternalUrlException|ModuleException` +* `return ?string` + Send custom request to a backend using method, uri, parameters, etc. + Use it in Helpers to create special request actions, like accessing API Returns a string with response body. @@ -161,14 +187,15 @@ public function createUserByApi($name) { Does not load the response into the module so you can't interact with response page (click, fill forms). To load arbitrary page for interaction, use `_loadPage` method. -@throws ExternalUrlException|ModuleException -@see `_loadPage` - #### _savePageSource *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param string` $filename +* `return void` + Saves page source of to a file {% highlight php %} @@ -179,18 +206,30 @@ $this->getModule('Lumen')->_savePageSource(codecept_output_dir().'page.html'); #### amHttpAuthenticated - + +* `param string` $username +* `param string` $password +* `return void` + Authenticates user for HTTP_AUTH #### amLoggedAs - + +* `param \Illuminate\Contracts\Auth\Authenticatable` $user +* `param ?string` $guardName +* `return void` + Set the authenticated user for the next request. + This will not persist between multiple requests. #### amOnPage - + +* `param string` $page +* `return void` + Opens the page for the given relative URI. {% highlight php %} @@ -205,7 +244,11 @@ $I->amOnPage('/register'); #### amOnRoute - + +* `param string` $routeName +* `param array` $params +* `return void` + Opens web page using route name and parameters. {% highlight php %} @@ -217,7 +260,11 @@ $I->amOnRoute('homepage'); #### attachFile - + +* `param ` $field +* `param string` $filename +* `return void` + Attaches a file relative to the Codeception `_data` directory to the given file upload field. {% highlight php %} @@ -230,7 +277,10 @@ $I->attachFile('input[@type="file"]', 'prices.xls'); #### checkOption - + +* `param ` $option +* `return void` + Ticks a checkbox. For radio buttons, use the `selectOption` method instead. {% highlight php %} @@ -242,7 +292,9 @@ $I->checkOption('#agree'); #### clearApplicationHandlers - + +* `return void` + Clear the registered application handlers. {% highlight php %} @@ -254,8 +306,13 @@ $I->clearApplicationHandlers(); #### click - + +* `param string|array` $link +* `param ` $context +* `return void` + 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. @@ -282,11 +339,13 @@ $I->click('Logout', '#nav'); $I->click(['link' => 'Login']); {% endhighlight %} - * `param string|array` $link #### deleteHeader - + +* `param string` $name the name of the header to delete. +* `return void` + Deletes the header with the passed name. Subsequent requests will not have the deleted header in its request. @@ -302,12 +361,15 @@ $I->amOnPage('some-other-page.php'); {% endhighlight %} - * `param string` $name the name of the header to delete. - #### dontSee - + +* `param array|string` $selector optional +* `param string` $text +* `return void` + Checks that the current page doesn't contain the text specified (case insensitive). + Give a locator as the second parameter to match a specific region. {% highlight php %} @@ -334,16 +396,19 @@ But will ignore strings like: For checking the raw source code, use `seeInSource()`. - * `param array|string` $selector optional - #### dontSeeAuthentication - + +* `return void` + Check that user is not authenticated. #### dontSeeCheckboxIsChecked - + +* `param ` $checkbox +* `return void` + Check that the specified checkbox is unchecked. {% highlight php %} @@ -356,16 +421,23 @@ $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user #### dontSeeCookie - + +* `param ` $cookie +* `param ` $params +* `return mixed|void` + Checks that there isn't a cookie with the given name. -You can set additional cookie params like `domain`, `path` as array passed in last argument. - * `return mixed|void` +You can set additional cookie params like `domain`, `path` as array passed in last argument. #### dontSeeCurrentUrlEquals - + +* `param string` $uri +* `return void` + Checks that the current URL doesn't equal the given string. + Unlike `dontSeeInCurrentUrl`, this only matches the full URL. {% highlight php %} @@ -378,7 +450,10 @@ $I->dontSeeCurrentUrlEquals('/'); #### dontSeeCurrentUrlMatches - + +* `param string` $uri +* `return void` + Checks that current url doesn't match the given regular expression. {% highlight php %} @@ -391,8 +466,13 @@ $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~'); #### dontSeeElement - + +* `param ` $selector +* `param array` $attributes +* `return void` + Checks that the given element is invisible or not present on the page. + You can also specify expected attributes of this element. {% highlight php %} @@ -407,7 +487,10 @@ $I->dontSeeElement('input', ['value' => '123456']); #### dontSeeInCurrentUrl - + +* `param string` $uri +* `return void` + Checks that the current URI doesn't contain the given string. {% highlight php %} @@ -419,8 +502,13 @@ $I->dontSeeInCurrentUrl('/users/'); #### dontSeeInField - + +* `param string|array` $field +* `param ` $value +* `return void` + Checks that an input field or textarea doesn't contain the given value. + For fuzzy locators, the field is matched by label text, CSS and XPath. {% highlight php %} @@ -434,11 +522,14 @@ $I->dontSeeInField('//form/*[@name=search]','Search'); $I->dontSeeInField(['name' => 'search'], 'Search'); {% endhighlight %} - * `param string|array` $field #### dontSeeInFormFields - + +* `param ` $formSelector +* `param array` $params +* `return void` + Checks if the array of form parameters (name => value) are not set on the form matched with the passed selector. @@ -481,7 +572,10 @@ $I->dontSeeInFormFields('#form-id', [ #### dontSeeInSource - + +* `param string` $raw +* `return void` + Checks that the current page contains the given string in its raw source code. @@ -494,15 +588,21 @@ $I->dontSeeInSource('

Green eggs & ham

'); #### dontSeeInTitle - -Checks that the page title does not contain the given string. - * `return mixed|void` +* `param ` $title +* `return mixed|void` + +Checks that the page title does not contain the given string. #### dontSeeLink - + +* `param string` $text +* `param string` $url +* `return void` + Checks that the page doesn't contain a link with the given string. + If the second parameter is given, only links with a matching "href" attribute will be checked. {% highlight php %} @@ -515,7 +615,11 @@ $I->dontSeeLink('Checkout now', '/store/cart.php'); #### dontSeeOptionIsSelected - + +* `param ` $selector +* `param ` $optionText +* `return mixed|void` + Checks that the given option is not selected. {% highlight php %} @@ -525,12 +629,16 @@ $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); {% endhighlight %} - * `return mixed|void` - #### dontSeeRecord - + +* `part` orm +* `param string` $table +* `param array` $attributes +* `return void` + Checks that record does not exist in database. + You can pass the name of a database table or the class name of an Eloquent model as the first argument. {% highlight php %} @@ -541,11 +649,12 @@ $I->dontSeeRecord('App\Models\User', ['name' => 'davert']); {% endhighlight %} - * `[Part]` orm - #### dontSeeResponseCodeIs - + +* `param int` $code +* `return void` + Checks that response code is equal to value provided. {% highlight php %} @@ -560,7 +669,11 @@ $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK); #### fillField - + +* `param ` $field +* `param ` $value +* `return void` + Fills a text field or textarea with the given string. {% highlight php %} @@ -573,7 +686,9 @@ $I->fillField(['name' => 'email'], 'jon@example.com'); #### followRedirect - + +* `return void` + Follow pending redirect if there is one. {% highlight php %} @@ -585,13 +700,20 @@ $I->followRedirect(); #### getApplication - + +* `return \Laravel\Lumen\Application` + Provides access the Lumen application object. #### grabAttributeFrom - + +* `param ` $cssOrXpath +* `param string` $attribute +* `return mixed` + Grabs the value of the given attribute value from the given element. + Fails if element is not found. {% highlight php %} @@ -603,15 +725,24 @@ $I->grabAttributeFrom('#tooltip', 'title'); #### grabCookie - + +* `param string` $cookie +* `param array` $params +* `return mixed` + Grabs a cookie value. + You can set additional cookie params like `domain`, `path` in array passed as last argument. If the cookie is set by an ajax request (XMLHttpRequest), there might be some delay caused by the browser, so try `$I->wait(0.1)`. #### grabFromCurrentUrl - + +* `param ?string` $uri +* `return mixed` + Executes the given regular expression against the current URI and returns the first capturing group. + If no parameters are provided, the full URI is returned. {% highlight php %} @@ -624,7 +755,11 @@ $uri = $I->grabFromCurrentUrl(); #### grabMultiple - + +* `param ` $cssOrXpath +* `param ?string` $attribute +* `return string[]` + Grabs either the text content, or attribute values, of nodes matched by $cssOrXpath and returns them as an array. @@ -647,21 +782,25 @@ $aLinks = $I->grabMultiple('a', 'href'); {% endhighlight %} - * `return string[]` - #### grabPageSource - -Grabs current page source code. -@throws ModuleException if no page was opened. - * `return string` Current page source code. +* `throws ModuleException` if no page was opened. +* `return string` Current page source code. + +Grabs current page source code. #### grabRecord - + +* `part` orm +* `param string` $table +* `param array` $attributes +* `return array|EloquentModel` + Retrieves record from database If you pass the name of a database table as the first argument, this method returns an array. + You can also pass the class name of an Eloquent model, in that case this method returns an Eloquent model. {% highlight php %} @@ -672,12 +811,12 @@ $record = $I->grabRecord('App\Models\User', ['name' => 'davert']); // returns El {% endhighlight %} - * `return array|EloquentModel` - * `[Part]` orm - #### grabService - + +* `param string` $class +* `return mixed` + Return an instance of a class from the IoC Container. Example @@ -699,8 +838,12 @@ $service = $I->grabService('foo'); #### grabTextFrom - + +* `param ` $cssOrXPathOrRegex +* `return mixed` + Finds and returns the text contents of the given element. + If a fuzzy locator is used, the element is found using CSS, XPath, and by matching the full page source by regular expression. @@ -715,8 +858,12 @@ $value = $I->grabTextFrom('~grabValueFrom(['name' => 'username']); #### have - + +* `part` orm +* `see` https://lumen.laravel.com/docs/master/testing#model-factories +* `param string` $model +* `param array` $attributes +* `param string` $name +* `return mixed` + Use Lumen's model factory to create a model. {% highlight php %} @@ -743,13 +897,14 @@ $I->have('App\Models\User', [], 'admin'); {% endhighlight %} -@see https://lumen.laravel.com/docs/master/testing#model-factories - * `[Part]` orm - #### haveApplicationHandler - + +* `param ` $handler +* `return void` + Register a handler than can be used to modify the Laravel application object after it is initialized. + The Laravel application object will be passed as an argument to the handler. {% highlight php %} @@ -763,8 +918,13 @@ $I->haveApplicationHandler(function($app) { #### haveBinding - + +* `param ` $abstract +* `param ` $concrete +* `return void` + Add a binding to the Laravel service container. + (https://laravel.com/docs/master/container) {% highlight php %} @@ -776,8 +936,14 @@ $I->haveBinding('App\MyInterface', 'App\MyImplementation'); #### haveContextualBinding - + +* `param ` $concrete +* `param ` $abstract +* `param ` $implementation +* `return void` + Add a contextual binding to the Laravel service container. + (https://laravel.com/docs/master/container) {% highlight php %} @@ -794,7 +960,12 @@ $app->when('App\MyClass') #### haveHttpHeader - + +* `param string` $name the name of the request header +* `param string` $value the value to set it to for subsequent + requests +* `return void` + Sets the HTTP header to the passed value - which is used on subsequent HTTP requests through PhpBrowser. @@ -819,14 +990,15 @@ $I->haveHttpHeader('Client_Id', 'Codeception'); {% endhighlight %} - * `param string` $name the name of the request header - * `param string` $value the value to set it to for subsequent - requests - #### haveInstance - + +* `param ` $abstract +* `param ` $instance +* `return void` + Add an instance binding to the Laravel service container. + (https://laravel.com/docs/master/container) {% highlight php %} @@ -838,7 +1010,15 @@ $I->haveInstance('App\MyClass', new App\MyClass()); #### haveMultiple - + +* `part` orm +* `see` https://lumen.laravel.com/docs/master/testing#model-factories +* `param string` $model +* `param int` $times +* `param array` $attributes +* `param string` $name +* `return mixed` + Use Laravel model factory to create multiple models. {% highlight php %} @@ -850,13 +1030,16 @@ $I->haveMultiple('App\Models\User', 10, [], 'admin'); {% endhighlight %} -@see https://lumen.laravel.com/docs/master/testing#model-factories - * `[Part]` orm - #### haveRecord - + +* `part` orm +* `param ` $table +* `param ` $attributes +* `return integer|EloquentModel` + Inserts record into the database. + If you pass the name of a database table as the first argument, this method returns an integer ID. You can also pass the class name of an Eloquent model, in that case this method returns an Eloquent model. @@ -868,12 +1051,13 @@ $user = $I->haveRecord('App\Models\User', ['name' => 'Davert']); // returns Eloq {% endhighlight %} - * `return integer|EloquentModel` - * `[Part]` orm - #### haveServerParameter - + +* `param string` $name +* `param string` $value +* `return void` + Sets SERVER parameter valid for all next requests. {% highlight php %} @@ -884,8 +1068,13 @@ $I->haveServerParameter('name', 'value'); #### haveSingleton - + +* `param ` $abstract +* `param ` $concrete +* `return void` + Add a singleton binding to the Laravel service container. + (https://laravel.com/docs/master/container) {% highlight php %} @@ -897,7 +1086,14 @@ $I->haveSingleton('My\Interface', 'My\Singleton'); #### make - + +* `part` orm +* `see` https://lumen.laravel.com/docs/master/testing#model-factories +* `param string` $model +* `param array` $attributes +* `param string` $name +* `return mixed` + Use Lumen's model factory to make a model instance. {% highlight php %} @@ -909,12 +1105,12 @@ $I->make('App\Models\User', [], 'admin'); {% endhighlight %} -@see https://lumen.laravel.com/docs/master/testing#model-factories - * `[Part]` orm - #### makeHtmlSnapshot - + +* `param ?string` $name +* `return void` + Use this method within an [interactive pause](https://codeception.com/docs/02-GettingStarted#Interactive-Pause) to save the HTML source code of the current page. {% highlight php %} @@ -929,7 +1125,15 @@ $I->makeHtmlSnapshot(); #### makeMultiple - + +* `part` orm +* `see` https://lumen.laravel.com/docs/master/testing#model-factories +* `param string` $model +* `param int` $times +* `param array` $attributes +* `param string` $name +* `return mixed` + Use Laravel model factory to make multiple model instances. {% highlight php %} @@ -941,27 +1145,32 @@ $I->makeMultiple('App\Models\User', 10, [], 'admin'); {% endhighlight %} -@see https://lumen.laravel.com/docs/master/testing#model-factories - * `[Part]` orm - #### moveBack - -Moves back in history. - * `param int` $numberOfSteps (default value 1) +* `param int` $numberOfSteps (default value 1) +* `return void` + +Moves back in history. #### resetCookie - + +* `param ` $cookie +* `param ` $params +* `return mixed|void` + Unsets cookie with the given name. -You can set additional cookie params like `domain`, `path` in array passed as last argument. - * `return mixed|void` +You can set additional cookie params like `domain`, `path` in array passed as last argument. #### see - + +* `param array|string` $selector optional +* `param string` $text +* `return void` + 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 @@ -991,16 +1200,19 @@ But will *not* be true for strings like: For checking the raw source code, use `seeInSource()`. - * `param array|string` $selector optional - #### seeAuthentication - + +* `return void` + Checks that user is authenticated. #### seeCheckboxIsChecked - + +* `param ` $checkbox +* `return void` + Checks that the specified checkbox is checked. {% highlight php %} @@ -1014,8 +1226,13 @@ $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); #### seeCookie - + +* `param ` $cookie +* `param ` $params +* `return mixed|void` + Checks that a cookie with the given name is set. + You can set additional cookie params like `domain`, `path` as array passed in last argument. {% highlight php %} @@ -1025,12 +1242,14 @@ $I->seeCookie('PHPSESSID'); {% endhighlight %} - * `return mixed|void` - #### seeCurrentUrlEquals - + +* `param string` $uri +* `return void` + Checks that the current URL is equal to the given string. + Unlike `seeInCurrentUrl`, this only matches the full URL. {% highlight php %} @@ -1043,7 +1262,10 @@ $I->seeCurrentUrlEquals('/'); #### seeCurrentUrlMatches - + +* `param string` $uri +* `return void` + Checks that the current URL matches the given regular expression. {% highlight php %} @@ -1056,8 +1278,13 @@ $I->seeCurrentUrlMatches('~^/users/(\d+)~'); #### seeElement - + +* `param ` $selector +* `param array` $attributes +* `return void` + Checks that the given element exists on the page and is visible. + You can also specify expected attributes of this element. {% highlight php %} @@ -1075,7 +1302,10 @@ $I->seeElement(['css' => 'form input'], ['name' => 'login']); #### seeInCurrentUrl - + +* `param string` $uri +* `return void` + Checks that current URI contains the given string. {% highlight php %} @@ -1090,8 +1320,13 @@ $I->seeInCurrentUrl('/users/'); #### seeInField - + +* `param string|array` $field +* `param ` $value +* `return void` + Checks that the given input field or textarea *equals* (i.e. not just contains) the given value. + Fields are matched by label text, the "name" attribute, CSS, or XPath. {% highlight php %} @@ -1106,11 +1341,13 @@ $I->seeInField(['name' => 'search'], 'Search'); {% endhighlight %} - * `param string|array` $field - #### seeInFormFields - + +* `param ` $formSelector +* `param array` $params +* `return void` + Checks if the array of form parameters (name => value) are set on the form matched with the passed selector. @@ -1174,7 +1411,10 @@ $I->seeInFormFields('//form[@id=my-form]', string $form); #### seeInSource - + +* `param string` $raw +* `return void` + Checks that the current page contains the given string in its raw source code. @@ -1187,7 +1427,10 @@ $I->seeInSource('

Green eggs & ham

'); #### seeInTitle - + +* `param ` $title +* `return mixed|void` + Checks that the page title contains the given string. {% highlight php %} @@ -1197,12 +1440,15 @@ $I->seeInTitle('Blog - Post #1'); {% endhighlight %} - * `return mixed|void` - #### seeLink - + +* `param string` $text +* `param ?string` $url +* `return void` + Checks that there's a link with the specified text. + Give a full URL as the second parameter to match links with that exact URL. {% highlight php %} @@ -1215,7 +1461,11 @@ $I->seeLink('Logout','/logout'); // matches Logout #### seeNumberOfElements - + +* `param int|int[]` $expected +* `param ` $selector +* `return void` + Checks that there are a certain number of elements matched by the given locator on the page. {% highlight php %} @@ -1226,11 +1476,13 @@ $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements {% endhighlight %} - * `param int|int[]` $expected - #### seeOptionIsSelected - + +* `param ` $selector +* `param ` $optionText +* `return mixed|void` + Checks that the given option is selected. {% highlight php %} @@ -1240,17 +1492,23 @@ $I->seeOptionIsSelected('#form input[name=payment]', 'Visa'); {% endhighlight %} - * `return mixed|void` - #### seePageNotFound - + +* `return void` + Asserts that current page has 404 response status code. #### seeRecord - + +* `part` orm +* `param string` $table +* `param array` $attributes +* `return void` + Checks that record exists in database. + You can pass the name of a database table or the class name of an Eloquent model as the first argument. {% highlight php %} @@ -1262,11 +1520,12 @@ $I->seeRecord('App\Models\User', ['name' => 'Davert']); {% endhighlight %} - * `[Part]` orm - #### seeResponseCodeIs - + +* `param int` $code +* `return void` + Checks that response code is equal to value provided. {% highlight php %} @@ -1281,32 +1540,48 @@ $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK); #### seeResponseCodeIsBetween - + +* `param int` $from +* `param int` $to +* `return void` + Checks that response code is between a certain range. Between actually means [from <= CODE <= to] #### seeResponseCodeIsClientError - + +* `return void` + Checks that the response code is 4xx #### seeResponseCodeIsRedirection - + +* `return void` + Checks that the response code 3xx #### seeResponseCodeIsServerError - + +* `return void` + Checks that the response code is 5xx #### seeResponseCodeIsSuccessful - + +* `return void` + Checks that the response code 2xx #### selectOption - + +* `param ` $select +* `param ` $option +* `return void` + Selects an option in a select tag or in radio button group. {% highlight php %} @@ -1339,14 +1614,24 @@ $I->selectOption('Which OS do you use?', array('value' => 'windows')); // Only s #### sendAjaxGetRequest - + +* `param string` $uri +* `param array` $params +* `return void` + Sends an ajax GET request with the passed parameters. + See `sendAjaxPostRequest()` #### sendAjaxPostRequest - + +* `param string` $uri +* `param array` $params +* `return void` + Sends an ajax POST request with the passed parameters. + The appropriate HTTP header is added automatically: `X-Requested-With: XMLHttpRequest` Example: @@ -1371,8 +1656,14 @@ $I->sendAjaxPostRequest('/add-task', ['form' => [ #### sendAjaxRequest - + +* `param string` $method +* `param string` $uri +* `param array` $params +* `return void` + Sends an ajax request, using the passed HTTP method. + See `sendAjaxPostRequest()` Example: {% highlight php %} @@ -1384,12 +1675,20 @@ $I->sendAjaxRequest('PUT', '/posts/7', ['title' => 'new title']); #### setApplication -__not documented__ + +* `param \Laravel\Lumen\Application` $app +* `return void` #### setCookie - + +* `param ` $name +* `param ` $val +* `param ` $params +* `return mixed|void` + Sets a cookie with the given name and value. + You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument. {% highlight php %} @@ -1399,11 +1698,12 @@ $I->setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3'); {% endhighlight %} - * `return mixed|void` - #### setMaxRedirects - + +* `param int` $maxRedirects +* `return void` + Sets the maximum number of redirects that the Client can follow. {% highlight php %} @@ -1415,8 +1715,12 @@ $I->setMaxRedirects(2); #### setServerParameters - + +* `param array` $params +* `return void` + Sets SERVER parameters valid for all next requests. + this will remove old ones. {% highlight php %} @@ -1427,7 +1731,9 @@ $I->setServerParameters([]); #### startFollowingRedirects - + +* `return void` + Enables automatic redirects to be followed by the client. {% highlight php %} @@ -1439,7 +1745,9 @@ $I->startFollowingRedirects(); #### stopFollowingRedirects - + +* `return void` + Prevents automatic redirects to be followed by the client. {% highlight php %} @@ -1451,7 +1759,12 @@ $I->stopFollowingRedirects(); #### submitForm - + +* `param ` $selector +* `param array` $params +* `param ?string` $button +* `return void` + Submits the given form on the page, with the given form values. Pass the form field's values as an array in the second parameter. @@ -1641,7 +1954,10 @@ $I->submitForm('#my-form', [ #### switchToIframe - + +* `param string` $name +* `return void` + Switch to iframe or frame on the page. Example: @@ -1661,7 +1977,10 @@ $I->switchToIframe("another_frame"); #### uncheckOption - + +* `param ` $option +* `return void` + Unticks a checkbox. {% highlight php %} diff --git a/docs/modules/Memcache.md b/docs/modules/Memcache.md index c14627f5d..4a474c5c7 100644 --- a/docs/modules/Memcache.md +++ b/docs/modules/Memcache.md @@ -67,12 +67,18 @@ Be sure you don't use the production server to connect. ### Actions #### clearMemcache - + +* `return void` + Flushes all Memcached data. #### dontSeeInMemcached - + +* `param string` $key +* `param mixed` $value +* `return void` + Checks item in Memcached doesn't exist or is the same as expected. Examples: @@ -90,7 +96,10 @@ $I->dontSeeInMemcached('users_count', 200); #### grabValueFromMemcached - + +* `param string` $key +* `return mixed` + Grabs value from memcached by key. Example: @@ -104,12 +113,21 @@ $users_count = $I->grabValueFromMemcached('users_count'); #### haveInMemcached - + +* `param string` $key +* `param mixed` $value +* `param int` $expiration +* `return void` + Stores an item `$value` with `$key` on the Memcached server. #### seeInMemcached - + +* `param string` $key +* `param mixed` $value +* `return void` + Checks item in Memcached exists and the same as expected. Examples: diff --git a/docs/modules/Mezzio.md b/docs/modules/Mezzio.md index 86697dde3..66bb771d8 100644 --- a/docs/modules/Mezzio.md +++ b/docs/modules/Mezzio.md @@ -59,7 +59,11 @@ Uses `config/container.php` file by default. #### _findElements *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param mixed` $locator +* `return iterable` + Locates element using available Codeception locator types: * XPath @@ -83,11 +87,14 @@ WebDriver module returns `Facebook\WebDriver\Remote\RemoteWebElement` instances PhpBrowser and Framework modules return `Symfony\Component\DomCrawler\Crawler` instances - #### _getResponseContent *hidden API method, expected to be used from Helper classes* - + +* `api` +* `throws ModuleException` +* `return string` + Returns content of the last response Use it in Helpers when you want to retrieve response of request performed by another module. @@ -102,14 +109,22 @@ public function seeResponseContains($text) {% endhighlight %} -@throws ModuleException - #### _loadPage *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param string` $method +* `param string` $uri +* `param array` $parameters +* `param array` $files +* `param array` $server +* `param ?string` $content +* `return void` + Opens a page with arbitrary request parameters. + Useful for testing multi-step forms on a specific step. {% highlight php %} @@ -123,12 +138,23 @@ public function openCheckoutFormStep2($orderId) { {% endhighlight %} - #### _request *hidden API method, expected to be used from Helper classes* - + +* `api` +* `see` `_loadPage` +* `param string` $method +* `param string` $uri +* `param array` $parameters +* `param array` $files +* `param array` $server +* `param ?string` $content +* `throws ExternalUrlException|ModuleException` +* `return ?string` + Send custom request to a backend using method, uri, parameters, etc. + Use it in Helpers to create special request actions, like accessing API Returns a string with response body. @@ -146,14 +172,15 @@ public function createUserByApi($name) { Does not load the response into the module so you can't interact with response page (click, fill forms). To load arbitrary page for interaction, use `_loadPage` method. -@throws ExternalUrlException|ModuleException -@see `_loadPage` - #### _savePageSource *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param string` $filename +* `return void` + Saves page source of to a file {% highlight php %} @@ -164,12 +191,19 @@ $this->getModule('Mezzio')->_savePageSource(codecept_output_dir().'page.html'); #### amHttpAuthenticated - + +* `param string` $username +* `param string` $password +* `return void` + Authenticates user for HTTP_AUTH #### amOnPage - + +* `param string` $page +* `return void` + Opens the page for the given relative URI. {% highlight php %} @@ -184,7 +218,11 @@ $I->amOnPage('/register'); #### attachFile - + +* `param ` $field +* `param string` $filename +* `return void` + Attaches a file relative to the Codeception `_data` directory to the given file upload field. {% highlight php %} @@ -197,7 +235,10 @@ $I->attachFile('input[@type="file"]', 'prices.xls'); #### checkOption - + +* `param ` $option +* `return void` + Ticks a checkbox. For radio buttons, use the `selectOption` method instead. {% highlight php %} @@ -209,8 +250,13 @@ $I->checkOption('#agree'); #### click - + +* `param string|array` $link +* `param ` $context +* `return void` + 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. @@ -237,11 +283,13 @@ $I->click('Logout', '#nav'); $I->click(['link' => 'Login']); {% endhighlight %} - * `param string|array` $link #### deleteHeader - + +* `param string` $name the name of the header to delete. +* `return void` + Deletes the header with the passed name. Subsequent requests will not have the deleted header in its request. @@ -257,12 +305,15 @@ $I->amOnPage('some-other-page.php'); {% endhighlight %} - * `param string` $name the name of the header to delete. - #### dontSee - + +* `param array|string` $selector optional +* `param string` $text +* `return void` + Checks that the current page doesn't contain the text specified (case insensitive). + Give a locator as the second parameter to match a specific region. {% highlight php %} @@ -289,11 +340,12 @@ But will ignore strings like: For checking the raw source code, use `seeInSource()`. - * `param array|string` $selector optional - #### dontSeeCheckboxIsChecked - + +* `param ` $checkbox +* `return void` + Check that the specified checkbox is unchecked. {% highlight php %} @@ -306,16 +358,23 @@ $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user #### dontSeeCookie - + +* `param ` $cookie +* `param ` $params +* `return mixed|void` + Checks that there isn't a cookie with the given name. -You can set additional cookie params like `domain`, `path` as array passed in last argument. - * `return mixed|void` +You can set additional cookie params like `domain`, `path` as array passed in last argument. #### dontSeeCurrentUrlEquals - + +* `param string` $uri +* `return void` + Checks that the current URL doesn't equal the given string. + Unlike `dontSeeInCurrentUrl`, this only matches the full URL. {% highlight php %} @@ -328,7 +387,10 @@ $I->dontSeeCurrentUrlEquals('/'); #### dontSeeCurrentUrlMatches - + +* `param string` $uri +* `return void` + Checks that current url doesn't match the given regular expression. {% highlight php %} @@ -341,8 +403,13 @@ $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~'); #### dontSeeElement - + +* `param ` $selector +* `param array` $attributes +* `return void` + Checks that the given element is invisible or not present on the page. + You can also specify expected attributes of this element. {% highlight php %} @@ -357,7 +424,10 @@ $I->dontSeeElement('input', ['value' => '123456']); #### dontSeeInCurrentUrl - + +* `param string` $uri +* `return void` + Checks that the current URI doesn't contain the given string. {% highlight php %} @@ -369,8 +439,13 @@ $I->dontSeeInCurrentUrl('/users/'); #### dontSeeInField - + +* `param string|array` $field +* `param ` $value +* `return void` + Checks that an input field or textarea doesn't contain the given value. + For fuzzy locators, the field is matched by label text, CSS and XPath. {% highlight php %} @@ -384,11 +459,14 @@ $I->dontSeeInField('//form/*[@name=search]','Search'); $I->dontSeeInField(['name' => 'search'], 'Search'); {% endhighlight %} - * `param string|array` $field #### dontSeeInFormFields - + +* `param ` $formSelector +* `param array` $params +* `return void` + Checks if the array of form parameters (name => value) are not set on the form matched with the passed selector. @@ -431,7 +509,10 @@ $I->dontSeeInFormFields('#form-id', [ #### dontSeeInSource - + +* `param string` $raw +* `return void` + Checks that the current page contains the given string in its raw source code. @@ -444,15 +525,21 @@ $I->dontSeeInSource('

Green eggs & ham

'); #### dontSeeInTitle - -Checks that the page title does not contain the given string. - * `return mixed|void` +* `param ` $title +* `return mixed|void` + +Checks that the page title does not contain the given string. #### dontSeeLink - + +* `param string` $text +* `param string` $url +* `return void` + Checks that the page doesn't contain a link with the given string. + If the second parameter is given, only links with a matching "href" attribute will be checked. {% highlight php %} @@ -465,7 +552,11 @@ $I->dontSeeLink('Checkout now', '/store/cart.php'); #### dontSeeOptionIsSelected - + +* `param ` $selector +* `param ` $optionText +* `return mixed|void` + Checks that the given option is not selected. {% highlight php %} @@ -475,11 +566,12 @@ $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); {% endhighlight %} - * `return mixed|void` - #### dontSeeResponseCodeIs - + +* `param int` $code +* `return void` + Checks that response code is equal to value provided. {% highlight php %} @@ -494,7 +586,11 @@ $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK); #### fillField - + +* `param ` $field +* `param ` $value +* `return void` + Fills a text field or textarea with the given string. {% highlight php %} @@ -507,7 +603,9 @@ $I->fillField(['name' => 'email'], 'jon@example.com'); #### followRedirect - + +* `return void` + Follow pending redirect if there is one. {% highlight php %} @@ -519,8 +617,13 @@ $I->followRedirect(); #### grabAttributeFrom - + +* `param ` $cssOrXpath +* `param string` $attribute +* `return mixed` + Grabs the value of the given attribute value from the given element. + Fails if element is not found. {% highlight php %} @@ -532,15 +635,24 @@ $I->grabAttributeFrom('#tooltip', 'title'); #### grabCookie - + +* `param string` $cookie +* `param array` $params +* `return mixed` + Grabs a cookie value. + You can set additional cookie params like `domain`, `path` in array passed as last argument. If the cookie is set by an ajax request (XMLHttpRequest), there might be some delay caused by the browser, so try `$I->wait(0.1)`. #### grabFromCurrentUrl - + +* `param ?string` $uri +* `return mixed` + Executes the given regular expression against the current URI and returns the first capturing group. + If no parameters are provided, the full URI is returned. {% highlight php %} @@ -553,7 +665,11 @@ $uri = $I->grabFromCurrentUrl(); #### grabMultiple - + +* `param ` $cssOrXpath +* `param ?string` $attribute +* `return string[]` + Grabs either the text content, or attribute values, of nodes matched by $cssOrXpath and returns them as an array. @@ -576,20 +692,22 @@ $aLinks = $I->grabMultiple('a', 'href'); {% endhighlight %} - * `return string[]` - #### grabPageSource - -Grabs current page source code. -@throws ModuleException if no page was opened. - * `return string` Current page source code. +* `throws ModuleException` if no page was opened. +* `return string` Current page source code. + +Grabs current page source code. #### grabTextFrom - + +* `param ` $cssOrXPathOrRegex +* `return mixed` + Finds and returns the text contents of the given element. + If a fuzzy locator is used, the element is found using CSS, XPath, and by matching the full page source by regular expression. @@ -604,8 +722,12 @@ $value = $I->grabTextFrom('~grabValueFrom(['name' => 'username']); #### haveHttpHeader - + +* `param string` $name the name of the request header +* `param string` $value the value to set it to for subsequent + requests +* `return void` + Sets the HTTP header to the passed value - which is used on subsequent HTTP requests through PhpBrowser. @@ -645,13 +772,13 @@ $I->haveHttpHeader('Client_Id', 'Codeception'); {% endhighlight %} - * `param string` $name the name of the request header - * `param string` $value the value to set it to for subsequent - requests - #### haveServerParameter - + +* `param string` $name +* `param string` $value +* `return void` + Sets SERVER parameter valid for all next requests. {% highlight php %} @@ -662,7 +789,10 @@ $I->haveServerParameter('name', 'value'); #### makeHtmlSnapshot - + +* `param ?string` $name +* `return void` + Use this method within an [interactive pause](https://codeception.com/docs/02-GettingStarted#Interactive-Pause) to save the HTML source code of the current page. {% highlight php %} @@ -677,22 +807,30 @@ $I->makeHtmlSnapshot(); #### moveBack - -Moves back in history. - * `param int` $numberOfSteps (default value 1) +* `param int` $numberOfSteps (default value 1) +* `return void` + +Moves back in history. #### resetCookie - + +* `param ` $cookie +* `param ` $params +* `return mixed|void` + Unsets cookie with the given name. -You can set additional cookie params like `domain`, `path` in array passed as last argument. - * `return mixed|void` +You can set additional cookie params like `domain`, `path` in array passed as last argument. #### see - + +* `param array|string` $selector optional +* `param string` $text +* `return void` + 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 @@ -722,11 +860,12 @@ But will *not* be true for strings like: For checking the raw source code, use `seeInSource()`. - * `param array|string` $selector optional - #### seeCheckboxIsChecked - + +* `param ` $checkbox +* `return void` + Checks that the specified checkbox is checked. {% highlight php %} @@ -740,8 +879,13 @@ $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); #### seeCookie - + +* `param ` $cookie +* `param ` $params +* `return mixed|void` + Checks that a cookie with the given name is set. + You can set additional cookie params like `domain`, `path` as array passed in last argument. {% highlight php %} @@ -751,12 +895,14 @@ $I->seeCookie('PHPSESSID'); {% endhighlight %} - * `return mixed|void` - #### seeCurrentUrlEquals - + +* `param string` $uri +* `return void` + Checks that the current URL is equal to the given string. + Unlike `seeInCurrentUrl`, this only matches the full URL. {% highlight php %} @@ -769,7 +915,10 @@ $I->seeCurrentUrlEquals('/'); #### seeCurrentUrlMatches - + +* `param string` $uri +* `return void` + Checks that the current URL matches the given regular expression. {% highlight php %} @@ -782,8 +931,13 @@ $I->seeCurrentUrlMatches('~^/users/(\d+)~'); #### seeElement - + +* `param ` $selector +* `param array` $attributes +* `return void` + Checks that the given element exists on the page and is visible. + You can also specify expected attributes of this element. {% highlight php %} @@ -801,7 +955,10 @@ $I->seeElement(['css' => 'form input'], ['name' => 'login']); #### seeInCurrentUrl - + +* `param string` $uri +* `return void` + Checks that current URI contains the given string. {% highlight php %} @@ -816,8 +973,13 @@ $I->seeInCurrentUrl('/users/'); #### seeInField - + +* `param string|array` $field +* `param ` $value +* `return void` + Checks that the given input field or textarea *equals* (i.e. not just contains) the given value. + Fields are matched by label text, the "name" attribute, CSS, or XPath. {% highlight php %} @@ -832,11 +994,13 @@ $I->seeInField(['name' => 'search'], 'Search'); {% endhighlight %} - * `param string|array` $field - #### seeInFormFields - + +* `param ` $formSelector +* `param array` $params +* `return void` + Checks if the array of form parameters (name => value) are set on the form matched with the passed selector. @@ -900,7 +1064,10 @@ $I->seeInFormFields('//form[@id=my-form]', string $form); #### seeInSource - + +* `param string` $raw +* `return void` + Checks that the current page contains the given string in its raw source code. @@ -913,7 +1080,10 @@ $I->seeInSource('

Green eggs & ham

'); #### seeInTitle - + +* `param ` $title +* `return mixed|void` + Checks that the page title contains the given string. {% highlight php %} @@ -923,12 +1093,15 @@ $I->seeInTitle('Blog - Post #1'); {% endhighlight %} - * `return mixed|void` - #### seeLink - + +* `param string` $text +* `param ?string` $url +* `return void` + Checks that there's a link with the specified text. + Give a full URL as the second parameter to match links with that exact URL. {% highlight php %} @@ -941,7 +1114,11 @@ $I->seeLink('Logout','/logout'); // matches Logout #### seeNumberOfElements - + +* `param int|int[]` $expected +* `param ` $selector +* `return void` + Checks that there are a certain number of elements matched by the given locator on the page. {% highlight php %} @@ -952,11 +1129,13 @@ $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements {% endhighlight %} - * `param int|int[]` $expected - #### seeOptionIsSelected - + +* `param ` $selector +* `param ` $optionText +* `return mixed|void` + Checks that the given option is selected. {% highlight php %} @@ -966,16 +1145,19 @@ $I->seeOptionIsSelected('#form input[name=payment]', 'Visa'); {% endhighlight %} - * `return mixed|void` - #### seePageNotFound - + +* `return void` + Asserts that current page has 404 response status code. #### seeResponseCodeIs - + +* `param int` $code +* `return void` + Checks that response code is equal to value provided. {% highlight php %} @@ -990,32 +1172,48 @@ $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK); #### seeResponseCodeIsBetween - + +* `param int` $from +* `param int` $to +* `return void` + Checks that response code is between a certain range. Between actually means [from <= CODE <= to] #### seeResponseCodeIsClientError - + +* `return void` + Checks that the response code is 4xx #### seeResponseCodeIsRedirection - + +* `return void` + Checks that the response code 3xx #### seeResponseCodeIsServerError - + +* `return void` + Checks that the response code is 5xx #### seeResponseCodeIsSuccessful - + +* `return void` + Checks that the response code 2xx #### selectOption - + +* `param ` $select +* `param ` $option +* `return void` + Selects an option in a select tag or in radio button group. {% highlight php %} @@ -1048,14 +1246,24 @@ $I->selectOption('Which OS do you use?', array('value' => 'windows')); // Only s #### sendAjaxGetRequest - + +* `param string` $uri +* `param array` $params +* `return void` + Sends an ajax GET request with the passed parameters. + See `sendAjaxPostRequest()` #### sendAjaxPostRequest - + +* `param string` $uri +* `param array` $params +* `return void` + Sends an ajax POST request with the passed parameters. + The appropriate HTTP header is added automatically: `X-Requested-With: XMLHttpRequest` Example: @@ -1080,8 +1288,14 @@ $I->sendAjaxPostRequest('/add-task', ['form' => [ #### sendAjaxRequest - + +* `param string` $method +* `param string` $uri +* `param array` $params +* `return void` + Sends an ajax request, using the passed HTTP method. + See `sendAjaxPostRequest()` Example: {% highlight php %} @@ -1093,8 +1307,14 @@ $I->sendAjaxRequest('PUT', '/posts/7', ['title' => 'new title']); #### setCookie - + +* `param ` $name +* `param ` $val +* `param ` $params +* `return mixed|void` + Sets a cookie with the given name and value. + You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument. {% highlight php %} @@ -1104,11 +1324,12 @@ $I->setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3'); {% endhighlight %} - * `return mixed|void` - #### setMaxRedirects - + +* `param int` $maxRedirects +* `return void` + Sets the maximum number of redirects that the Client can follow. {% highlight php %} @@ -1120,8 +1341,12 @@ $I->setMaxRedirects(2); #### setServerParameters - + +* `param array` $params +* `return void` + Sets SERVER parameters valid for all next requests. + this will remove old ones. {% highlight php %} @@ -1132,7 +1357,9 @@ $I->setServerParameters([]); #### startFollowingRedirects - + +* `return void` + Enables automatic redirects to be followed by the client. {% highlight php %} @@ -1144,7 +1371,9 @@ $I->startFollowingRedirects(); #### stopFollowingRedirects - + +* `return void` + Prevents automatic redirects to be followed by the client. {% highlight php %} @@ -1156,7 +1385,12 @@ $I->stopFollowingRedirects(); #### submitForm - + +* `param ` $selector +* `param array` $params +* `param ?string` $button +* `return void` + Submits the given form on the page, with the given form values. Pass the form field's values as an array in the second parameter. @@ -1346,7 +1580,10 @@ $I->submitForm('#my-form', [ #### switchToIframe - + +* `param string` $name +* `return void` + Switch to iframe or frame on the page. Example: @@ -1366,7 +1603,10 @@ $I->switchToIframe("another_frame"); #### uncheckOption - + +* `param ` $option +* `return void` + Unticks a checkbox. {% highlight php %} diff --git a/docs/modules/MongoDb.md b/docs/modules/MongoDb.md index 7f490abe6..992cedcf8 100644 --- a/docs/modules/MongoDb.md +++ b/docs/modules/MongoDb.md @@ -85,7 +85,12 @@ HINT: This module can be used with [Mongofill](https://github.com/mongofill/mong ### Actions #### dontSeeInCollection - + +* `param array $criteria +* `param string` $collection +* `param array` $criteria +* `return void` + Checks if collection doesn't contain an item. {% highlight php %} @@ -95,11 +100,14 @@ $I->dontSeeInCollection('users', ['name' => 'miles']); {% endhighlight %} - * `param array` $criteria - #### grabCollectionCount - + +* `param array $criteria +* `param string` $collection +* `param array` $criteria +* `return int` + Grabs the documents count from a collection {% highlight php %} @@ -111,11 +119,14 @@ $count = $I->grabCollectionCount('users', ['isAdmin' => true]); {% endhighlight %} - * `param array` $criteria - #### grabFromCollection - + +* `param array $criteria +* `param string` $collection +* `param array` $criteria +* `return object|array|null` + Grabs a data from collection {% highlight php %} @@ -125,11 +136,14 @@ $user = $I->grabFromCollection('users', ['name' => 'miles']); {% endhighlight %} - * `param array` $criteria - #### haveInCollection - + +* `param array $data +* `param string` $collection +* `param array` $data +* `return string` + Inserts data into collection {% highlight php %} @@ -140,11 +154,15 @@ $user_id = $I->haveInCollection('users', ['email' => 'john@coltrane.com']); {% endhighlight %} - * `param array` $data - #### seeElementIsArray - + +* `param array $criteria +* `param string` $collection +* `param array` $criteria +* `param string` $elementToCheck +* `return void` + Asserts that an element in a collection exists and is an Array {% highlight php %} @@ -154,11 +172,15 @@ $I->seeElementIsArray('users', ['name' => 'John Doe'], 'data.skills'); {% endhighlight %} - * `param array` $criteria - #### seeElementIsObject - + +* `param array $criteria +* `param string` $collection +* `param array` $criteria +* `param string` $elementToCheck +* `return void` + Asserts that an element in a collection exists and is an Object {% highlight php %} @@ -168,11 +190,14 @@ $I->seeElementIsObject('users', ['name' => 'John Doe'], 'data'); {% endhighlight %} - * `param array` $criteria - #### seeInCollection - + +* `param array $criteria +* `param string` $collection +* `param array` $criteria +* `return void` + Checks if collection contains an item. {% highlight php %} @@ -182,11 +207,15 @@ $I->seeInCollection('users', ['name' => 'miles']); {% endhighlight %} - * `param array` $criteria - #### seeNumElementsInCollection - + +* `param array $criteria +* `param string` $collection +* `param int` $expected +* `param array` $criteria +* `return void` + Count number of records in a collection {% highlight php %} @@ -197,11 +226,12 @@ $I->seeNumElementsInCollection('users', 1, ['name' => 'miles']); {% endhighlight %} - * `param array` $criteria - #### useDatabase - + +* `param string` $dbName +* `return void` + Specify the database to use {% highlight php %} diff --git a/docs/modules/PhpBrowser.md b/docs/modules/PhpBrowser.md index 594fa34fc..b0098f7fb 100644 --- a/docs/modules/PhpBrowser.md +++ b/docs/modules/PhpBrowser.md @@ -100,7 +100,11 @@ Properties: #### _findElements *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param mixed` $locator +* `return iterable` + Locates element using available Codeception locator types: * XPath @@ -124,11 +128,14 @@ WebDriver module returns `Facebook\WebDriver\Remote\RemoteWebElement` instances PhpBrowser and Framework modules return `Symfony\Component\DomCrawler\Crawler` instances - #### _getResponseContent *hidden API method, expected to be used from Helper classes* - + +* `api` +* `throws ModuleException` +* `return string` + Returns content of the last response Use it in Helpers when you want to retrieve response of request performed by another module. @@ -143,14 +150,22 @@ public function seeResponseContains($text) {% endhighlight %} -@throws ModuleException - #### _loadPage *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param string` $method +* `param string` $uri +* `param array` $parameters +* `param array` $files +* `param array` $server +* `param ?string` $content +* `return void` + Opens a page with arbitrary request parameters. + Useful for testing multi-step forms on a specific step. {% highlight php %} @@ -164,12 +179,23 @@ public function openCheckoutFormStep2($orderId) { {% endhighlight %} - #### _request *hidden API method, expected to be used from Helper classes* - + +* `api` +* `see` `_loadPage` +* `param string` $method +* `param string` $uri +* `param array` $parameters +* `param array` $files +* `param array` $server +* `param ?string` $content +* `throws ExternalUrlException|ModuleException` +* `return ?string` + Send custom request to a backend using method, uri, parameters, etc. + Use it in Helpers to create special request actions, like accessing API Returns a string with response body. @@ -187,14 +213,15 @@ public function createUserByApi($name) { Does not load the response into the module so you can't interact with response page (click, fill forms). To load arbitrary page for interaction, use `_loadPage` method. -@throws ExternalUrlException|ModuleException -@see `_loadPage` - #### _savePageSource *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param string` $filename +* `return void` + Saves page source of to a file {% highlight php %} @@ -205,12 +232,19 @@ $this->getModule('PhpBrowser')->_savePageSource(codecept_output_dir().'page.html #### amHttpAuthenticated - + +* `param ` $username +* `param ` $password +* `return void` + Authenticates user for HTTP_AUTH #### amOnPage - + +* `param string` $page +* `return void` + Opens the page for the given relative URI. {% highlight php %} @@ -225,8 +259,12 @@ $I->amOnPage('/register'); #### amOnSubdomain - + +* `param ` $subdomain +* `return void` + Changes the subdomain for the 'url' configuration parameter. + Does not open a page; use `amOnPage` for that. {% highlight php %} @@ -243,9 +281,11 @@ $I->amOnPage('/'); {% endhighlight %} - #### amOnUrl - + +* `param ` $url +* `return void` + Open web page at the given absolute URL and sets its hostname as the base host. {% highlight php %} @@ -258,7 +298,11 @@ $I->amOnPage('/quickstart'); // moves to https://codeception.com/quickstart #### attachFile - + +* `param ` $field +* `param string` $filename +* `return void` + Attaches a file relative to the Codeception `_data` directory to the given file upload field. {% highlight php %} @@ -271,7 +315,10 @@ $I->attachFile('input[@type="file"]', 'prices.xls'); #### checkOption - + +* `param ` $option +* `return void` + Ticks a checkbox. For radio buttons, use the `selectOption` method instead. {% highlight php %} @@ -283,8 +330,13 @@ $I->checkOption('#agree'); #### click - + +* `param string|array` $link +* `param ` $context +* `return void` + 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. @@ -311,11 +363,13 @@ $I->click('Logout', '#nav'); $I->click(['link' => 'Login']); {% endhighlight %} - * `param string|array` $link #### deleteHeader - + +* `param string` $name the name of the header to delete. +* `return void` + Deletes the header with the passed name. Subsequent requests will not have the deleted header in its request. @@ -331,12 +385,15 @@ $I->amOnPage('some-other-page.php'); {% endhighlight %} - * `param string` $name the name of the header to delete. - #### dontSee - + +* `param array|string` $selector optional +* `param string` $text +* `return void` + Checks that the current page doesn't contain the text specified (case insensitive). + Give a locator as the second parameter to match a specific region. {% highlight php %} @@ -363,11 +420,12 @@ But will ignore strings like: For checking the raw source code, use `seeInSource()`. - * `param array|string` $selector optional - #### dontSeeCheckboxIsChecked - + +* `param ` $checkbox +* `return void` + Check that the specified checkbox is unchecked. {% highlight php %} @@ -380,16 +438,23 @@ $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user #### dontSeeCookie - + +* `param ` $cookie +* `param ` $params +* `return mixed|void` + Checks that there isn't a cookie with the given name. -You can set additional cookie params like `domain`, `path` as array passed in last argument. - * `return mixed|void` +You can set additional cookie params like `domain`, `path` as array passed in last argument. #### dontSeeCurrentUrlEquals - + +* `param string` $uri +* `return void` + Checks that the current URL doesn't equal the given string. + Unlike `dontSeeInCurrentUrl`, this only matches the full URL. {% highlight php %} @@ -402,7 +467,10 @@ $I->dontSeeCurrentUrlEquals('/'); #### dontSeeCurrentUrlMatches - + +* `param string` $uri +* `return void` + Checks that current url doesn't match the given regular expression. {% highlight php %} @@ -415,8 +483,13 @@ $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~'); #### dontSeeElement - + +* `param ` $selector +* `param array` $attributes +* `return void` + Checks that the given element is invisible or not present on the page. + You can also specify expected attributes of this element. {% highlight php %} @@ -431,7 +504,10 @@ $I->dontSeeElement('input', ['value' => '123456']); #### dontSeeInCurrentUrl - + +* `param string` $uri +* `return void` + Checks that the current URI doesn't contain the given string. {% highlight php %} @@ -443,8 +519,13 @@ $I->dontSeeInCurrentUrl('/users/'); #### dontSeeInField - + +* `param string|array` $field +* `param ` $value +* `return void` + Checks that an input field or textarea doesn't contain the given value. + For fuzzy locators, the field is matched by label text, CSS and XPath. {% highlight php %} @@ -458,11 +539,14 @@ $I->dontSeeInField('//form/*[@name=search]','Search'); $I->dontSeeInField(['name' => 'search'], 'Search'); {% endhighlight %} - * `param string|array` $field #### dontSeeInFormFields - + +* `param ` $formSelector +* `param array` $params +* `return void` + Checks if the array of form parameters (name => value) are not set on the form matched with the passed selector. @@ -505,7 +589,10 @@ $I->dontSeeInFormFields('#form-id', [ #### dontSeeInSource - + +* `param string` $raw +* `return void` + Checks that the current page contains the given string in its raw source code. @@ -518,15 +605,21 @@ $I->dontSeeInSource('

Green eggs & ham

'); #### dontSeeInTitle - -Checks that the page title does not contain the given string. - * `return mixed|void` +* `param ` $title +* `return mixed|void` + +Checks that the page title does not contain the given string. #### dontSeeLink - + +* `param string` $text +* `param string` $url +* `return void` + Checks that the page doesn't contain a link with the given string. + If the second parameter is given, only links with a matching "href" attribute will be checked. {% highlight php %} @@ -539,7 +632,11 @@ $I->dontSeeLink('Checkout now', '/store/cart.php'); #### dontSeeOptionIsSelected - + +* `param ` $selector +* `param ` $optionText +* `return mixed|void` + Checks that the given option is not selected. {% highlight php %} @@ -549,11 +646,12 @@ $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); {% endhighlight %} - * `return mixed|void` - #### dontSeeResponseCodeIs - + +* `param int` $code +* `return void` + Checks that response code is equal to value provided. {% highlight php %} @@ -568,8 +666,12 @@ $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK); #### executeInGuzzle - + +* `param \Closure` $function +* `return mixed` + Low-level API method. + If Codeception commands are not enough, use [Guzzle HTTP Client](https://guzzlephp.org/) methods directly Example: @@ -587,9 +689,12 @@ It is not recommended to use this command on a regular basis. If Codeception lacks important Guzzle Client methods, implement them and submit patches. - #### fillField - + +* `param ` $field +* `param ` $value +* `return void` + Fills a text field or textarea with the given string. {% highlight php %} @@ -602,7 +707,9 @@ $I->fillField(['name' => 'email'], 'jon@example.com'); #### followRedirect - + +* `return void` + Follow pending redirect if there is one. {% highlight php %} @@ -614,8 +721,13 @@ $I->followRedirect(); #### grabAttributeFrom - + +* `param ` $cssOrXpath +* `param string` $attribute +* `return mixed` + Grabs the value of the given attribute value from the given element. + Fails if element is not found. {% highlight php %} @@ -627,15 +739,24 @@ $I->grabAttributeFrom('#tooltip', 'title'); #### grabCookie - + +* `param string` $cookie +* `param array` $params +* `return mixed` + Grabs a cookie value. + You can set additional cookie params like `domain`, `path` in array passed as last argument. If the cookie is set by an ajax request (XMLHttpRequest), there might be some delay caused by the browser, so try `$I->wait(0.1)`. #### grabFromCurrentUrl - + +* `param ?string` $uri +* `return mixed` + Executes the given regular expression against the current URI and returns the first capturing group. + If no parameters are provided, the full URI is returned. {% highlight php %} @@ -648,7 +769,11 @@ $uri = $I->grabFromCurrentUrl(); #### grabMultiple - + +* `param ` $cssOrXpath +* `param ?string` $attribute +* `return string[]` + Grabs either the text content, or attribute values, of nodes matched by $cssOrXpath and returns them as an array. @@ -671,20 +796,22 @@ $aLinks = $I->grabMultiple('a', 'href'); {% endhighlight %} - * `return string[]` - #### grabPageSource - -Grabs current page source code. -@throws ModuleException if no page was opened. - * `return string` Current page source code. +* `throws ModuleException` if no page was opened. +* `return string` Current page source code. + +Grabs current page source code. #### grabTextFrom - + +* `param ` $cssOrXPathOrRegex +* `return mixed` + Finds and returns the text contents of the given element. + If a fuzzy locator is used, the element is found using CSS, XPath, and by matching the full page source by regular expression. @@ -699,8 +826,12 @@ $value = $I->grabTextFrom('~grabValueFrom(['name' => 'username']); #### haveHttpHeader - + +* `param string` $name the name of the request header +* `param string` $value the value to set it to for subsequent + requests +* `return void` + Sets the HTTP header to the passed value - which is used on subsequent HTTP requests through PhpBrowser. @@ -740,13 +876,13 @@ $I->haveHttpHeader('Client_Id', 'Codeception'); {% endhighlight %} - * `param string` $name the name of the request header - * `param string` $value the value to set it to for subsequent - requests - #### haveServerParameter - + +* `param string` $name +* `param string` $value +* `return void` + Sets SERVER parameter valid for all next requests. {% highlight php %} @@ -757,7 +893,10 @@ $I->haveServerParameter('name', 'value'); #### makeHtmlSnapshot - + +* `param ?string` $name +* `return void` + Use this method within an [interactive pause](https://codeception.com/docs/02-GettingStarted#Interactive-Pause) to save the HTML source code of the current page. {% highlight php %} @@ -772,22 +911,30 @@ $I->makeHtmlSnapshot(); #### moveBack - -Moves back in history. - * `param int` $numberOfSteps (default value 1) +* `param int` $numberOfSteps (default value 1) +* `return void` + +Moves back in history. #### resetCookie - + +* `param ` $cookie +* `param ` $params +* `return mixed|void` + Unsets cookie with the given name. -You can set additional cookie params like `domain`, `path` in array passed as last argument. - * `return mixed|void` +You can set additional cookie params like `domain`, `path` in array passed as last argument. #### see - + +* `param array|string` $selector optional +* `param string` $text +* `return void` + 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 @@ -817,11 +964,12 @@ But will *not* be true for strings like: For checking the raw source code, use `seeInSource()`. - * `param array|string` $selector optional - #### seeCheckboxIsChecked - + +* `param ` $checkbox +* `return void` + Checks that the specified checkbox is checked. {% highlight php %} @@ -835,8 +983,13 @@ $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); #### seeCookie - + +* `param ` $cookie +* `param ` $params +* `return mixed|void` + Checks that a cookie with the given name is set. + You can set additional cookie params like `domain`, `path` as array passed in last argument. {% highlight php %} @@ -846,12 +999,14 @@ $I->seeCookie('PHPSESSID'); {% endhighlight %} - * `return mixed|void` - #### seeCurrentUrlEquals - + +* `param string` $uri +* `return void` + Checks that the current URL is equal to the given string. + Unlike `seeInCurrentUrl`, this only matches the full URL. {% highlight php %} @@ -864,7 +1019,10 @@ $I->seeCurrentUrlEquals('/'); #### seeCurrentUrlMatches - + +* `param string` $uri +* `return void` + Checks that the current URL matches the given regular expression. {% highlight php %} @@ -877,8 +1035,13 @@ $I->seeCurrentUrlMatches('~^/users/(\d+)~'); #### seeElement - + +* `param ` $selector +* `param array` $attributes +* `return void` + Checks that the given element exists on the page and is visible. + You can also specify expected attributes of this element. {% highlight php %} @@ -896,7 +1059,10 @@ $I->seeElement(['css' => 'form input'], ['name' => 'login']); #### seeInCurrentUrl - + +* `param string` $uri +* `return void` + Checks that current URI contains the given string. {% highlight php %} @@ -911,8 +1077,13 @@ $I->seeInCurrentUrl('/users/'); #### seeInField - + +* `param string|array` $field +* `param ` $value +* `return void` + Checks that the given input field or textarea *equals* (i.e. not just contains) the given value. + Fields are matched by label text, the "name" attribute, CSS, or XPath. {% highlight php %} @@ -927,11 +1098,13 @@ $I->seeInField(['name' => 'search'], 'Search'); {% endhighlight %} - * `param string|array` $field - #### seeInFormFields - + +* `param ` $formSelector +* `param array` $params +* `return void` + Checks if the array of form parameters (name => value) are set on the form matched with the passed selector. @@ -995,7 +1168,10 @@ $I->seeInFormFields('//form[@id=my-form]', string $form); #### seeInSource - + +* `param string` $raw +* `return void` + Checks that the current page contains the given string in its raw source code. @@ -1008,7 +1184,10 @@ $I->seeInSource('

Green eggs & ham

'); #### seeInTitle - + +* `param ` $title +* `return mixed|void` + Checks that the page title contains the given string. {% highlight php %} @@ -1018,12 +1197,15 @@ $I->seeInTitle('Blog - Post #1'); {% endhighlight %} - * `return mixed|void` - #### seeLink - + +* `param string` $text +* `param ?string` $url +* `return void` + Checks that there's a link with the specified text. + Give a full URL as the second parameter to match links with that exact URL. {% highlight php %} @@ -1036,7 +1218,11 @@ $I->seeLink('Logout','/logout'); // matches Logout #### seeNumberOfElements - + +* `param int|int[]` $expected +* `param ` $selector +* `return void` + Checks that there are a certain number of elements matched by the given locator on the page. {% highlight php %} @@ -1047,11 +1233,13 @@ $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements {% endhighlight %} - * `param int|int[]` $expected - #### seeOptionIsSelected - + +* `param ` $selector +* `param ` $optionText +* `return mixed|void` + Checks that the given option is selected. {% highlight php %} @@ -1061,16 +1249,19 @@ $I->seeOptionIsSelected('#form input[name=payment]', 'Visa'); {% endhighlight %} - * `return mixed|void` - #### seePageNotFound - + +* `return void` + Asserts that current page has 404 response status code. #### seeResponseCodeIs - + +* `param int` $code +* `return void` + Checks that response code is equal to value provided. {% highlight php %} @@ -1085,32 +1276,48 @@ $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK); #### seeResponseCodeIsBetween - + +* `param int` $from +* `param int` $to +* `return void` + Checks that response code is between a certain range. Between actually means [from <= CODE <= to] #### seeResponseCodeIsClientError - + +* `return void` + Checks that the response code is 4xx #### seeResponseCodeIsRedirection - + +* `return void` + Checks that the response code 3xx #### seeResponseCodeIsServerError - + +* `return void` + Checks that the response code is 5xx #### seeResponseCodeIsSuccessful - + +* `return void` + Checks that the response code 2xx #### selectOption - + +* `param ` $select +* `param ` $option +* `return void` + Selects an option in a select tag or in radio button group. {% highlight php %} @@ -1143,14 +1350,24 @@ $I->selectOption('Which OS do you use?', array('value' => 'windows')); // Only s #### sendAjaxGetRequest - + +* `param string` $uri +* `param array` $params +* `return void` + Sends an ajax GET request with the passed parameters. + See `sendAjaxPostRequest()` #### sendAjaxPostRequest - + +* `param string` $uri +* `param array` $params +* `return void` + Sends an ajax POST request with the passed parameters. + The appropriate HTTP header is added automatically: `X-Requested-With: XMLHttpRequest` Example: @@ -1175,8 +1392,14 @@ $I->sendAjaxPostRequest('/add-task', ['form' => [ #### sendAjaxRequest - + +* `param string` $method +* `param string` $uri +* `param array` $params +* `return void` + Sends an ajax request, using the passed HTTP method. + See `sendAjaxPostRequest()` Example: {% highlight php %} @@ -1188,8 +1411,14 @@ $I->sendAjaxRequest('PUT', '/posts/7', ['title' => 'new title']); #### setCookie - + +* `param ` $name +* `param ` $val +* `param ` $params +* `return mixed|void` + Sets a cookie with the given name and value. + You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument. {% highlight php %} @@ -1199,16 +1428,21 @@ $I->setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3'); {% endhighlight %} - * `return mixed|void` - #### setHeader - + +* `param string` $name +* `param string` $value +* `return void` + Alias to `haveHttpHeader` #### setMaxRedirects - + +* `param int` $maxRedirects +* `return void` + Sets the maximum number of redirects that the Client can follow. {% highlight php %} @@ -1220,8 +1454,12 @@ $I->setMaxRedirects(2); #### setServerParameters - + +* `param array` $params +* `return void` + Sets SERVER parameters valid for all next requests. + this will remove old ones. {% highlight php %} @@ -1232,7 +1470,9 @@ $I->setServerParameters([]); #### startFollowingRedirects - + +* `return void` + Enables automatic redirects to be followed by the client. {% highlight php %} @@ -1244,7 +1484,9 @@ $I->startFollowingRedirects(); #### stopFollowingRedirects - + +* `return void` + Prevents automatic redirects to be followed by the client. {% highlight php %} @@ -1256,7 +1498,12 @@ $I->stopFollowingRedirects(); #### submitForm - + +* `param ` $selector +* `param array` $params +* `param ?string` $button +* `return void` + Submits the given form on the page, with the given form values. Pass the form field's values as an array in the second parameter. @@ -1446,7 +1693,10 @@ $I->submitForm('#my-form', [ #### switchToIframe - + +* `param string` $name +* `return void` + Switch to iframe or frame on the page. Example: @@ -1466,7 +1716,10 @@ $I->switchToIframe("another_frame"); #### uncheckOption - + +* `param ` $option +* `return void` + Unticks a checkbox. {% highlight php %} diff --git a/docs/modules/Queue.md b/docs/modules/Queue.md index f6244ec09..20314e90d 100644 --- a/docs/modules/Queue.md +++ b/docs/modules/Queue.md @@ -146,7 +146,11 @@ service. ### Actions #### addMessageToQueue - + +* `param string` $message Message Body +* `param string` $queue Queue name +* `return void` + Add a message to a queue/tube {% highlight php %} @@ -156,12 +160,12 @@ $I->addMessageToQueue('this is a messages', 'default'); {% endhighlight %} - * `param string` $message Message Body - * `param string` $queue Queue name - #### clearQueue - + +* `param string` $queue Queue name +* `return void` + Clear all messages of the queue/tube {% highlight php %} @@ -171,11 +175,12 @@ $I->clearQueue('default'); {% endhighlight %} - * `param string` $queue Queue name - #### dontSeeEmptyQueue - + +* `param string` $queue Queue name +* `return void` + Check if a queue/tube is NOT empty of all messages {% highlight php %} @@ -185,11 +190,12 @@ $I->dontSeeEmptyQueue('default'); {% endhighlight %} - * `param string` $queue Queue name - #### dontSeeQueueExists - + +* `param string` $queue Queue name +* `return void` + Check if a queue/tube does NOT exist on the queueing server. {% highlight php %} @@ -199,11 +205,13 @@ $I->dontSeeQueueExists('default'); {% endhighlight %} - * `param string` $queue Queue name - #### dontSeeQueueHasCurrentCount - + +* `param string` $queue Queue name +* `param int` $expected Number of messages expected +* `return void` + Check if a queue/tube does NOT have a given current number of messages {% highlight php %} @@ -213,12 +221,13 @@ $I->dontSeeQueueHasCurrentCount('default', 10); {% endhighlight %} - * `param string` $queue Queue name - * `param int` $expected Number of messages expected - #### dontSeeQueueHasTotalCount - + +* `param string` $queue Queue name +* `param int` $expected Number of messages expected +* `return void` + Check if a queue/tube does NOT have a given total number of messages {% highlight php %} @@ -228,12 +237,12 @@ $I->dontSeeQueueHasTotalCount('default', 10); {% endhighlight %} - * `param string` $queue Queue name - * `param int` $expected Number of messages expected - #### grabQueueCurrentCount - + +* `param string` $queue Queue name +* `return int` Count + Grabber method to get the current number of messages on the queue/tube (pending/ready) {% highlight php %} @@ -243,12 +252,12 @@ Grabber method to get the current number of messages on the queue/tube (pending/ {% endhighlight %} - * `param` string $queue Queue name - * `return int` Count - #### grabQueueTotalCount - + +* `param string` $queue Queue name +* `return int` Count + Grabber method to get the total number of messages on the queue/tube {% highlight php %} @@ -258,12 +267,11 @@ Grabber method to get the total number of messages on the queue/tube {% endhighlight %} - * `param` string $queue Queue name - * `return int` Count - #### grabQueues - + +* `return string[]` List of Queues/Tubes + Grabber method to get the list of queues/tubes on the server {% highlight php %} @@ -273,11 +281,12 @@ $queues = $I->grabQueues(); {% endhighlight %} - * `return string[]` List of Queues/Tubes - #### seeEmptyQueue - + +* `param string` $queue Queue name +* `return void` + Check if a queue/tube is empty of all messages {% highlight php %} @@ -287,11 +296,12 @@ $I->seeEmptyQueue('default'); {% endhighlight %} - * `param string` $queue Queue name - #### seeQueueExists - + +* `param string` $queue Queue name +* `return void` + Check if a queue/tube exists on the queueing server. {% highlight php %} @@ -301,11 +311,13 @@ $I->seeQueueExists('default'); {% endhighlight %} - * `param string` $queue Queue name - #### seeQueueHasCurrentCount - + +* `param string` $queue Queue name +* `param int` $expected Number of messages expected +* `return void` + Check if a queue/tube has a given current number of messages {% highlight php %} @@ -315,12 +327,13 @@ $I->seeQueueHasCurrentCount('default', 10); {% endhighlight %} - * `param string` $queue Queue name - * `param int` $expected Number of messages expected - #### seeQueueHasTotalCount - + +* `param string` $queue Queue name +* `param int` $expected Number of messages expected +* `return void` + Check if a queue/tube has a given total number of messages {% highlight php %} @@ -330,7 +343,4 @@ $I->seeQueueHasTotalCount('default', 10); {% endhighlight %} - * `param string` $queue Queue name - * `param int` $expected Number of messages expected -

 

Module reference is taken from the source code. Help us to improve documentation. Edit module reference
diff --git a/docs/modules/REST.md b/docs/modules/REST.md index 43e59c6bd..23b6f2bce 100644 --- a/docs/modules/REST.md +++ b/docs/modules/REST.md @@ -97,7 +97,11 @@ Conflicts with SOAP module ### Actions #### amAWSAuthenticated - + +* `param array` $additionalAWSConfig +* `throws ConfigurationException` +* `return void` + Allows to send REST request using AWS Authorization Only works with PhpBrowser @@ -121,36 +125,51 @@ Code: $I->amAWSAuthenticated(); {% endhighlight %} -@throws ConfigurationException #### amBearerAuthenticated - -Adds Bearer authentication via access token. - * `[Part]` json - * `[Part]` xml +* `part` json +* `part` xml +* `param string` $accessToken +* `return void` + +Adds Bearer authentication via access token. #### amDigestAuthenticated - -Adds Digest authentication via username/password. - * `[Part]` json - * `[Part]` xml +* `part` json +* `part` xml +* `param string` $username +* `param string` $password +* `return void` + +Adds Digest authentication via username/password. #### amHttpAuthenticated - -Adds HTTP authentication via username/password. - * `[Part]` json - * `[Part]` xml +* `part` json +* `part` xml +* `param string` $username +* `param string` $password +* `return void` + +Adds HTTP authentication via username/password. #### amNTLMAuthenticated - + +* `part` json +* `part` xml +* `param string` $username +* `param string` $password +* `throws ModuleException` +* `return void` + Adds NTLM authentication via username/password. + Requires client to be Guzzle >=6.3.0 Out of scope for functional modules. @@ -162,13 +181,14 @@ $I->amNTLMAuthenticated('jon_snow', 'targaryen'); {% endhighlight %} -@throws ModuleException - * `[Part]` json - * `[Part]` xml - #### deleteHeader - + +* `part` json +* `part` xml +* `param string` $name the name of the header to delete. +* `return void` + Deletes a HTTP header (that was originally added by [haveHttpHeader()](#haveHttpHeader)), so that subsequent requests will not send it anymore. @@ -184,13 +204,15 @@ $I->sendPost('some-other-page.php'); {% endhighlight %} - * `param string` $name the name of the header to delete. - * `[Part]` json - * `[Part]` xml - #### dontSeeBinaryResponseEquals - + +* `part` json +* `part` xml +* `param string` $hash the hashed data response expected +* `param string` $algo the hash algorithm to use. Default md5. +* `return void` + Checks if the hash of a binary response is not the same as provided. {% highlight php %} @@ -201,24 +223,26 @@ $I->dontSeeBinaryResponseEquals("8c90748342f19b195b9c6b4eff742ded"); {% endhighlight %} Opposite to `seeBinaryResponseEquals` - * `param string` $hash the hashed data response expected - * `param string` $algo the hash algorithm to use. Default md5. - * `[Part]` json - * `[Part]` xml - #### dontSeeHttpHeader - + +* `part` json +* `part` xml +* `param ` $value +* `param string` $name +* `return void` + Checks over the given HTTP header and (optionally) its value, asserting that are not there - * `param` $value - * `[Part]` json - * `[Part]` xml - #### dontSeeResponseCodeIs - + +* `part` json +* `part` xml +* `param int` $code +* `return void` + Checks that response code is not equal to provided value. {% highlight php %} @@ -231,79 +255,98 @@ $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK); {% endhighlight %} - * `[Part]` json - * `[Part]` xml - #### dontSeeResponseContains - -Checks whether last response do not contain text. - * `[Part]` json - * `[Part]` xml +* `part` json +* `part` xml +* `param string` $text +* `return void` + +Checks whether last response do not contain text. #### dontSeeResponseContainsJson - -Opposite to seeResponseContainsJson - * `[Part]` json +* `part` json +* `param array` $json +* `return void` + +Opposite to seeResponseContainsJson #### dontSeeResponseJsonMatchesJsonPath - + +* `part` json +* `param string` $jsonPath +* `return void` + See [#jsonpath](#jsonpath) for general info on JSONPath. -Opposite to [`seeResponseJsonMatchesJsonPath()`](#seeResponseJsonMatchesJsonPath) - * `[Part]` json +Opposite to [`seeResponseJsonMatchesJsonPath()`](#seeResponseJsonMatchesJsonPath) #### dontSeeResponseJsonMatchesXpath - -Opposite to seeResponseJsonMatchesXpath - * `[Part]` json +* `part` json +* `param string` $xPath +* `return void` + +Opposite to seeResponseJsonMatchesXpath #### dontSeeResponseJsonXpathEvaluatesTo - -Opposite to seeResponseJsonXpathEvaluatesTo - * `[Part]` json +* `part` json +* `param string` $xPath +* `param ` $expected +* `return void` + +Opposite to seeResponseJsonXpathEvaluatesTo #### dontSeeResponseMatchesJsonType - -Opposite to `seeResponseMatchesJsonType`. - * `[Part]` json - * `param array` $jsonType JsonType structure -@see seeResponseMatchesJsonType +* `part` json +* `see` seeResponseMatchesJsonType +* `param array` $jsonType JsonType structure +* `param ?string` $jsonPath +* `return void` + +Opposite to `seeResponseMatchesJsonType`. #### dontSeeXmlResponseEquals - + +* `part` xml +* `param mixed` $xml +* `return void` + Checks XML response does not equal to provided XML. + Comparison is done by canonicalizing both xml`s. Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes). - * `param mixed` $xml - * `[Part]` xml - #### dontSeeXmlResponseIncludes - + +* `part` xml +* `param mixed` $xml +* `return void` + Checks XML response does not include provided XML. + Comparison is done by canonicalizing both xml`s. Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes). - * `param mixed` $xml - * `[Part]` xml - #### dontSeeXmlResponseMatchesXpath - + +* `part` xml +* `param string` $xPath +* `return void` + Checks whether XML response does not match XPath {% highlight php %} @@ -312,20 +355,29 @@ Checks whether XML response does not match XPath $I->dontSeeXmlResponseMatchesXpath('//root/user[@id=1]'); {% endhighlight %} - * `[Part]` xml #### grabAttributeFromXmlElement - + +* `part` xml +* `param string` $cssOrXPath +* `param string` $attribute +* `return string` + Finds and returns attribute of element. -Element is matched by either CSS or XPath - * `[Part]` xml +Element is matched by either CSS or XPath #### grabDataFromResponseByJsonPath - + +* `part` json +* `param string` $jsonPath +* `throws Exception` +* `return array` Array of matching items + See [#jsonpath](#jsonpath) for general info on JSONPath. + Even for a single value an array is returned. Example: @@ -338,23 +390,24 @@ $I->sendPut('/user', array('id' => $firstUserId[0], 'name' => 'davert')); {% endhighlight %} - * `return array` Array of matching items -@throws Exception - * `[Part]` json - #### grabHttpHeader - -Returns the value of the specified header name - * `param bool` $first Whether to return the first value or all header values - * `return string|array The first header value if` $first is true, an array of values otherwise - * `[Part]` json - * `[Part]` xml +* `part` json +* `part` xml +* `param bool` $first Whether to return the first value or all header values +* `param string` $name +* `return string|array` The first header value if $first is true, an array of values otherwise + +Returns the value of the specified header name #### grabResponse - + +* `part` json +* `part` xml +* `return string` + Returns current response so that it can be used in next scenario steps. Example: @@ -367,21 +420,26 @@ $I->sendPut('/user', array('id' => $user_id, 'name' => 'davert')); {% endhighlight %} - * `[Part]` json - * `[Part]` xml - #### grabTextContentFromXmlElement - + +* `part` xml +* `param mixed` $cssOrXPath +* `return string` + Finds and returns text contents of element. -Element is matched by either CSS or XPath - * `param mixed` $cssOrXPath - * `[Part]` xml +Element is matched by either CSS or XPath #### haveHttpHeader - + +* `part` json +* `part` xml +* `param string` $name +* `param string` $value +* `return void` + Sets a HTTP header to be used for all subsequent requests. Use [`deleteHeader`](#deleteHeader) to unset it. {% highlight php %} @@ -392,12 +450,13 @@ $I->haveHttpHeader('Content-Type', 'application/json'); {% endhighlight %} - * `[Part]` json - * `[Part]` xml - #### haveServerParameter - + +* `param ` $name +* `param ` $value +* `return void` + Sets SERVER parameter valid for all next requests. {% highlight php %} @@ -408,8 +467,15 @@ $I->haveServerParameter('name', 'value'); #### seeBinaryResponseEquals - + +* `part` json +* `part` xml +* `param string` $hash the hashed data response expected +* `param string` $algo the hash algorithm to use. Default sha1. +* `return void` + Checks if the hash of a binary response is exactly the same as provided. + Parameter can be passed as any hash string supported by `hash()`, with an optional second parameter to specify the hash type, which defaults to sha1. @@ -441,25 +507,28 @@ $I->seeBinaryResponseEquals(hash("sha256", base64_decode($fileData)), 'sha256'); {% endhighlight %} - * `param string` $hash the hashed data response expected - * `param string` $algo the hash algorithm to use. Default sha1. - * `[Part]` json - * `[Part]` xml - #### seeHttpHeader - + +* `part` json +* `part` xml +* `param ` $value +* `param string` $name +* `return void` + Checks over the given HTTP header and (optionally) its value, asserting that are there - * `param` $value - * `[Part]` json - * `[Part]` xml - #### seeHttpHeaderOnce - + +* `part` json +* `part` xml +* `param string` $name +* `return void` + Checks that http response header is received only once. + HTTP RFC2616 allows multiple response headers with the same name. You can check that you didn't accidentally sent the same header twice. @@ -470,12 +539,14 @@ $I->seeHttpHeaderOnce('Cache-Control'); {% endhighlight %} - * `[Part]` json - * `[Part]` xml - #### seeResponseCodeIs - + +* `part` json +* `part` xml +* `param int` $code +* `return void` + Checks response code equals to provided value. {% highlight php %} @@ -488,53 +559,61 @@ $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK); {% endhighlight %} - * `[Part]` json - * `[Part]` xml - #### seeResponseCodeIsClientError - -Checks that the response code is 4xx - * `[Part]` json - * `[Part]` xml +* `part` json +* `part` xml +* `return void` + +Checks that the response code is 4xx #### seeResponseCodeIsRedirection - -Checks that the response code 3xx - * `[Part]` json - * `[Part]` xml +* `part` json +* `part` xml +* `return void` + +Checks that the response code 3xx #### seeResponseCodeIsServerError - -Checks that the response code is 5xx - * `[Part]` json - * `[Part]` xml +* `part` json +* `part` xml +* `return void` + +Checks that the response code is 5xx #### seeResponseCodeIsSuccessful - -Checks that the response code is 2xx - * `[Part]` json - * `[Part]` xml +* `part` json +* `part` xml +* `return void` + +Checks that the response code is 2xx #### seeResponseContains - -Checks whether the last response contains text. - * `[Part]` json - * `[Part]` xml +* `part` json +* `part` xml +* `param string` $text +* `return void` + +Checks whether the last response contains text. #### seeResponseContainsJson - + +* `part` json +* `param array` $json +* `return void` + Checks whether the last JSON response contains provided array. + The response is converted to array with json_decode($response, true) Thus, JSON is represented by associative array. This method matches that response array contains provided array. @@ -555,36 +634,44 @@ $I->seeResponseContainsJson(array('email' => 'john@gmail.com')); This method recursively checks if one array can be found inside of another. - * `[Part]` json - #### seeResponseEquals - -Checks if response is exactly the same as provided. - * `[Part]` json - * `[Part]` xml +* `part` json +* `part` xml +* `param ` $expected +* `return void` + +Checks if response is exactly the same as provided. #### seeResponseIsJson - + +* `part` json +* `return void` + Checks whether last response was valid JSON. -This is done with json_last_error function. - * `[Part]` json +This is done with json_last_error function. #### seeResponseIsValidOnJsonSchema - + +* `part` json +* `see` codecept_absolute_path() +* `param string` $schemaFilename +* `return void` + Checks whether last response matches the supplied json schema (https://json-schema.org/) Supply schema as relative file path in your project directory or an absolute path - * `[Part]` json -@see codecept_absolute_path() - #### seeResponseIsValidOnJsonSchemaString - + +* `part` json +* `param string` $schema +* `return void` + Checks whether last response matches the supplied json schema (https://json-schema.org/) Supply schema as json string. @@ -610,20 +697,25 @@ $I->seeResponseIsValidOnJsonSchemaString(json_encode($schema)); {% endhighlight %} - * `[Part]` json - #### seeResponseIsXml - + +* `part` xml +* `return void` + Checks whether last response was valid XML. -This is done with libxml_get_last_error function. - * `[Part]` xml +This is done with libxml_get_last_error function. #### seeResponseJsonMatchesJsonPath - + +* `part` json +* `param string` $jsonPath +* `return void` + See [#jsonpath](#jsonpath) for general info on JSONPath. + Checks if JSON structure in response matches JSONPath. {% highlight json %} @@ -662,12 +754,15 @@ $I->seeResponseJsonMatchesJsonPath('$.store..price'); {% endhighlight %} - * `[Part]` json - #### seeResponseJsonMatchesXpath - + +* `part` json +* `param string` $xPath +* `return void` + Checks if json structure in response matches the xpath provided. + JSON is not supposed to be checked against XPath, yet it can be converted to xml and used with XPath. This assertion allows you to check the structure of response json. * @@ -706,12 +801,17 @@ $I->seeResponseJsonMatchesXpath('//store/book[1]/author'); $I->seeResponseJsonMatchesXpath('/store//price'); {% endhighlight %} - * `[Part]` json #### seeResponseJsonXpathEvaluatesTo - + +* `part` json +* `param string` $xPath +* `param ` $expected +* `return void` + Checks if applying xpath to json structure in response matches the expected result. + JSON is not supposed to be checked against XPath, yet it can be converted to xml and used with XPath. This assertion allows you to check the structure of response json. * @@ -748,12 +848,18 @@ $I->seeResponseJsonXpathEvaluatesTo('count(//store/book/author) > 0', true); $I->seeResponseJsonMatchesXpath("//author[text() = 'Nigel Rees']", 1.0); {% endhighlight %} - * `[Part]` json #### seeResponseMatchesJsonType - + +* `part` json +* `see` JsonType +* `param array` $jsonType +* `param ?string` $jsonPath +* `return void` + Checks that JSON matches provided types. + In case you don't know the actual values of JSON data returned you can match them by type. It starts the check with a root element. If JSON data is an array it will check all elements of it. You can specify the path in the json which should be checked with JsonPath @@ -832,24 +938,28 @@ $I->seeResponseMatchesJsonType([ You can also add custom filters by using `{@link JsonType::addCustomFilter()}`. See [JsonType reference](https://codeception.com/docs/reference/JsonType). - * `[Part]` json -@see JsonType - #### seeXmlResponseEquals - + +* `part` xml +* `param mixed` $xml +* `return void` + Checks XML response equals provided XML. + Comparison is done by canonicalizing both xml`s. Parameters can be passed either as DOMDocument, DOMNode, XML string, or array (if no attributes). - * `param mixed` $xml - * `[Part]` xml - #### seeXmlResponseIncludes - + +* `part` xml +* `param mixed` $xml +* `return void` + Checks XML response includes provided XML. + Comparison is done by canonicalizing both xml`s. Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes). @@ -862,12 +972,13 @@ $I->seeXmlResponseIncludes("1"); {% endhighlight %} - * `param mixed` $xml - * `[Part]` xml - #### seeXmlResponseMatchesXpath - + +* `part` xml +* `param string` $xPath +* `return void` + Checks whether XML response matches XPath {% highlight php %} @@ -876,20 +987,28 @@ Checks whether XML response matches XPath $I->seeXmlResponseMatchesXpath('//root/user[@id=1]'); {% endhighlight %} - * `[Part]` xml #### send - -Sends a HTTP request. - * `param array|string|JsonSerializable` $params - * `[Part]` json - * `[Part]` xml +* `part` json +* `part` xml +* `param array|string|JsonSerializable` $params +* `param string` $method +* `param string` $url +* `param array` $files + +Sends a HTTP request. #### sendDelete - + +* `part` json +* `part` xml +* `param string` $url +* `param array` $params +* `param array` $files + Sends DELETE request to given uri. {% highlight php %} @@ -899,12 +1018,14 @@ $I->sendDelete('/message/1'); {% endhighlight %} - * `[Part]` json - * `[Part]` xml - #### sendGet - + +* `part` json +* `part` xml +* `param string` $url +* `param array` $params + Sends a GET request to given uri. {% highlight php %} @@ -917,41 +1038,49 @@ $I->sendGet('/orders', ['id' => 1]) {% endhighlight %} - * `[Part]` json - * `[Part]` xml - #### sendHead - -Sends a HEAD request to given uri. - * `[Part]` json - * `[Part]` xml +* `part` json +* `part` xml +* `param string` $url +* `param array` $params +Sends a HEAD request to given uri. -#### sendLink - -Sends LINK request to given uri. - * `param array` $linkEntries (entry is array with keys "uri" and "link-param") +#### sendLink -@link https://tools.ietf.org/html/rfc2068#section-19.6.2.4 +* `link` https://tools.ietf.org/html/rfc2068#section-19.6.2.4 +* `part` json +* `part` xml +* `author` samva.ua@gmail.com +* `param array` $linkEntries (entry is array with keys "uri" and "link-param") +* `param string` $url +* `return void` -@author samva.ua@gmail.com - * `[Part]` json - * `[Part]` xml +Sends LINK request to given uri. #### sendOptions - -Sends an OPTIONS request to given uri. - * `[Part]` json - * `[Part]` xml +* `part` json +* `part` xml +* `param string` $url +* `param array` $params +* `return void` + +Sends an OPTIONS request to given uri. #### sendPatch - + +* `part` json +* `part` xml +* `param array|string|JsonSerializable` $params +* `param string` $url +* `param array` $files + Sends PATCH request to given uri. {% highlight php %} @@ -961,13 +1090,19 @@ $response = $I->sendPatch('/message/1', ['subject' => 'Read this!']); {% endhighlight %} - * `param array|string|JsonSerializable` $params - * `[Part]` json - * `[Part]` xml - #### sendPost - + +* `part` json +* `part` xml +* `see` https://php.net/manual/en/features.file-upload.post-method.php +* `see` codecept_data_dir() +* `param array|string|JsonSerializable` $params +* `param array` $files A list of filenames or "mocks" of $_FILES (each entry being an array with the following + keys: name, type, error, size, tmp_name (pointing to the real file path). Each key works + as the "name" attribute of a file input field. +* `param string` $url + Sends a POST request to given uri. Parameters and files can be provided separately. Example: @@ -997,19 +1132,15 @@ $I->sendPost('/add-task', ['form' => [ {% endhighlight %} - * `param array|string|JsonSerializable` $params - * `param array` $files A list of filenames or "mocks" of $_FILES (each entry being an array with the following - keys: name, type, error, size, tmp_name (pointing to the real file path). Each key works - as the "name" attribute of a file input field. -@see https://php.net/manual/en/features.file-upload.post-method.php -@see codecept_data_dir() - * `[Part]` json - * `[Part]` xml +#### sendPut +* `part` json +* `part` xml +* `param array|string|JsonSerializable` $params +* `param string` $url +* `param array` $files -#### sendPut - Sends PUT request to given uri. {% highlight php %} @@ -1019,25 +1150,27 @@ $response = $I->sendPut('/message/1', ['subject' => 'Read this!']); {% endhighlight %} - * `param array|string|JsonSerializable` $params - * `[Part]` json - * `[Part]` xml - #### sendUnlink - -Sends UNLINK request to given uri. - * `param array` $linkEntries (entry is array with keys "uri" and "link-param") -@link https://tools.ietf.org/html/rfc2068#section-19.6.2.4 -@author samva.ua@gmail.com - * `[Part]` json - * `[Part]` xml +* `link` https://tools.ietf.org/html/rfc2068#section-19.6.2.4 +* `part` json +* `part` xml +* `author` samva.ua@gmail.com +* `param array` $linkEntries (entry is array with keys "uri" and "link-param") +* `param string` $url +* `return void` + +Sends UNLINK request to given uri. #### setServerParameters - + +* `param array` $params +* `return void` + Sets SERVER parameters valid for all next requests. + this will remove old ones. {% highlight php %} @@ -1048,7 +1181,11 @@ $I->setServerParameters([]); #### startFollowingRedirects - + +* `part` xml +* `part` json +* `return void` + Enables automatic redirects to be followed by the client {% highlight php %} @@ -1058,12 +1195,13 @@ $I->startFollowingRedirects(); {% endhighlight %} - * `[Part]` xml - * `[Part]` json - #### stopFollowingRedirects - + +* `part` xml +* `part` json +* `return void` + Prevents automatic redirects to be followed by the client {% highlight php %} @@ -1073,7 +1211,4 @@ $I->stopFollowingRedirects(); {% endhighlight %} - * `[Part]` xml - * `[Part]` json -

 

Module reference is taken from the source code. Help us to improve documentation. Edit module reference
diff --git a/docs/modules/Redis.md b/docs/modules/Redis.md index 65ee3598e..ea78c6067 100644 --- a/docs/modules/Redis.md +++ b/docs/modules/Redis.md @@ -75,14 +75,20 @@ Note: The full configuration list can be found on Predis' github. ### Actions #### cleanup - -Delete all the keys in the Redis database -@throws ModuleException +* `throws ModuleException` +* `return void` + +Delete all the keys in the Redis database #### dontSeeInRedis - + +* `param string` $key The key name +* `param mixed` $value Optional. If specified, also checks the key has this +value. Booleans will be converted to 1 and 0 (even inside arrays) +* `return void` + Asserts that a key does not exist or, optionally, that it doesn't have the provided $value @@ -111,13 +117,15 @@ $I->dontSeeInRedis('example:hash', ['riri' => true, 'fifi' => 'Dewey', 'loulou' {% endhighlight %} - * `param string` $key The key name - * `param mixed` $value Optional. If specified, also checks the key has this -value. Booleans will be converted to 1 and 0 (even inside arrays) - #### dontSeeRedisKeyContains - + +* `param string` $key The key +* `param mixed` $item The item +* `param mixed` $itemValue Optional and only used for zsets and hashes. If +specified, the method will also check that the $item has this value/score +* `return void` + Asserts that a given key does not contain a given item Examples: @@ -148,14 +156,13 @@ $I->dontSeeRedisKeyContains('example:hash', 'magic', 32); {% endhighlight %} - * `param string` $key The key - * `param mixed` $item The item - * `param mixed` $itemValue Optional and only used for zsets and hashes. If -specified, the method will also check that the $item has this value/score - #### grabFromRedis - + +* `param string` $key The key name +* `throws ModuleException` if the key does not exist +* `return array|string|null` + Returns the value of a given key Examples: @@ -192,13 +199,15 @@ $I->grabFromRedis('example:hash', 'foo'); {% endhighlight %} - * `param string` $key The key name -@throws ModuleException if the key does not exist +#### haveInRedis +* `param string` $type The type of the key +* `param string` $key The key name +* `param mixed` $value The value +* `throws ModuleException` +* `return void` -#### haveInRedis - Creates or modifies keys If $key already exists: @@ -228,15 +237,14 @@ $I->haveInRedis('hash', ['obladi' => 'oblada']); {% endhighlight %} - * `param string` $type The type of the key - * `param string` $key The key name - * `param mixed` $value The value -@throws ModuleException +#### seeInRedis +* `param string` $key The key name +* `param mixed` $value Optional. If specified, also checks the key has this +value. Booleans will be converted to 1 and 0 (even inside arrays) +* `return void` -#### seeInRedis - Asserts that a key exists, and optionally that it has the provided $value Examples: @@ -264,13 +272,15 @@ $I->seeInRedis('example:hash', ['riri' => true, 'fifi' => 'Dewey', 'loulou' => 2 {% endhighlight %} - * `param string` $key The key name - * `param mixed` $value Optional. If specified, also checks the key has this -value. Booleans will be converted to 1 and 0 (even inside arrays) - #### seeRedisKeyContains - + +* `param string` $key The key +* `param mixed` $item The item +* `param mixed` $itemValue Optional and only used for zsets and hashes. If +specified, the method will also check that the $item has this value/score +* `return void` + Asserts that a given key contains a given item Examples: @@ -301,14 +311,12 @@ $I->seeRedisKeyContains('example:hash', 'magic', 32); {% endhighlight %} - * `param string` $key The key - * `param mixed` $item The item - * `param mixed` $itemValue Optional and only used for zsets and hashes. If -specified, the method will also check that the $item has this value/score - #### sendCommandToRedis - + +* `param string` $command The command name +* `return mixed` + Sends a command directly to the Redis driver. See documentation at https://github.com/nrk/predis Every argument that follows the $command name will be passed to it. @@ -326,6 +334,4 @@ $I->sendCommandToRedis('flushdb'); {% endhighlight %} - * `param string` $command The command name -

 

Module reference is taken from the source code. Help us to improve documentation. Edit module reference
diff --git a/docs/modules/SOAP.md b/docs/modules/SOAP.md index f5de1037c..1d179cca2 100644 --- a/docs/modules/SOAP.md +++ b/docs/modules/SOAP.md @@ -65,12 +65,18 @@ If you use PHP SoapServer with framework, try to block call to this method in te ### Actions #### dontSeeSoapResponseContainsStructure - + +* `param string` $xml +* `return void` + Opposite to `seeSoapResponseContainsStructure` #### dontSeeSoapResponseContainsXPath - + +* `param string` $xPath +* `return void` + Checks XML response doesn't contain XPath locator {% highlight php %} @@ -80,46 +86,61 @@ $I->dontSeeSoapResponseContainsXPath('//root/user[@id=1]'); {% endhighlight %} - * `param string` $xPath - #### dontSeeSoapResponseEquals - + +* `param string` $xml +* `return void` + Checks XML response equals provided XML. + Comparison is done by canonicalizing both xml`s. Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes). - #### dontSeeSoapResponseIncludes - + +* `param XmlBuilder|DOMDocument|string` $xml +* `return void` + Checks XML response does not include provided XML. + Comparison is done by canonicalizing both xml`s. Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes). - * `param XmlBuilder|DOMDocument|string` $xml - #### grabAttributeFrom - + +* `version` 1.1 +* `param string` $cssOrXPath +* `param string` $attribute +* `return string` + Finds and returns attribute of element. -Element is matched by either CSS or XPath - * `Available since` 1.1 +Element is matched by either CSS or XPath #### grabTextContentFrom - + +* `version` 1.1 +* `param string` $cssOrXPath +* `return string` + Finds and returns text contents of element. -Element is matched by either CSS or XPath - * `Available since` 1.1 +Element is matched by either CSS or XPath #### haveSoapHeader - + +* `param string` $header +* `param array` $params +* `return void` + Prepare SOAP header. + Receives header name and parameters as array. Example: @@ -146,15 +167,20 @@ Will produce header: #### seeSoapResponseCodeIs - -Checks response code from server. - * `param string` $code +* `param string` $code +* `return void` + +Checks response code from server. #### seeSoapResponseContainsStructure - + +* `param string` $xml +* `return void` + Checks XML response contains provided structure. + Response elements will be compared with XML provided. Only nodeNames are checked to see elements match. @@ -173,9 +199,11 @@ This method does not use schema for validation. This method does not require path from root to match the structure. - #### seeSoapResponseContainsXPath - + +* `param string` $xPath +* `return void` + Checks XML response with XPath locator {% highlight php %} @@ -185,12 +213,14 @@ $I->seeSoapResponseContainsXPath('//root/user[@id=1]'); {% endhighlight %} - * `param string` $xPath - #### seeSoapResponseEquals - + +* `param string` $xml +* `return void` + Checks XML response equals provided XML. + Comparison is done by canonicalizing both xml`s. Parameters can be passed either as DOMDocument, DOMNode, XML string, or array (if no attributes). @@ -210,8 +240,12 @@ $I->seeSoapRequestIncludes($dom); #### seeSoapResponseIncludes - + +* `param XmlBuilder|DOMDocument|string` $xml +* `return void` + Checks XML response includes provided XML. + Comparison is done by canonicalizing both xml`s. Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes). @@ -229,11 +263,13 @@ $I->seeSoapRequestIncludes($dom); {% endhighlight %} - * `param XmlBuilder|DOMDocument|string` $xml - #### sendSoapRequest - + +* `param string` $action +* `param object|string` $body +* `return void` + Submits request to endpoint. Requires of api function name and parameters. @@ -252,7 +288,4 @@ $I->sendSoapRequest('UpdateUser', \Codeception\Utils\Soap::request()->user {% endhighlight %} - * `param string` $action - * `param object|string` $body -

 

Module reference is taken from the source code. Help us to improve documentation. Edit module reference
diff --git a/docs/modules/Symfony.md b/docs/modules/Symfony.md index 5292202f3..46e750ad8 100644 --- a/docs/modules/Symfony.md +++ b/docs/modules/Symfony.md @@ -110,7 +110,11 @@ in addition to Symfony module. #### _findElements *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param mixed` $locator +* `return iterable` + Locates element using available Codeception locator types: * XPath @@ -134,11 +138,14 @@ WebDriver module returns `Facebook\WebDriver\Remote\RemoteWebElement` instances PhpBrowser and Framework modules return `Symfony\Component\DomCrawler\Crawler` instances - #### _getResponseContent *hidden API method, expected to be used from Helper classes* - + +* `api` +* `throws ModuleException` +* `return string` + Returns content of the last response Use it in Helpers when you want to retrieve response of request performed by another module. @@ -153,14 +160,22 @@ public function seeResponseContains($text) {% endhighlight %} -@throws ModuleException - #### _loadPage *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param string` $method +* `param string` $uri +* `param array` $parameters +* `param array` $files +* `param array` $server +* `param ?string` $content +* `return void` + Opens a page with arbitrary request parameters. + Useful for testing multi-step forms on a specific step. {% highlight php %} @@ -174,12 +189,23 @@ public function openCheckoutFormStep2($orderId) { {% endhighlight %} - #### _request *hidden API method, expected to be used from Helper classes* - + +* `api` +* `see` `_loadPage` +* `param string` $method +* `param string` $uri +* `param array` $parameters +* `param array` $files +* `param array` $server +* `param ?string` $content +* `throws ExternalUrlException|ModuleException` +* `return ?string` + Send custom request to a backend using method, uri, parameters, etc. + Use it in Helpers to create special request actions, like accessing API Returns a string with response body. @@ -197,14 +223,15 @@ public function createUserByApi($name) { Does not load the response into the module so you can't interact with response page (click, fill forms). To load arbitrary page for interaction, use `_loadPage` method. -@throws ExternalUrlException|ModuleException -@see `_loadPage` - #### _savePageSource *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param string` $filename +* `return void` + Saves page source of to a file {% highlight php %} @@ -215,13 +242,23 @@ $this->getModule('Symfony')->_savePageSource(codecept_output_dir().'page.html'); #### amHttpAuthenticated - + +* `param string` $username +* `param string` $password +* `return void` + Authenticates user for HTTP_AUTH #### amLoggedInAs - + +* `param UserInterface` $user +* `param string` $firewallName +* `param null` $firewallContext +* `return void` + Login with the given user object. + The `$user` object must have a persistent identifier. If you have more than one firewall or firewall context, you can specify the desired one as a parameter. @@ -235,13 +272,13 @@ $I->amLoggedInAs($user); {% endhighlight %} - * `param UserInterface` $user - * `param string` $firewallName - * `param null` $firewallContext - #### amOnAction - + +* `param string` $action +* `param array` $params +* `return void` + Opens web page by action name {% highlight php %} @@ -253,12 +290,12 @@ $I->amOnAction('ArticleController', ['slug' => 'lorem-ipsum']); {% endhighlight %} - * `param string` $action - * `param array` $params - #### amOnPage - + +* `param string` $page +* `return void` + Opens the page for the given relative URI. {% highlight php %} @@ -273,7 +310,11 @@ $I->amOnPage('/register'); #### amOnRoute - + +* `param string` $routeName +* `param array` $params +* `return void` + Opens web page using route name and parameters. {% highlight php %} @@ -284,14 +325,17 @@ $I->amOnRoute('posts.show', ['id' => 34]); {% endhighlight %} - * `param string` $routeName - * `param array` $params - #### assertEmailAddressContains - + +* `param string` $headerName +* `param string` $expectedValue +* `param ?\Symfony\Component\Mime\Email` $email +* `return void` + Verify that an email contains addresses with a [header](https://datatracker.ietf.org/doc/html/rfc4021) `$headerName` and its expected value `$expectedValue`. + If the Email object is not specified, the last email sent is used instead. {% highlight php %} @@ -303,8 +347,13 @@ $I->assertEmailAddressContains('To', 'jane_doe@example.com'); #### assertEmailAttachmentCount - + +* `param int` $count +* `param ?\Symfony\Component\Mime\Email` $email +* `return void` + Verify that an email has sent the specified number `$count` of attachments. + If the Email object is not specified, the last email sent is used instead. {% highlight php %} @@ -316,8 +365,13 @@ $I->assertEmailAttachmentCount(1); #### assertEmailHasHeader - + +* `param string` $headerName +* `param ?\Symfony\Component\Mime\Email` $email +* `return void` + Verify that an email has a [header](https://datatracker.ietf.org/doc/html/rfc4021) `$headerName`. + If the Email object is not specified, the last email sent is used instead. {% highlight php %} @@ -329,9 +383,15 @@ $I->assertEmailHasHeader('Bcc'); #### assertEmailHeaderNotSame - + +* `param string` $headerName +* `param string` $expectedValue +* `param ?\Symfony\Component\Mime\Email` $email +* `return void` + Verify that the [header](https://datatracker.ietf.org/doc/html/rfc4021) `$headerName` of an email is not the expected one `$expectedValue`. + If the Email object is not specified, the last email sent is used instead. {% highlight php %} @@ -343,9 +403,15 @@ $I->assertEmailHeaderNotSame('To', 'john_doe@gmail.com'); #### assertEmailHeaderSame - + +* `param string` $headerName +* `param string` $expectedValue +* `param ?\Symfony\Component\Mime\Email` $email +* `return void` + Verify that the [header](https://datatracker.ietf.org/doc/html/rfc4021) `$headerName` of an email is the same as expected `$expectedValue`. + If the Email object is not specified, the last email sent is used instead. {% highlight php %} @@ -357,8 +423,13 @@ $I->assertEmailHeaderSame('To', 'jane_doe@gmail.com'); #### assertEmailHtmlBodyContains - + +* `param string` $text +* `param ?\Symfony\Component\Mime\Email` $email +* `return void` + Verify that the HTML body of an email contains `$text`. + If the Email object is not specified, the last email sent is used instead. {% highlight php %} @@ -370,8 +441,13 @@ $I->assertEmailHtmlBodyContains('Successful registration'); #### assertEmailHtmlBodyNotContains - + +* `param string` $text +* `param ?\Symfony\Component\Mime\Email` $email +* `return void` + Verify that the HTML body of an email does not contain a text `$text`. + If the Email object is not specified, the last email sent is used instead. {% highlight php %} @@ -383,8 +459,13 @@ $I->assertEmailHtmlBodyNotContains('userpassword'); #### assertEmailNotHasHeader - + +* `param string` $headerName +* `param ?\Symfony\Component\Mime\Email` $email +* `return void` + Verify that an email does not have a [header](https://datatracker.ietf.org/doc/html/rfc4021) `$headerName`. + If the Email object is not specified, the last email sent is used instead. {% highlight php %} @@ -396,8 +477,13 @@ $I->assertEmailNotHasHeader('Bcc'); #### assertEmailTextBodyContains - + +* `param string` $text +* `param ?\Symfony\Component\Mime\Email` $email +* `return void` + Verify the text body of an email contains a `$text`. + If the Email object is not specified, the last email sent is used instead. {% highlight php %} @@ -409,8 +495,13 @@ $I->assertEmailTextBodyContains('Example text body'); #### assertEmailTextBodyNotContains - + +* `param string` $text +* `param ?\Symfony\Component\Mime\Email` $email +* `return void` + Verify that the text body of an email does not contain a `$text`. + If the Email object is not specified, the last email sent is used instead. {% highlight php %} @@ -422,7 +513,11 @@ $I->assertEmailTextBodyNotContains('My secret text body'); #### attachFile - + +* `param ` $field +* `param string` $filename +* `return void` + Attaches a file relative to the Codeception `_data` directory to the given file upload field. {% highlight php %} @@ -435,7 +530,10 @@ $I->attachFile('input[@type="file"]', 'prices.xls'); #### checkOption - + +* `param ` $option +* `return void` + Ticks a checkbox. For radio buttons, use the `selectOption` method instead. {% highlight php %} @@ -447,8 +545,13 @@ $I->checkOption('#agree'); #### click - + +* `param string|array` $link +* `param ` $context +* `return void` + 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. @@ -475,11 +578,13 @@ $I->click('Logout', '#nav'); $I->click(['link' => 'Login']); {% endhighlight %} - * `param string|array` $link #### deleteHeader - + +* `param string` $name the name of the header to delete. +* `return void` + Deletes the header with the passed name. Subsequent requests will not have the deleted header in its request. @@ -495,12 +600,15 @@ $I->amOnPage('some-other-page.php'); {% endhighlight %} - * `param string` $name the name of the header to delete. - #### dontSee - + +* `param array|string` $selector optional +* `param string` $text +* `return void` + Checks that the current page doesn't contain the text specified (case insensitive). + Give a locator as the second parameter to match a specific region. {% highlight php %} @@ -527,11 +635,11 @@ But will ignore strings like: For checking the raw source code, use `seeInSource()`. - * `param array|string` $selector optional - #### dontSeeAuthentication - + +* `return void` + Check that user is not authenticated. {% highlight php %} @@ -543,7 +651,10 @@ $I->dontSeeAuthentication(); #### dontSeeCheckboxIsChecked - + +* `param ` $checkbox +* `return void` + Check that the specified checkbox is unchecked. {% highlight php %} @@ -556,16 +667,23 @@ $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user #### dontSeeCookie - + +* `param ` $cookie +* `param ` $params +* `return mixed|void` + Checks that there isn't a cookie with the given name. -You can set additional cookie params like `domain`, `path` as array passed in last argument. - * `return mixed|void` +You can set additional cookie params like `domain`, `path` as array passed in last argument. #### dontSeeCurrentUrlEquals - + +* `param string` $uri +* `return void` + Checks that the current URL doesn't equal the given string. + Unlike `dontSeeInCurrentUrl`, this only matches the full URL. {% highlight php %} @@ -578,7 +696,10 @@ $I->dontSeeCurrentUrlEquals('/'); #### dontSeeCurrentUrlMatches - + +* `param string` $uri +* `return void` + Checks that current url doesn't match the given regular expression. {% highlight php %} @@ -591,8 +712,13 @@ $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~'); #### dontSeeElement - + +* `param ` $selector +* `param array` $attributes +* `return void` + Checks that the given element is invisible or not present on the page. + You can also specify expected attributes of this element. {% highlight php %} @@ -607,15 +733,21 @@ $I->dontSeeElement('input', ['value' => '123456']); #### dontSeeEmailIsSent - + +* `return void` + Checks that no email was sent. + The check is based on `\Symfony\Component\Mailer\EventListener\MessageLoggerListener`, which means: If your app performs a HTTP redirect, you need to suppress it using [stopFollowingRedirects()](https://codeception.com/docs/modules/Symfony#stopFollowingRedirects) first; otherwise this check will *always* pass. Starting with version 2.0.0, `codeception/module-symfony` requires your app to use [Symfony Mailer](https://symfony.com/doc/current/mailer.html). If your app still uses [Swift Mailer](https://symfony.com/doc/current/email.html), set your version constraint to `^1.6`. #### dontSeeEventTriggered - + +* `param string|object|string[]` $expected +* `return void` + Verifies that one or more event listeners were not called during the test. {% highlight php %} @@ -627,11 +759,11 @@ $I->dontSeeEventTriggered(['App\MyEvent', 'App\MyOtherEvent']); {% endhighlight %} - * `param string|object|string[]` $expected - #### dontSeeFormErrors - + +* `return void` + Verifies that there are no errors bound to the submitted form. {% highlight php %} @@ -643,7 +775,10 @@ $I->dontSeeFormErrors(); #### dontSeeInCurrentUrl - + +* `param string` $uri +* `return void` + Checks that the current URI doesn't contain the given string. {% highlight php %} @@ -655,8 +790,13 @@ $I->dontSeeInCurrentUrl('/users/'); #### dontSeeInField - + +* `param string|array` $field +* `param ` $value +* `return void` + Checks that an input field or textarea doesn't contain the given value. + For fuzzy locators, the field is matched by label text, CSS and XPath. {% highlight php %} @@ -670,11 +810,14 @@ $I->dontSeeInField('//form/*[@name=search]','Search'); $I->dontSeeInField(['name' => 'search'], 'Search'); {% endhighlight %} - * `param string|array` $field #### dontSeeInFormFields - + +* `param ` $formSelector +* `param array` $params +* `return void` + Checks if the array of form parameters (name => value) are not set on the form matched with the passed selector. @@ -717,7 +860,11 @@ $I->dontSeeInFormFields('#form-id', [ #### dontSeeInSession - + +* `param string` $attribute +* `param mixed|null` $value +* `return void` + Assert that a session attribute does not exist, or is not equal to the passed value. {% highlight php %} @@ -728,12 +875,12 @@ $I->dontSeeInSession('attribute', 'value'); {% endhighlight %} - * `param string` $attribute - * `param mixed|null` $value - #### dontSeeInSource - + +* `param string` $raw +* `return void` + Checks that the current page contains the given string in its raw source code. @@ -746,15 +893,21 @@ $I->dontSeeInSource('

Green eggs & ham

'); #### dontSeeInTitle - -Checks that the page title does not contain the given string. - * `return mixed|void` +* `param ` $title +* `return mixed|void` + +Checks that the page title does not contain the given string. #### dontSeeLink - + +* `param string` $text +* `param string` $url +* `return void` + Checks that the page doesn't contain a link with the given string. + If the second parameter is given, only links with a matching "href" attribute will be checked. {% highlight php %} @@ -767,7 +920,11 @@ $I->dontSeeLink('Checkout now', '/store/cart.php'); #### dontSeeOptionIsSelected - + +* `param ` $selector +* `param ` $optionText +* `return mixed|void` + Checks that the given option is not selected. {% highlight php %} @@ -777,11 +934,12 @@ $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); {% endhighlight %} - * `return mixed|void` - #### dontSeeOrphanEvent - + +* `param string|object|string[]` $expected +* `return void` + Verifies that there were no orphan events during the test. An orphan event is an event that was triggered by manually executing the @@ -798,11 +956,11 @@ $I->dontSeeOrphanEvent(['App\MyEvent', 'App\MyOtherEvent']); {% endhighlight %} - * `param string|object|string[]` $expected - #### dontSeeRememberedAuthentication - + +* `return void` + Check that user is not authenticated with the 'remember me' option. {% highlight php %} @@ -814,7 +972,10 @@ $I->dontSeeRememberedAuthentication(); #### dontSeeRenderedTemplate - + +* `param string` $template +* `return void` + Asserts that a template was not rendered in the response. {% highlight php %} @@ -824,11 +985,12 @@ $I->dontSeeRenderedTemplate('home.html.twig'); {% endhighlight %} - * `param string` $template - #### dontSeeResponseCodeIs - + +* `param int` $code +* `return void` + Checks that response code is equal to value provided. {% highlight php %} @@ -843,7 +1005,11 @@ $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK); #### fillField - + +* `param ` $field +* `param ` $value +* `return void` + Fills a text field or textarea with the given string. {% highlight php %} @@ -856,7 +1022,9 @@ $I->fillField(['name' => 'email'], 'jon@example.com'); #### followRedirect - + +* `return void` + Follow pending redirect if there is one. {% highlight php %} @@ -868,16 +1036,24 @@ $I->followRedirect(); #### goToLogoutPath - + +* `return void` + Go to the configured logout url (by default: `/logout`). + This method includes redirection to the destination page configured after logout. See the Symfony documentation on ['Logging Out'](https://symfony.com/doc/current/security.html#logging-out). #### grabAttributeFrom - + +* `param ` $cssOrXpath +* `param string` $attribute +* `return mixed` + Grabs the value of the given attribute value from the given element. + Fails if element is not found. {% highlight php %} @@ -889,15 +1065,24 @@ $I->grabAttributeFrom('#tooltip', 'title'); #### grabCookie - + +* `param string` $cookie +* `param array` $params +* `return mixed` + Grabs a cookie value. + You can set additional cookie params like `domain`, `path` in array passed as last argument. If the cookie is set by an ajax request (XMLHttpRequest), there might be some delay caused by the browser, so try `$I->wait(0.1)`. #### grabFromCurrentUrl - + +* `param ?string` $uri +* `return mixed` + Executes the given regular expression against the current URI and returns the first capturing group. + If no parameters are provided, the full URI is returned. {% highlight php %} @@ -910,8 +1095,11 @@ $uri = $I->grabFromCurrentUrl(); #### grabLastSentEmail - + +* `return \Symfony\Component\Mime\Email|null` + Returns the last sent email. + The function is based on `\Symfony\Component\Mailer\EventListener\MessageLoggerListener`, which means: If your app performs a HTTP redirect after sending the email, you need to suppress it using [stopFollowingRedirects()](https://codeception.com/docs/modules/Symfony#stopFollowingRedirects) first. Starting with version 2.0.0, `codeception/module-symfony` requires your app to use [Symfony Mailer](https://symfony.com/doc/current/mailer.html). If your app still uses [Swift Mailer](https://symfony.com/doc/current/email.html), set your version constraint to `^1.6`. @@ -926,11 +1114,13 @@ $I->assertSame('john_doe@example.com', $address->getAddress()); {% endhighlight %} - * `return \Symfony\Component\Mime\Email|null` - #### grabMultiple - + +* `param ` $cssOrXpath +* `param ?string` $attribute +* `return string[]` + Grabs either the text content, or attribute values, of nodes matched by $cssOrXpath and returns them as an array. @@ -953,11 +1143,13 @@ $aLinks = $I->grabMultiple('a', 'href'); {% endhighlight %} - * `return string[]` - #### grabNumRecords - + +* `param string` $entityClass The entity class +* `param array` $criteria Optional query criteria +* `return int` + Retrieves number of records from database 'id' is the default search parameter. @@ -968,21 +1160,20 @@ $I->grabNumRecords('User::class', ['name' => 'davert']); {% endhighlight %} - * `param string` $entityClass The entity class - * `param array` $criteria Optional query criteria - * `return int` - #### grabPageSource - -Grabs current page source code. -@throws ModuleException if no page was opened. - * `return string` Current page source code. +* `throws ModuleException` if no page was opened. +* `return string` Current page source code. + +Grabs current page source code. #### grabParameter - + +* `param string` $name +* `return array|bool|float|int|string|null` + Grabs a Symfony parameter {% highlight php %} @@ -992,13 +1183,14 @@ $I->grabParameter('app.business_name'); {% endhighlight %} - * `param string` $name - * `return array|bool|float|int|string|null` - #### grabRepository - + +* `param object|string` $mixed +* `return \Doctrine\ORM\EntityRepository|null` + Grab a Doctrine entity repository. + Works with objects, entities, repositories, and repository interfaces. {% highlight php %} @@ -1011,13 +1203,13 @@ $I->grabRepository(UserRepositoryInterface::class); {% endhighlight %} - * `param object|string` $mixed - * `return \Doctrine\ORM\EntityRepository|null` - #### grabSentEmails - + +* `return \Symfony\Component\Mime\Email[]` + Returns an array of all sent emails. + The function is based on `\Symfony\Component\Mailer\EventListener\MessageLoggerListener`, which means: If your app performs a HTTP redirect after sending the email, you need to suppress it using [stopFollowingRedirects()](https://codeception.com/docs/modules/Symfony#stopFollowingRedirects) first. Starting with version 2.0.0, `codeception/module-symfony` requires your app to use [Symfony Mailer](https://symfony.com/doc/current/mailer.html). If your app still uses [Swift Mailer](https://symfony.com/doc/current/email.html), set your version constraint to `^1.6`. @@ -1030,12 +1222,15 @@ $emails = $I->grabSentEmails(); {% endhighlight %} - * `return \Symfony\Component\Mime\Email[]` - #### grabService - + +* `part` services +* `param string` $serviceId +* `return object` + Grabs a service from the Symfony dependency injection container (DIC). + In "test" environment, Symfony uses a special `test.service_container`. See the "[Public Versus Private Services](https://symfony.com/doc/current/service_container/alias_private.html#marking-services-as-public-private)" documentation. Services that aren't injected somewhere into your app, need to be defined as `public` to be accessible by Codeception. @@ -1047,14 +1242,14 @@ $em = $I->grabService('doctrine'); {% endhighlight %} - * `[Part]` services - * `param string` $serviceId - * `return object` - #### grabTextFrom - + +* `param ` $cssOrXPathOrRegex +* `return mixed` + Finds and returns the text contents of the given element. + If a fuzzy locator is used, the element is found using CSS, XPath, and by matching the full page source by regular expression. @@ -1069,8 +1264,12 @@ $value = $I->grabTextFrom('~grabValueFrom(['name' => 'username']); #### haveHttpHeader - + +* `param string` $name the name of the request header +* `param string` $value the value to set it to for subsequent + requests +* `return void` + Sets the HTTP header to the passed value - which is used on subsequent HTTP requests through PhpBrowser. @@ -1110,13 +1314,13 @@ $I->haveHttpHeader('Client_Id', 'Codeception'); {% endhighlight %} - * `param string` $name the name of the request header - * `param string` $value the value to set it to for subsequent - requests - #### haveServerParameter - + +* `param string` $name +* `param string` $value +* `return void` + Sets SERVER parameter valid for all next requests. {% highlight php %} @@ -1127,12 +1331,16 @@ $I->haveServerParameter('name', 'value'); #### invalidateCachedRouter - + +* `return void` + Invalidate previously cached routes. #### logout - + +* `return void` + Alias method for [`logoutProgrammatically()`](https://codeception.com/docs/modules/Symfony#logoutProgrammatically) {% highlight php %} @@ -1144,8 +1352,11 @@ $I->logout(); #### logoutProgrammatically - + +* `return void` + Invalidates the current user's session and expires the session cookies. + This method does not include any redirects after logging out. {% highlight php %} @@ -1157,7 +1368,10 @@ $I->logoutProgrammatically(); #### makeHtmlSnapshot - + +* `param ?string` $name +* `return void` + Use this method within an [interactive pause](https://codeception.com/docs/02-GettingStarted#Interactive-Pause) to save the HTML source code of the current page. {% highlight php %} @@ -1172,32 +1386,38 @@ $I->makeHtmlSnapshot(); #### moveBack - -Moves back in history. - * `param int` $numberOfSteps (default value 1) +* `param int` $numberOfSteps (default value 1) +* `return void` + +Moves back in history. #### persistPermanentService - + +* `part` services +* `param string` $serviceName +* `return void` + Get service $serviceName and add it to the lists of persistent services, making that service persistent between tests. - * `[Part]` services - * `param string` $serviceName - #### persistService - -Get service $serviceName and add it to the lists of persistent services. - * `[Part]` services - * `param string` $serviceName +* `part` services +* `param string` $serviceName +* `return void` + +Get service $serviceName and add it to the lists of persistent services. #### rebootClientKernel - + +* `return void` + Reboot client's kernel. + Can be used to manually reboot kernel when 'rebootable_client' => false {% highlight php %} @@ -1214,18 +1434,27 @@ $I->rebootClientKernel(); {% endhighlight %} - #### resetCookie - + +* `param ` $cookie +* `param ` $params +* `return mixed|void` + Unsets cookie with the given name. -You can set additional cookie params like `domain`, `path` in array passed as last argument. - * `return mixed|void` +You can set additional cookie params like `domain`, `path` in array passed as last argument. #### runSymfonyConsoleCommand - + +* `param string` $command The console command to execute +* `param array` $parameters Parameters (arguments and options) to pass to the command +* `param array` $consoleInputs Console inputs (e.g. used for interactive questions) +* `param int` $expectedExitCode The expected exit code of the command +* `return string` Returns the console output of the command + Run Symfony console command, grab response and return as string. + Recommended to use for integration or functional testing. {% highlight php %} @@ -1235,15 +1464,13 @@ $result = $I->runSymfonyConsoleCommand('hello:world', ['arg' => 'argValue', 'opt {% endhighlight %} - * `param string` $command The console command to execute - * `param array` $parameters Parameters (arguments and options) to pass to the command - * `param array` $consoleInputs Console inputs (e.g. used for interactive questions) - * `param int` $expectedExitCode The expected exit code of the command - * `return string` Returns the console output of the command - #### see - + +* `param array|string` $selector optional +* `param string` $text +* `return void` + 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 @@ -1273,11 +1500,11 @@ But will *not* be true for strings like: For checking the raw source code, use `seeInSource()`. - * `param array|string` $selector optional - #### seeAuthentication - + +* `return void` + Checks that a user is authenticated. {% highlight php %} @@ -1289,7 +1516,10 @@ $I->seeAuthentication(); #### seeCheckboxIsChecked - + +* `param ` $checkbox +* `return void` + Checks that the specified checkbox is checked. {% highlight php %} @@ -1303,8 +1533,13 @@ $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); #### seeCookie - + +* `param ` $cookie +* `param ` $params +* `return mixed|void` + Checks that a cookie with the given name is set. + You can set additional cookie params like `domain`, `path` as array passed in last argument. {% highlight php %} @@ -1314,11 +1549,12 @@ $I->seeCookie('PHPSESSID'); {% endhighlight %} - * `return mixed|void` - #### seeCurrentActionIs - + +* `param string` $action +* `return void` + Checks that current page matches action {% highlight php %} @@ -1329,11 +1565,13 @@ $I->seeCurrentActionIs('HomeController'); {% endhighlight %} - * `param string` $action - #### seeCurrentRouteIs - + +* `param string` $routeName +* `param array` $params +* `return void` + Checks that current url matches route. {% highlight php %} @@ -1344,12 +1582,12 @@ $I->seeCurrentRouteIs('posts.show', ['id' => 8]); {% endhighlight %} - * `param string` $routeName - * `param array` $params - #### seeCurrentTemplateIs - + +* `param string` $expectedTemplate +* `return void` + Asserts that the current template matches the expected template. {% highlight php %} @@ -1359,12 +1597,14 @@ $I->seeCurrentTemplateIs('home.html.twig'); {% endhighlight %} - * `param string` $expectedTemplate - #### seeCurrentUrlEquals - + +* `param string` $uri +* `return void` + Checks that the current URL is equal to the given string. + Unlike `seeInCurrentUrl`, this only matches the full URL. {% highlight php %} @@ -1377,7 +1617,10 @@ $I->seeCurrentUrlEquals('/'); #### seeCurrentUrlMatches - + +* `param string` $uri +* `return void` + Checks that the current URL matches the given regular expression. {% highlight php %} @@ -1390,8 +1633,13 @@ $I->seeCurrentUrlMatches('~^/users/(\d+)~'); #### seeElement - + +* `param ` $selector +* `param array` $attributes +* `return void` + Checks that the given element exists on the page and is visible. + You can also specify expected attributes of this element. {% highlight php %} @@ -1409,8 +1657,12 @@ $I->seeElement(['css' => 'form input'], ['name' => 'login']); #### seeEmailIsSent - + +* `param int` $expectedCount The expected number of emails sent +* `return void` + Checks if the given number of emails was sent (default `$expectedCount`: 1). + The check is based on `\Symfony\Component\Mailer\EventListener\MessageLoggerListener`, which means: If your app performs a HTTP redirect after sending the email, you need to suppress it using [stopFollowingRedirects()](https://codeception.com/docs/modules/Symfony#stopFollowingRedirects) first. Starting with version 2.0.0, `codeception/module-symfony` requires your app to use [Symfony Mailer](https://symfony.com/doc/current/mailer.html). If your app still uses [Swift Mailer](https://symfony.com/doc/current/email.html), set your version constraint to `^1.6`. @@ -1422,11 +1674,12 @@ $I->seeEmailIsSent(2); {% endhighlight %} - * `param int` $expectedCount The expected number of emails sent - #### seeEventTriggered - + +* `param string|object|string[]` $expected +* `return void` + Verifies that one or more event listeners were called during the test. {% highlight php %} @@ -1438,12 +1691,15 @@ $I->seeEventTriggered(['App\MyEvent', 'App\MyOtherEvent']); {% endhighlight %} - * `param string|object|string[]` $expected - #### seeFormErrorMessage - + +* `param string` $field +* `param string|null` $message +* `return void` + Verifies that a form field has an error. + You can specify the expected error message as second parameter. {% highlight php %} @@ -1454,12 +1710,12 @@ $I->seeFormErrorMessage('username', 'Username is empty'); {% endhighlight %} - * `param string` $field - * `param string|null` $message - #### seeFormErrorMessages - + +* `param string[]` $expectedErrors +* `return void` + Verifies that multiple fields on a form have errors. If you only specify the name of the fields, this method will @@ -1506,11 +1762,11 @@ $I->seeFormErrorMessages([ {% endhighlight %} - * `param string[]` $expectedErrors - #### seeFormHasErrors - + +* `return void` + Verifies that there are one or more errors bound to the submitted form. {% highlight php %} @@ -1522,8 +1778,12 @@ $I->seeFormHasErrors(); #### seeInCurrentRoute - + +* `param string` $routeName +* `return void` + Checks that current url matches route. + Unlike seeCurrentRouteIs, this can matches without exact route parameters {% highlight php %} @@ -1533,11 +1793,12 @@ $I->seeInCurrentRoute('my_blog_pages'); {% endhighlight %} - * `param string` $routeName - #### seeInCurrentUrl - + +* `param string` $uri +* `return void` + Checks that current URI contains the given string. {% highlight php %} @@ -1552,8 +1813,13 @@ $I->seeInCurrentUrl('/users/'); #### seeInField - + +* `param string|array` $field +* `param ` $value +* `return void` + Checks that the given input field or textarea *equals* (i.e. not just contains) the given value. + Fields are matched by label text, the "name" attribute, CSS, or XPath. {% highlight php %} @@ -1568,11 +1834,13 @@ $I->seeInField(['name' => 'search'], 'Search'); {% endhighlight %} - * `param string|array` $field - #### seeInFormFields - + +* `param ` $formSelector +* `param array` $params +* `return void` + Checks if the array of form parameters (name => value) are set on the form matched with the passed selector. @@ -1636,7 +1904,11 @@ $I->seeInFormFields('//form[@id=my-form]', string $form); #### seeInSession - + +* `param string` $attribute +* `param mixed|null` $value +* `return void` + Assert that a session attribute exists. {% highlight php %} @@ -1647,12 +1919,12 @@ $I->seeInSession('attribute', 'value'); {% endhighlight %} - * `param string` $attribute - * `param mixed|null` $value - #### seeInSource - + +* `param string` $raw +* `return void` + Checks that the current page contains the given string in its raw source code. @@ -1665,7 +1937,10 @@ $I->seeInSource('

Green eggs & ham

'); #### seeInTitle - + +* `param ` $title +* `return mixed|void` + Checks that the page title contains the given string. {% highlight php %} @@ -1675,12 +1950,15 @@ $I->seeInTitle('Blog - Post #1'); {% endhighlight %} - * `return mixed|void` - #### seeLink - + +* `param string` $text +* `param ?string` $url +* `return void` + Checks that there's a link with the specified text. + Give a full URL as the second parameter to match links with that exact URL. {% highlight php %} @@ -1693,8 +1971,14 @@ $I->seeLink('Logout','/logout'); // matches Logout #### seeNumRecords - + +* `param int` $expectedNum Expected number of records +* `param string` $className A doctrine entity +* `param array` $criteria Optional query criteria +* `return void` + Checks that number of given records were found in database. + 'id' is the default search parameter. {% highlight php %} @@ -1705,13 +1989,13 @@ $I->seeNumRecords(80, User::class); {% endhighlight %} - * `param int` $expectedNum Expected number of records - * `param string` $className A doctrine entity - * `param array` $criteria Optional query criteria - #### seeNumberOfElements - + +* `param int|int[]` $expected +* `param ` $selector +* `return void` + Checks that there are a certain number of elements matched by the given locator on the page. {% highlight php %} @@ -1722,11 +2006,13 @@ $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements {% endhighlight %} - * `param int|int[]` $expected - #### seeOptionIsSelected - + +* `param ` $selector +* `param ` $optionText +* `return mixed|void` + Checks that the given option is selected. {% highlight php %} @@ -1736,11 +2022,12 @@ $I->seeOptionIsSelected('#form input[name=payment]', 'Visa'); {% endhighlight %} - * `return mixed|void` - #### seeOrphanEvent - + +* `param string|object|string[]` $expected +* `return void` + Verifies that one or more orphan events were dispatched during the test. An orphan event is an event that was triggered by manually executing the @@ -1756,12 +2043,14 @@ $I->seeOrphanEvent(['App\MyEvent', 'App\MyOtherEvent']); {% endhighlight %} - * `param string|object|string[]` $expected - #### seePageIsAvailable - + +* `param string|null` $url +* `return void` + Verifies that a page is available. + By default it checks the current page, specify the `$url` parameter to change it. {% highlight php %} @@ -1774,16 +2063,20 @@ $I->seePageIsAvailable('/dashboard'); // Same as above {% endhighlight %} - * `param string|null` $url - #### seePageNotFound - + +* `return void` + Asserts that current page has 404 response status code. #### seePageRedirectsTo - + +* `param string` $page +* `param string` $redirectsTo +* `return void` + Goes to a page and check that it redirects to another. {% highlight php %} @@ -1793,12 +2086,11 @@ $I->seePageRedirectsTo('/admin', '/login'); {% endhighlight %} - * `param string` $page - * `param string` $redirectsTo - #### seeRememberedAuthentication - + +* `return void` + Checks that a user is authenticated with the 'remember me' option. {% highlight php %} @@ -1810,8 +2102,12 @@ $I->seeRememberedAuthentication(); #### seeRenderedTemplate - + +* `param string` $template +* `return void` + Asserts that a template was rendered in the response. + That includes templates built with [inheritance](https://twig.symfony.com/doc/3.x/templates.html#template-inheritance). {% highlight php %} @@ -1822,11 +2118,12 @@ $I->seeRenderedTemplate('layout.html.twig'); {% endhighlight %} - * `param string` $template - #### seeRequestTimeIsLessThan - + +* `param int|float` $expectedMilliseconds The expected time in milliseconds +* `return void` + Asserts that the time a request lasted is less than expected. If the page performed a HTTP redirect, only the time of the last request will be taken into account. @@ -1838,11 +2135,12 @@ which could lead to unreliable results when used together. It is recommended to set [`rebootable_client`](https://codeception.com/docs/modules/Symfony#Config) to `true` (=default), cause otherwise this assertion gives false results if you access multiple pages in a row, or if your app performs a redirect. - * `param int|float` $expectedMilliseconds The expected time in milliseconds - #### seeResponseCodeIs - + +* `param int` $code +* `return void` + Checks that response code is equal to value provided. {% highlight php %} @@ -1857,32 +2155,47 @@ $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK); #### seeResponseCodeIsBetween - + +* `param int` $from +* `param int` $to +* `return void` + Checks that response code is between a certain range. Between actually means [from <= CODE <= to] #### seeResponseCodeIsClientError - + +* `return void` + Checks that the response code is 4xx #### seeResponseCodeIsRedirection - + +* `return void` + Checks that the response code 3xx #### seeResponseCodeIsServerError - + +* `return void` + Checks that the response code is 5xx #### seeResponseCodeIsSuccessful - + +* `return void` + Checks that the response code 2xx #### seeSessionHasValues - + +* `param array` $bindings +* `return void` + Assert that the session has a given list of values. {% highlight php %} @@ -1893,11 +2206,12 @@ $I->seeSessionHasValues(['key1' => 'value1', 'key2' => 'value2']); {% endhighlight %} - * `param array` $bindings - #### seeUserHasRole - + +* `param string` $role +* `return void` + Check that the current user has a role {% highlight php %} @@ -1907,11 +2221,12 @@ $I->seeUserHasRole('ROLE_ADMIN'); {% endhighlight %} - * `param string` $role - #### seeUserHasRoles - + +* `param string[]` $roles +* `return void` + Verifies that the current user has multiple roles {% highlight php %} @@ -1921,12 +2236,14 @@ $I->seeUserHasRoles(['ROLE_USER', 'ROLE_ADMIN']); {% endhighlight %} - * `param string[]` $roles - #### seeUserPasswordDoesNotNeedRehash - + +* `param UserInterface|null` $user +* `return void` + Checks that the user's password would not benefit from rehashing. + If the user is not provided it is taken from the current session. You might use this function after performing tasks like registering a user or submitting a password update form. @@ -1939,11 +2256,13 @@ $I->seeUserPasswordDoesNotNeedRehash($user); {% endhighlight %} - * `param UserInterface|null` $user - #### selectOption - + +* `param ` $select +* `param ` $option +* `return void` + Selects an option in a select tag or in radio button group. {% highlight php %} @@ -1976,14 +2295,24 @@ $I->selectOption('Which OS do you use?', array('value' => 'windows')); // Only s #### sendAjaxGetRequest - + +* `param string` $uri +* `param array` $params +* `return void` + Sends an ajax GET request with the passed parameters. + See `sendAjaxPostRequest()` #### sendAjaxPostRequest - + +* `param string` $uri +* `param array` $params +* `return void` + Sends an ajax POST request with the passed parameters. + The appropriate HTTP header is added automatically: `X-Requested-With: XMLHttpRequest` Example: @@ -2008,8 +2337,14 @@ $I->sendAjaxPostRequest('/add-task', ['form' => [ #### sendAjaxRequest - + +* `param string` $method +* `param string` $uri +* `param array` $params +* `return void` + Sends an ajax request, using the passed HTTP method. + See `sendAjaxPostRequest()` Example: {% highlight php %} @@ -2021,8 +2356,14 @@ $I->sendAjaxRequest('PUT', '/posts/7', ['title' => 'new title']); #### setCookie - + +* `param ` $name +* `param ` $val +* `param ` $params +* `return mixed|void` + Sets a cookie with the given name and value. + You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument. {% highlight php %} @@ -2032,11 +2373,12 @@ $I->setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3'); {% endhighlight %} - * `return mixed|void` - #### setMaxRedirects - + +* `param int` $maxRedirects +* `return void` + Sets the maximum number of redirects that the Client can follow. {% highlight php %} @@ -2048,8 +2390,12 @@ $I->setMaxRedirects(2); #### setServerParameters - + +* `param array` $params +* `return void` + Sets SERVER parameters valid for all next requests. + this will remove old ones. {% highlight php %} @@ -2060,7 +2406,9 @@ $I->setServerParameters([]); #### startFollowingRedirects - + +* `return void` + Enables automatic redirects to be followed by the client. {% highlight php %} @@ -2072,7 +2420,9 @@ $I->startFollowingRedirects(); #### stopFollowingRedirects - + +* `return void` + Prevents automatic redirects to be followed by the client. {% highlight php %} @@ -2084,7 +2434,12 @@ $I->stopFollowingRedirects(); #### submitForm - + +* `param ` $selector +* `param array` $params +* `param ?string` $button +* `return void` + Submits the given form on the page, with the given form values. Pass the form field's values as an array in the second parameter. @@ -2274,7 +2629,11 @@ $I->submitForm('#my-form', [ #### submitSymfonyForm - + +* `param string` $name The `name` attribute of the `
` (you cannot use an array as selector here) +* `param string[]` $fields +* `return void` + Submit a form specifying the form name only once. Use this function instead of [`$I->submitForm()`](#submitForm) to avoid repeating the form name in the field selectors. @@ -2290,12 +2649,12 @@ $I->submitSymfonyForm('login_form', [ {% endhighlight %} - * `param string` $name The `name` attribute of the `` (you cannot use an array as selector here) - * `param string[]` $fields - #### switchToIframe - + +* `param string` $name +* `return void` + Switch to iframe or frame on the page. Example: @@ -2315,7 +2674,10 @@ $I->switchToIframe("another_frame"); #### uncheckOption - + +* `param ` $option +* `return void` + Unticks a checkbox. {% highlight php %} @@ -2327,10 +2689,11 @@ $I->uncheckOption('#notify'); #### unpersistService - -Remove service $serviceName from the lists of persistent services. - * `[Part]` services - * `param string` $serviceName +* `part` services +* `param string` $serviceName +* `return void` + +Remove service $serviceName from the lists of persistent services.

 

Module reference is taken from the source code. Help us to improve documentation. Edit module reference
diff --git a/docs/modules/WebDriver.md b/docs/modules/WebDriver.md index 60c1b9add..e9fdb6007 100644 --- a/docs/modules/WebDriver.md +++ b/docs/modules/WebDriver.md @@ -382,16 +382,23 @@ $this->getModule('WebDriver')->webDriver->getKeyboard()->sendKeys('hello, webdri #### _backupSession *hidden API method, expected to be used from Helper classes* - -Returns current WebDriver session for saving +* `api` +* `return \Facebook\WebDriver\WebDriver` + +Returns current WebDriver session for saving #### _capabilities *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param \Closure` $capabilityFunction +* `return void` + Change capabilities of WebDriver. Should be executed before starting a new browser session. + This method expects a function to be passed which returns array or [WebDriver Desired Capabilities](https://github.com/php-webdriver/php-webdriver/blob/main/lib/Remote/DesiredCapabilities.php) object. Additional [Chrome options](https://github.com/php-webdriver/php-webdriver/wiki/ChromeOptions) (like adding extensions) can be passed as well. @@ -438,11 +445,14 @@ public function _before(TestInterface $test) In this case, please ensure that `\Helper\Acceptance` is loaded before WebDriver so new capabilities could be applied. - #### _closeSession *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param RemoteWebDriver|null` $webDriver a specific webdriver session instance +* `return void` + Manually closes current WebDriver session. {% highlight php %} @@ -456,13 +466,16 @@ $this->getModule('WebDriver')->_closeSession($webDriver); {% endhighlight %} - * `param RemoteWebDriver|null` $webDriver a specific webdriver session instance - #### _findClickable *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param WebDriverSearchContext` $page WebDriver instance or an element to search within +* `param string|array|WebDriverBy` $link A link text or locator to click +* `return ?\Facebook\WebDriver\WebDriverElement` + Locates a clickable element. Use it in Helpers or GroupObject or Extension classes: @@ -482,14 +495,16 @@ $el = $module->_findClickable($topBar, 'Click Me'); {% endhighlight %} - * `param WebDriverSearchContext` $page WebDriver instance or an element to search within - * `param string|array|WebDriverBy` $link A link text or locator to click #### _findElements *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param ` $locator +* `return array` + Locates element using available Codeception locator types: * XPath @@ -513,28 +528,35 @@ WebDriver module returns `Facebook\WebDriver\Remote\RemoteWebElement` instances PhpBrowser and Framework modules return `Symfony\Component\DomCrawler\Crawler` instances - #### _getCurrentUri *hidden API method, expected to be used from Helper classes* - + +* `api` +* `throws ModuleException` +* `return string` + Uri of currently opened page. -@throws ModuleException #### _getUrl *hidden API method, expected to be used from Helper classes* - -Returns URL of a host. -@throws ModuleConfigException +* `api` +* `throws ModuleConfigException` +* `return mixed` + +Returns URL of a host. #### _initializeSession *hidden API method, expected to be used from Helper classes* - + +* `api` +* `return void` + Manually starts a new browser session. {% highlight php %} @@ -545,21 +567,27 @@ $this->getModule('WebDriver')->_initializeSession(); {% endhighlight %} - #### _loadSession *hidden API method, expected to be used from Helper classes* - -Loads current RemoteWebDriver instance as a session - * `param RemoteWebDriver` $session +* `api` +* `param RemoteWebDriver` $session +* `return void` + +Loads current RemoteWebDriver instance as a session #### _restart *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param array` $config +* `return void` + Restarts a web browser. + Can be used with `_reconfigure` to open browser with different configuration {% highlight php %} @@ -572,18 +600,23 @@ $this->getModule('WebDriver')->_restart(['browser' => $browser]); // reconfigure {% endhighlight %} - #### _savePageSource *hidden API method, expected to be used from Helper classes* - + +* `param string` $filename +* `return void` + Saves HTML source of a page to a file #### _saveScreenshot *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param string` $filename + Saves screenshot of current page to a file {% highlight php %} @@ -594,14 +627,20 @@ $this->getModule('WebDriver')->_saveScreenshot(codecept_output_dir().'screenshot #### acceptPopup - + +* `return void` + Accepts the active JavaScript native popup window, as created by `window.alert`|`window.confirm`|`window.prompt`. + Don't confuse popups with modal windows, as created by [various libraries](https://jster.net/category/windows-modals-popups). #### amOnPage - + +* `param ` $page +* `return void` + Opens the page for the given relative URI. {% highlight php %} @@ -616,8 +655,12 @@ $I->amOnPage('/register'); #### amOnSubdomain - + +* `param string` $subdomain +* `return void` + Changes the subdomain for the 'url' configuration parameter. + Does not open a page; use `amOnPage` for that. {% highlight php %} @@ -634,9 +677,11 @@ $I->amOnPage('/'); {% endhighlight %} - #### amOnUrl - + +* `param ` $url +* `return void` + Open web page at the given absolute URL and sets its hostname as the base host. {% highlight php %} @@ -649,8 +694,14 @@ $I->amOnPage('/quickstart'); // moves to https://codeception.com/quickstart #### appendField - + +* `param string|array|WebDriverBy` $field +* `param string` $value +* `throws ElementNotFound` +* `return void` + Append the given text to the given element. + Can also add a selection to a select box. {% highlight php %} @@ -661,13 +712,13 @@ $I->appendField('#myTextField', 'appended'); {% endhighlight %} - * `param string|array|WebDriverBy` $field - * `param string` $value -@throws ElementNotFound - #### attachFile - + +* `param ` $field +* `param string` $filename +* `return void` + Attaches a file relative to the Codeception `_data` directory to the given file upload field. {% highlight php %} @@ -680,12 +731,17 @@ $I->attachFile('input[@type="file"]', 'prices.xls'); #### cancelPopup - + +* `return void` + Dismisses the active JavaScript popup, as created by `window.alert`, `window.confirm`, or `window.prompt`. #### checkOption - + +* `param ` $option +* `return void` + Ticks a checkbox. For radio buttons, use the `selectOption` method instead. {% highlight php %} @@ -697,7 +753,10 @@ $I->checkOption('#agree'); #### clearField - + +* `param string|array|WebDriverBy` $field +* `return void` + Clears given field which isn't empty. {% highlight php %} @@ -707,12 +766,15 @@ $I->clearField('#username'); {% endhighlight %} - * `param string|array|WebDriverBy` $field - #### click - + +* `param string|array` $link +* `param ` $context +* `return void` + 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. @@ -739,12 +801,18 @@ $I->click('Logout', '#nav'); $I->click(['link' => 'Login']); {% endhighlight %} - * `param string|array` $link #### clickWithLeftButton - + +* `param null|string|array|WebDriverBy` $cssOrXPath css or xpath of the web element (body by default). +* `param ?int` $offsetX +* `param ?int` $offsetY +* `throws ElementNotFound` +* `return void` + Performs click with the left mouse button on an element. + If the first parameter `null` then the offset is relative to the actual mouse position. If the second and third parameters are given, then the mouse is moved to an offset of the element's top-left corner. @@ -759,14 +827,17 @@ $I->clickWithLeftButton(['css' => '.checkout'], 20, 50); {% endhighlight %} - * `param null|string|array|WebDriverBy` $cssOrXPath css or xpath of the web element (body by default). -@throws ElementNotFound +#### clickWithRightButton +* `param null|string|array|WebDriverBy` $cssOrXPath css or xpath of the web element (body by default). +* `param ?int` $offsetX +* `param ?int` $offsetY +* `throws ElementNotFound` +* `return void` -#### clickWithRightButton - Performs contextual click with the right mouse button on an element. + If the first parameter `null` then the offset is relative to the actual mouse position. If the second and third parameters are given, then the mouse is moved to an offset of the element's top-left corner. @@ -781,12 +852,11 @@ $I->clickWithRightButton(['css' => '.checkout'], 20, 50); {% endhighlight %} - * `param null|string|array|WebDriverBy` $cssOrXPath css or xpath of the web element (body by default). -@throws ElementNotFound - #### closeTab - + +* `return void` + Closes current browser tab and switches to previous active tab. {% highlight php %} @@ -798,21 +868,31 @@ $I->closeTab(); #### debugWebDriverLogs - + +* `param ?\Codeception\TestInterface` $test +* `return void` + Print out latest Selenium Logs in debug mode #### deleteSessionSnapshot - + +* `param ` $name +* `return mixed` + Deletes session snapshot. See [saveSessionSnapshot](#saveSessionSnapshot) - #### dontSee - + +* `param array|string` $selector optional +* `param ` $text +* `return void` + Checks that the current page doesn't contain the text specified (case insensitive). + Give a locator as the second parameter to match a specific region. {% highlight php %} @@ -839,11 +919,12 @@ But will ignore strings like: For checking the raw source code, use `seeInSource()`. - * `param array|string` $selector optional - #### dontSeeCheckboxIsChecked - + +* `param ` $checkbox +* `return void` + Check that the specified checkbox is unchecked. {% highlight php %} @@ -856,16 +937,23 @@ $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user #### dontSeeCookie - + +* `param ` $cookie +* `param array` $params +* `return mixed|void` + Checks that there isn't a cookie with the given name. -You can set additional cookie params like `domain`, `path` as array passed in last argument. - * `return mixed|void` +You can set additional cookie params like `domain`, `path` as array passed in last argument. #### dontSeeCurrentUrlEquals - + +* `param string` $uri +* `return void` + Checks that the current URL doesn't equal the given string. + Unlike `dontSeeInCurrentUrl`, this only matches the full URL. {% highlight php %} @@ -878,7 +966,10 @@ $I->dontSeeCurrentUrlEquals('/'); #### dontSeeCurrentUrlMatches - + +* `param string` $uri +* `return void` + Checks that current url doesn't match the given regular expression. {% highlight php %} @@ -891,8 +982,13 @@ $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~'); #### dontSeeElement - + +* `param ` $selector +* `param array` $attributes +* `return void` + Checks that the given element is invisible or not present on the page. + You can also specify expected attributes of this element. {% highlight php %} @@ -907,14 +1003,19 @@ $I->dontSeeElement('input', ['value' => '123456']); #### dontSeeElementInDOM - -Opposite of `seeElementInDOM`. - * `param string|array|WebDriverBy` $selector +* `param string|array|WebDriverBy` $selector +* `param array` $attributes +* `return void` + +Opposite of `seeElementInDOM`. #### dontSeeInCurrentUrl - + +* `param string` $uri +* `return void` + Checks that the current URI doesn't contain the given string. {% highlight php %} @@ -926,8 +1027,13 @@ $I->dontSeeInCurrentUrl('/users/'); #### dontSeeInField - + +* `param string|array` $field +* `param ` $value +* `return void` + Checks that an input field or textarea doesn't contain the given value. + For fuzzy locators, the field is matched by label text, CSS and XPath. {% highlight php %} @@ -941,11 +1047,14 @@ $I->dontSeeInField('//form/*[@name=search]','Search'); $I->dontSeeInField(['name' => 'search'], 'Search'); {% endhighlight %} - * `param string|array` $field #### dontSeeInFormFields - + +* `param ` $formSelector +* `param array` $params +* `return void` + Checks if the array of form parameters (name => value) are not set on the form matched with the passed selector. @@ -988,20 +1097,28 @@ $I->dontSeeInFormFields('#form-id', [ #### dontSeeInPageSource - + +* `param string` $text +* `return void` + Checks that the page source doesn't contain the given string. #### dontSeeInPopup - + +* `param string` $text +* `throws ModuleException` +* `return void` + Checks that the active JavaScript popup, as created by `window.alert`|`window.confirm`|`window.prompt`, does NOT contain the given string. -@throws ModuleException - #### dontSeeInSource - + +* `param ` $raw +* `return void` + Checks that the current page contains the given string in its raw source code. @@ -1014,15 +1131,21 @@ $I->dontSeeInSource('

Green eggs & ham

'); #### dontSeeInTitle - -Checks that the page title does not contain the given string. - * `return mixed|void` +* `param ` $title +* `return mixed|void` + +Checks that the page title does not contain the given string. #### dontSeeLink - + +* `param string` $text +* `param string` $url +* `return void` + Checks that the page doesn't contain a link with the given string. + If the second parameter is given, only links with a matching "href" attribute will be checked. {% highlight php %} @@ -1035,7 +1158,11 @@ $I->dontSeeLink('Checkout now', '/store/cart.php'); #### dontSeeOptionIsSelected - + +* `param ` $selector +* `param ` $optionText +* `return mixed|void` + Checks that the given option is not selected. {% highlight php %} @@ -1045,19 +1172,22 @@ $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); {% endhighlight %} - * `return mixed|void` - #### doubleClick - -Performs a double click on an element matched by CSS or XPath. - * `param string|array|WebDriverBy` $cssOrXPath -@throws ElementNotFound +* `param string|array|WebDriverBy` $cssOrXPath +* `throws ElementNotFound` +* `return void` + +Performs a double click on an element matched by CSS or XPath. #### dragAndDrop - + +* `param string|array|WebDriverBy` $source (CSS ID or XPath) +* `param string|array|WebDriverBy` $target (CSS ID or XPath) +* `return void` + Performs a simple mouse drag-and-drop operation. {% highlight php %} @@ -1067,13 +1197,15 @@ $I->dragAndDrop('#drag', '#drop'); {% endhighlight %} - * `param string|array|WebDriverBy` $source (CSS ID or XPath) - * `param string|array|WebDriverBy` $target (CSS ID or XPath) - #### executeAsyncJS - + +* `param array` $arguments +* `param string` $script +* `return mixed` + Executes asynchronous JavaScript. + A callback should be executed by JavaScript to exit from a script. Callback is passed as a last element in `arguments` array. Additional arguments can be passed as array in second parameter. @@ -1088,12 +1220,14 @@ $I->executeAsyncJS('setTimeout(arguments[1], arguments[0])', [$seconds]); {% endhighlight %} - * `param array` $arguments - #### executeInSelenium - + +* `param Closure` $function +* `return mixed` + Low-level API method. + If Codeception commands are not enough, this allows you to use Selenium WebDriver methods directly: {% highlight php %} @@ -1109,11 +1243,13 @@ This runs in the context of the Try not to use this command on a regular basis. If Codeception lacks a feature you need, please implement it and submit a patch. - * `param Closure` $function - #### executeJS - + +* `param array` $arguments +* `param string` $script +* `return mixed` + Executes custom JavaScript. This example uses jQuery to get a value and assigns that value to a PHP variable: @@ -1129,11 +1265,13 @@ $I->executeJS("window.alert(arguments[0])", ['Hello world']); {% endhighlight %} - * `param array` $arguments - #### fillField - + +* `param ` $field +* `param ` $value +* `return void` + Fills a text field or textarea with the given string. {% highlight php %} @@ -1146,8 +1284,13 @@ $I->fillField(['name' => 'email'], 'jon@example.com'); #### grabAttributeFrom - + +* `param ` $cssOrXpath +* `param ` $attribute +* `return ?string` + Grabs the value of the given attribute value from the given element. + Fails if element is not found. {% highlight php %} @@ -1159,15 +1302,24 @@ $I->grabAttributeFrom('#tooltip', 'title'); #### grabCookie - + +* `param ` $cookie +* `param array` $params +* `return mixed` + Grabs a cookie value. + You can set additional cookie params like `domain`, `path` in array passed as last argument. If the cookie is set by an ajax request (XMLHttpRequest), there might be some delay caused by the browser, so try `$I->wait(0.1)`. #### grabFromCurrentUrl - + +* `param ` $uri +* `return mixed` + Executes the given regular expression against the current URI and returns the first capturing group. + If no parameters are provided, the full URI is returned. {% highlight php %} @@ -1180,7 +1332,11 @@ $uri = $I->grabFromCurrentUrl(); #### grabMultiple - + +* `param ` $cssOrXpath +* `param ` $attribute +* `return string[]` + Grabs either the text content, or attribute values, of nodes matched by $cssOrXpath and returns them as an array. @@ -1203,20 +1359,22 @@ $aLinks = $I->grabMultiple('a', 'href'); {% endhighlight %} - * `return string[]` - #### grabPageSource - -Grabs current page source code. -@throws ModuleException if no page was opened. - * `return string` Current page source code. +* `throws ModuleException` if no page was opened. +* `return string` Current page source code. + +Grabs current page source code. #### grabTextFrom - + +* `param ` $cssOrXPathOrRegex +* `return mixed` + Finds and returns the text contents of the given element. + If a fuzzy locator is used, the element is found using CSS, XPath, and by matching the full page source by regular expression. @@ -1231,8 +1389,12 @@ $value = $I->grabTextFrom('~grabValueFrom(['name' => 'username']); #### loadSessionSnapshot - + +* `param ` $name +* `return mixed` + Loads cookies from a saved snapshot. + Allows to reuse same session across tests without additional login. See [saveSessionSnapshot](#saveSessionSnapshot) - #### makeElementScreenshot - + +* `param WebDriverBy|array` $selector +* `param ?string` $name +* `return void` + Takes a screenshot of an element of the current window and saves it to `tests/_output/debug`. {% highlight php %} @@ -1270,11 +1439,12 @@ $I->makeElementScreenshot('#dialog'); {% endhighlight %} - * `param WebDriverBy|array` $selector - #### makeHtmlSnapshot - + +* `param ?string` $name +* `return void` + Use this method within an [interactive pause](https://codeception.com/docs/02-GettingStarted#Interactive-Pause) to save the HTML source code of the current page. {% highlight php %} @@ -1289,7 +1459,10 @@ $I->makeHtmlSnapshot(); #### makeScreenshot - + +* `param ?string` $name +* `return void` + Takes a screenshot of the current window and saves it to `tests/_output/debug`. {% highlight php %} @@ -1305,23 +1478,36 @@ $I->makeScreenshot(); #### maximizeWindow - + +* `return void` + Maximizes the current window. #### moveBack - + +* `return void` + Moves back in history. #### moveForward - + +* `return void` + Moves forward in history. #### moveMouseOver - + +* `param null|string|array|WebDriverBy` $cssOrXPath css or xpath of the web element +* `param ?int` $offsetX +* `param ?int` $offsetY +* `throws ElementNotFound` +* `return void` + Move mouse over the first element matched by the given locator. + If the first parameter null then the page is used. If the second and third parameters are given, then the mouse is moved to an offset of the element's top-left corner. @@ -1336,12 +1522,11 @@ $I->moveMouseOver(['css' => '.checkout'], 20, 50); {% endhighlight %} - * `param null|string|array|WebDriverBy` $cssOrXPath css or xpath of the web element -@throws ElementNotFound - #### openNewTab - + +* `return void` + Opens a new browser tab and switches to it. {% highlight php %} @@ -1356,8 +1541,14 @@ The tab is opened with JavaScript's `window.open()`, which means: #### performOn - + +* `param string|array|WebDriverBy` $element +* `param callable|array|ActionSequence` $actions +* `param int` $timeout +* `return void` + Waits for element and runs a sequence of actions inside its context. + Actions can be defined with array, callback, or `Codeception\Util\ActionSequence` instance. Actions as array are recommended for simple to combine "waitForElement" with assertions; @@ -1401,13 +1592,17 @@ $I->performOn('.rememberMe', function (WebDriver $I) { In 3rd argument you can set number a seconds to wait for element to appear - * `param string|array|WebDriverBy` $element - * `param callable|array|ActionSequence` $actions - #### pressKey - + +* `param string|array|WebDriverBy` $element +* `param array$chars` $ Can be char or array with modifier. You can provide several chars. +* `param ` $chars +* `throws ElementNotFound` +* `return void` + Presses the given key on the given element. + To specify a character and modifier (e.g. Ctrl, Alt, Shift, Meta), pass an array for `$char` with the modifier as the first element and the character as the second. For special keys, use the constants from [`Facebook\WebDriver\WebDriverKeys`](https://github.com/php-webdriver/php-webdriver/blob/main/lib/WebDriverKeys.php). @@ -1424,26 +1619,31 @@ $I->pressKey('#name', array('ctrl', 'a'), \Facebook\WebDriver\WebDriverKeys::DEL {% endhighlight %} - * `param string|array|WebDriverBy` $element -@param array$chars Can be char or array with modifier. You can provide several chars. -@throws ElementNotFound - #### reloadPage - + +* `return void` + Reloads the current page. #### resetCookie - + +* `param ` $cookie +* `param array` $params +* `return mixed|void` + Unsets cookie with the given name. -You can set additional cookie params like `domain`, `path` in array passed as last argument. - * `return mixed|void` +You can set additional cookie params like `domain`, `path` in array passed as last argument. #### resizeWindow - + +* `param int` $width +* `param int` $height +* `return void` + Resize the current window. {% highlight php %} @@ -1456,9 +1656,13 @@ $I->resizeWindow(800, 600); #### saveSessionSnapshot - + +* `param ` $name +* `return mixed` + Saves current cookies into named snapshot in order to restore them in other tests This is useful to save session state between tests. + For example, if user needs log in to site for each test this scenario can be executed once while other tests can just restore saved cookies. @@ -1485,10 +1689,15 @@ public function login() {% endhighlight %} - #### scrollTo - + +* `param string|array|WebDriverBy` $selector +* `param ?int` $offsetX +* `param ?int` $offsetY +* `return void` + Move to the middle of the given element matched by the given locator. + Extra shift, calculated from the top-left corner of the element, can be set by passing $offsetX and $offsetY parameters. @@ -1499,11 +1708,13 @@ $I->scrollTo(['css' => '.checkout'], 20, 50); {% endhighlight %} - * `param string|array|WebDriverBy` $selector - #### see - + +* `param array|string` $selector optional +* `param ` $text +* `return void` + 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 @@ -1533,11 +1744,12 @@ But will *not* be true for strings like: For checking the raw source code, use `seeInSource()`. - * `param array|string` $selector optional - #### seeCheckboxIsChecked - + +* `param ` $checkbox +* `return void` + Checks that the specified checkbox is checked. {% highlight php %} @@ -1551,8 +1763,13 @@ $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); #### seeCookie - + +* `param ` $cookie +* `param array` $params +* `return mixed|void` + Checks that a cookie with the given name is set. + You can set additional cookie params like `domain`, `path` as array passed in last argument. {% highlight php %} @@ -1562,12 +1779,14 @@ $I->seeCookie('PHPSESSID'); {% endhighlight %} - * `return mixed|void` - #### seeCurrentUrlEquals - + +* `param string` $uri +* `return void` + Checks that the current URL is equal to the given string. + Unlike `seeInCurrentUrl`, this only matches the full URL. {% highlight php %} @@ -1580,7 +1799,10 @@ $I->seeCurrentUrlEquals('/'); #### seeCurrentUrlMatches - + +* `param string` $uri +* `return void` + Checks that the current URL matches the given regular expression. {% highlight php %} @@ -1593,8 +1815,13 @@ $I->seeCurrentUrlMatches('~^/users/(\d+)~'); #### seeElement - + +* `param ` $selector +* `param array` $attributes +* `return void` + Checks that the given element exists on the page and is visible. + You can also specify expected attributes of this element. {% highlight php %} @@ -1612,7 +1839,11 @@ $I->seeElement(['css' => 'form input'], ['name' => 'login']); #### seeElementInDOM - + +* `param string|array|WebDriverBy` $selector +* `param array` $attributes +* `return void` + Checks that the given element exists on the page, even it is invisible. {% highlight php %} @@ -1622,11 +1853,12 @@ $I->seeElementInDOM('//form/input[type=hidden]'); {% endhighlight %} - * `param string|array|WebDriverBy` $selector - #### seeInCurrentUrl - + +* `param string` $uri +* `return void` + Checks that current URI contains the given string. {% highlight php %} @@ -1641,8 +1873,13 @@ $I->seeInCurrentUrl('/users/'); #### seeInField - + +* `param string|array` $field +* `param ` $value +* `return void` + Checks that the given input field or textarea *equals* (i.e. not just contains) the given value. + Fields are matched by label text, the "name" attribute, CSS, or XPath. {% highlight php %} @@ -1657,11 +1894,13 @@ $I->seeInField(['name' => 'search'], 'Search'); {% endhighlight %} - * `param string|array` $field - #### seeInFormFields - + +* `param ` $formSelector +* `param array` $params +* `return void` + Checks if the array of form parameters (name => value) are set on the form matched with the passed selector. @@ -1725,7 +1964,10 @@ $I->seeInFormFields('//form[@id=my-form]', string $form); #### seeInPageSource - + +* `param string` $text +* `return void` + Checks that the page source contains the given string. {% highlight php %} @@ -1737,15 +1979,20 @@ $I->seeInPageSource('seeInSource('

Green eggs & ham

'); #### seeInTitle - + +* `param ` $title +* `return mixed|void` + Checks that the page title contains the given string. {% highlight php %} @@ -1768,12 +2018,15 @@ $I->seeInTitle('Blog - Post #1'); {% endhighlight %} - * `return mixed|void` - #### seeLink - + +* `param string` $text +* `param ?string` $url +* `return void` + Checks that there's a link with the specified text. + Give a full URL as the second parameter to match links with that exact URL. {% highlight php %} @@ -1786,7 +2039,11 @@ $I->seeLink('Logout','/logout'); // matches Logout #### seeNumberOfElements - + +* `param int|int[]` $expected +* `param ` $selector +* `return void` + Checks that there are a certain number of elements matched by the given locator on the page. {% highlight php %} @@ -1797,18 +2054,19 @@ $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements {% endhighlight %} - * `param int|int[]` $expected - #### seeNumberOfElementsInDOM - - * `param string|array|WebDriverBy` $selector - * `param int|array` $expected -@throws ModuleException + +* `param string|array|WebDriverBy` $selector +* `param int|array` $expected +* `throws ModuleException` #### seeNumberOfTabs - + +* `param int` $number +* `return void` + Checks current number of opened tabs {% highlight php %} @@ -1820,7 +2078,11 @@ $I->seeNumberOfTabs(2); #### seeOptionIsSelected - + +* `param ` $selector +* `param ` $optionText +* `return mixed|void` + Checks that the given option is selected. {% highlight php %} @@ -1830,11 +2092,13 @@ $I->seeOptionIsSelected('#form input[name=payment]', 'Visa'); {% endhighlight %} - * `return mixed|void` - #### selectOption - + +* `param ` $select +* `param ` $option +* `return void` + Selects an option in a select tag or in radio button group. {% highlight php %} @@ -1867,8 +2131,15 @@ $I->selectOption('Which OS do you use?', array('value' => 'windows')); // Only s #### setCookie - + +* `param ` $name +* `param ` $value +* `param array` $params +* `param ` $showDebug +* `return mixed|void` + Sets a cookie with the given name and value. + You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument. {% highlight php %} @@ -1878,11 +2149,14 @@ $I->setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3'); {% endhighlight %} - * `return mixed|void` - #### submitForm - + +* `param string|array|WebDriverBy` $selector +* `param string|array|WebDriverBy|null` $button +* `param array` $params +* `return void` + Submits the given form on the page, optionally with the given form values. Give the form fields values as an array. Note that hidden fields can't be accessed. @@ -2053,12 +2327,12 @@ For example, given the following HTML: - ['name' => 'submitButton'] - WebDriverBy::name('submitButton') - * `param string|array|WebDriverBy` $selector - * `param string|array|WebDriverBy|null` $button - #### switchToFrame - + +* `param string|null` $locator (name, CSS or XPath) +* `return void` + Switch to another frame on the page. Example: @@ -2082,11 +2356,12 @@ $I->switchToFrame(); {% endhighlight %} - * `param string|null` $locator (name, CSS or XPath) - #### switchToIFrame - + +* `param string|null` $locator (name, CSS or XPath) +* `return void` + Switch to another iframe on the page. Example: @@ -2110,12 +2385,14 @@ $I->switchToIFrame(); {% endhighlight %} - * `param string|null` $locator (name, CSS or XPath) - #### switchToNextTab - + +* `param int` $offset +* `return void` + Switches to next browser tab. + An offset can be specified. {% highlight php %} @@ -2130,8 +2407,12 @@ $I->switchToNextTab(2); #### switchToPreviousTab - + +* `param int` $offset +* `return void` + Switches to previous browser tab. + An offset can be specified. {% highlight php %} @@ -2146,7 +2427,10 @@ $I->switchToPreviousTab(2); #### switchToWindow - + +* `param ?string` $name +* `return void` + Switch to another window identified by name. The window can only be identified by name. If the $name parameter is blank, the parent window will be used. @@ -2186,8 +2470,13 @@ $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webd #### type - + +* `param int` $delay [sec] +* `param string` $text +* `return void` + Type in characters on active element. + With a second parameter you can specify delay between key presses. {% highlight php %} @@ -2207,18 +2496,21 @@ $I->type('Hello World', 1); This might be useful when you an input reacts to typing and you need to slow it down to emulate human behavior. For instance, this is how Credit Card fields can be filled in. - * `param int` $delay [sec] - #### typeInPopup - -Enters text into a native JavaScript prompt popup, as created by `window.prompt`. -@throws ModuleException +* `param string` $keys +* `throws ModuleException` +* `return void` + +Enters text into a native JavaScript prompt popup, as created by `window.prompt`. #### uncheckOption - + +* `param ` $option +* `return void` + Unticks a checkbox. {% highlight php %} @@ -2230,24 +2522,32 @@ $I->uncheckOption('#notify'); #### unselectOption - -Unselect an option in the given select box. - * `param string|array|WebDriverBy` $select - * `param string|array|WebDriverBy` $option +* `param string|array|WebDriverBy` $select +* `param string|array|WebDriverBy` $option +* `return void` + +Unselect an option in the given select box. #### wait - -Wait for $timeout seconds. - * `param int|float` $timeout secs -@throws TestRuntimeException +* `param int|float` $timeout secs +* `throws TestRuntimeException` +* `return void` + +Wait for $timeout seconds. #### waitForElement - + +* `param string|array|WebDriverBy` $element +* `param int` $timeout seconds +* `throws Exception` +* `return void` + Waits up to $timeout seconds for an element to appear on the page. + If the element doesn't appear, a timeout exception is thrown. {% highlight php %} @@ -2258,14 +2558,17 @@ $I->click('#agree_button'); {% endhighlight %} - * `param string|array|WebDriverBy` $element - * `param int` $timeout seconds -@throws Exception - #### waitForElementChange - + +* `param string|array|WebDriverBy` $element +* `param \Closure` $callback +* `param int` $timeout +* `throws ElementNotFound` +* `return void` + Waits up to $timeout seconds for the given element to change. + Element "change" is determined by a callback function which is called repeatedly until the return value evaluates to true. @@ -2279,13 +2582,16 @@ $I->waitForElementChange('#menu', function(WebDriverElement $el) { {% endhighlight %} - * `param string|array|WebDriverBy` $element -@throws ElementNotFound - #### waitForElementClickable - + +* `param string|array|WebDriverBy` $element +* `param int` $timeout seconds +* `throws Exception` +* `return void` + Waits up to $timeout seconds for the given element to be clickable. + If element doesn't become clickable, a timeout exception is thrown. {% highlight php %} @@ -2296,14 +2602,16 @@ $I->click('#agree_button'); {% endhighlight %} - * `param string|array|WebDriverBy` $element - * `param int` $timeout seconds -@throws Exception - #### waitForElementNotVisible - + +* `param string|array|WebDriverBy` $element +* `param int` $timeout seconds +* `throws Exception` +* `return void` + Waits up to $timeout seconds for the given element to become invisible. + If element stays visible, a timeout exception is thrown. {% highlight php %} @@ -2313,14 +2621,16 @@ $I->waitForElementNotVisible('#agree_button', 30); // secs {% endhighlight %} - * `param string|array|WebDriverBy` $element - * `param int` $timeout seconds -@throws Exception - #### waitForElementVisible - + +* `param string|array|WebDriverBy` $element +* `param int` $timeout seconds +* `throws Exception` +* `return void` + Waits up to $timeout seconds for the given element to be visible on the page. + If element doesn't appear, a timeout exception is thrown. {% highlight php %} @@ -2331,13 +2641,13 @@ $I->click('#agree_button'); {% endhighlight %} - * `param string|array|WebDriverBy` $element - * `param int` $timeout seconds -@throws Exception - #### waitForJS - + +* `param int` $timeout seconds +* `param string` $script +* `return void` + Executes JavaScript and waits up to $timeout seconds for it to return true. In this example we will wait up to 60 seconds for all jQuery AJAX requests to finish. @@ -2349,11 +2659,15 @@ $I->waitForJS("return $.active == 0;", 60); {% endhighlight %} - * `param int` $timeout seconds - #### waitForText - + +* `param int` $timeout seconds +* `param null|string|array|WebDriverBy` $selector +* `param string` $text +* `throws Exception` +* `return void` + Waits up to $timeout seconds for the given string to appear on the page. Can also be passed a selector to search in, be as specific as possible when using selectors. @@ -2368,8 +2682,4 @@ $I->waitForText('foo', 30, '.title'); // secs {% endhighlight %} - * `param int` $timeout seconds - * `param null|string|array|WebDriverBy` $selector -@throws Exception -

 

Module reference is taken from the source code. Help us to improve documentation. Edit module reference
diff --git a/docs/modules/Yii2.md b/docs/modules/Yii2.md index 187925749..aa636ba9f 100644 --- a/docs/modules/Yii2.md +++ b/docs/modules/Yii2.md @@ -191,7 +191,11 @@ Stability: **stable** #### _findElements *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param mixed` $locator +* `return iterable` + Locates element using available Codeception locator types: * XPath @@ -215,11 +219,14 @@ WebDriver module returns `Facebook\WebDriver\Remote\RemoteWebElement` instances PhpBrowser and Framework modules return `Symfony\Component\DomCrawler\Crawler` instances - #### _getResponseContent *hidden API method, expected to be used from Helper classes* - + +* `api` +* `throws ModuleException` +* `return string` + Returns content of the last response Use it in Helpers when you want to retrieve response of request performed by another module. @@ -234,14 +241,22 @@ public function seeResponseContains($text) {% endhighlight %} -@throws ModuleException - #### _loadPage *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param string` $method +* `param string` $uri +* `param array` $parameters +* `param array` $files +* `param array` $server +* `param ?string` $content +* `return void` + Opens a page with arbitrary request parameters. + Useful for testing multi-step forms on a specific step. {% highlight php %} @@ -255,12 +270,23 @@ public function openCheckoutFormStep2($orderId) { {% endhighlight %} - #### _request *hidden API method, expected to be used from Helper classes* - + +* `api` +* `see` `_loadPage` +* `param string` $method +* `param string` $uri +* `param array` $parameters +* `param array` $files +* `param array` $server +* `param ?string` $content +* `throws ExternalUrlException|ModuleException` +* `return ?string` + Send custom request to a backend using method, uri, parameters, etc. + Use it in Helpers to create special request actions, like accessing API Returns a string with response body. @@ -278,14 +304,15 @@ public function createUserByApi($name) { Does not load the response into the module so you can't interact with response page (click, fill forms). To load arbitrary page for interaction, use `_loadPage` method. -@throws ExternalUrlException|ModuleException -@see `_loadPage` - #### _savePageSource *hidden API method, expected to be used from Helper classes* - + +* `api` +* `param string` $filename +* `return void` + Saves page source of to a file {% highlight php %} @@ -296,13 +323,21 @@ $this->getModule('Yii2')->_savePageSource(codecept_output_dir().'page.html'); #### amHttpAuthenticated - + +* `param string` $username +* `param string` $password +* `return void` + Authenticates user for HTTP_AUTH #### amLoggedInAs - + +* `param ` $user +* `throws \Codeception\Exception\ModuleException` + Authenticates a user on a site without submitting a login form. + Use it for fast pragmatic authorization in functional tests. {% highlight php %} @@ -318,12 +353,12 @@ $I->amLoggedInAs($admin); {% endhighlight %} Requires the `user` component to be enabled and configured. - * `param` $user -@throws \Codeception\Exception\ModuleException - #### amOnPage - + +* `param string|array` $page the URI or route in array format +* `return void` + Opens the page for the given relative URI or route. {% highlight php %} @@ -336,11 +371,13 @@ $I->amOnPage('/register'); {% endhighlight %} - * `param string|array` $page the URI or route in array format - #### amOnRoute - + +* `param string` $route A route +* `param array` $params Additional route parameters +* `return void` + Similar to `amOnPage` but accepts a route as first argument and params as second {% highlight yaml %} @@ -348,12 +385,13 @@ $I->amOnRoute('site/view', ['page' => 'about']); {% endhighlight %} - * `param string` $route A route - * `param array` $params Additional route parameters - #### attachFile - + +* `param ` $field +* `param string` $filename +* `return void` + Attaches a file relative to the Codeception `_data` directory to the given file upload field. {% highlight php %} @@ -366,7 +404,10 @@ $I->attachFile('input[@type="file"]', 'prices.xls'); #### checkOption - + +* `param ` $option +* `return void` + Ticks a checkbox. For radio buttons, use the `selectOption` method instead. {% highlight php %} @@ -378,8 +419,13 @@ $I->checkOption('#agree'); #### click - + +* `param string|array` $link +* `param ` $context +* `return void` + 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. @@ -406,18 +452,21 @@ $I->click('Logout', '#nav'); $I->click(['link' => 'Login']); {% endhighlight %} - * `param string|array` $link #### createAndSetCsrfCookie - + +* `param string` $val The value of the CSRF token +* `return string[]` Returns an array containing the name of the CSRF param and the masked CSRF token. + Creates the CSRF Cookie. - * `param string` $val The value of the CSRF token - * `return string[]` Returns an array containing the name of the CSRF param and the masked CSRF token. #### deleteHeader - + +* `param string` $name the name of the header to delete. +* `return void` + Deletes the header with the passed name. Subsequent requests will not have the deleted header in its request. @@ -433,12 +482,15 @@ $I->amOnPage('some-other-page.php'); {% endhighlight %} - * `param string` $name the name of the header to delete. - #### dontSee - + +* `param array|string` $selector optional +* `param string` $text +* `return void` + Checks that the current page doesn't contain the text specified (case insensitive). + Give a locator as the second parameter to match a specific region. {% highlight php %} @@ -465,11 +517,12 @@ But will ignore strings like: For checking the raw source code, use `seeInSource()`. - * `param array|string` $selector optional - #### dontSeeCheckboxIsChecked - + +* `param ` $checkbox +* `return void` + Check that the specified checkbox is unchecked. {% highlight php %} @@ -482,16 +535,23 @@ $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user #### dontSeeCookie - + +* `param ` $cookie +* `param ` $params +* `return mixed|void` + Checks that there isn't a cookie with the given name. -You can set additional cookie params like `domain`, `path` as array passed in last argument. - * `return mixed|void` +You can set additional cookie params like `domain`, `path` as array passed in last argument. #### dontSeeCurrentUrlEquals - + +* `param string` $uri +* `return void` + Checks that the current URL doesn't equal the given string. + Unlike `dontSeeInCurrentUrl`, this only matches the full URL. {% highlight php %} @@ -504,7 +564,10 @@ $I->dontSeeCurrentUrlEquals('/'); #### dontSeeCurrentUrlMatches - + +* `param string` $uri +* `return void` + Checks that current url doesn't match the given regular expression. {% highlight php %} @@ -517,8 +580,13 @@ $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~'); #### dontSeeElement - + +* `param ` $selector +* `param array` $attributes +* `return void` + Checks that the given element is invisible or not present on the page. + You can also specify expected attributes of this element. {% highlight php %} @@ -533,14 +601,18 @@ $I->dontSeeElement('input', ['value' => '123456']); #### dontSeeEmailIsSent - -Checks that no email was sent - * `[Part]` email +* `part` email +* `return void` + +Checks that no email was sent #### dontSeeInCurrentUrl - + +* `param string` $uri +* `return void` + Checks that the current URI doesn't contain the given string. {% highlight php %} @@ -552,8 +624,13 @@ $I->dontSeeInCurrentUrl('/users/'); #### dontSeeInField - + +* `param string|array` $field +* `param ` $value +* `return void` + Checks that an input field or textarea doesn't contain the given value. + For fuzzy locators, the field is matched by label text, CSS and XPath. {% highlight php %} @@ -567,11 +644,14 @@ $I->dontSeeInField('//form/*[@name=search]','Search'); $I->dontSeeInField(['name' => 'search'], 'Search'); {% endhighlight %} - * `param string|array` $field #### dontSeeInFormFields - + +* `param ` $formSelector +* `param array` $params +* `return void` + Checks if the array of form parameters (name => value) are not set on the form matched with the passed selector. @@ -614,7 +694,10 @@ $I->dontSeeInFormFields('#form-id', [ #### dontSeeInSource - + +* `param string` $raw +* `return void` + Checks that the current page contains the given string in its raw source code. @@ -627,15 +710,21 @@ $I->dontSeeInSource('

Green eggs & ham

'); #### dontSeeInTitle - -Checks that the page title does not contain the given string. - * `return mixed|void` +* `param ` $title +* `return mixed|void` + +Checks that the page title does not contain the given string. #### dontSeeLink - + +* `param string` $text +* `param string` $url +* `return void` + Checks that the page doesn't contain a link with the given string. + If the second parameter is given, only links with a matching "href" attribute will be checked. {% highlight php %} @@ -648,7 +737,11 @@ $I->dontSeeLink('Checkout now', '/store/cart.php'); #### dontSeeOptionIsSelected - + +* `param ` $selector +* `param ` $optionText +* `return mixed|void` + Checks that the given option is not selected. {% highlight php %} @@ -658,11 +751,14 @@ $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); {% endhighlight %} - * `return mixed|void` - #### dontSeeRecord - + +* `part` orm +* `param ` $model +* `param array` $attributes +* `return void` + Checks that a record does not exist in the database. {% highlight php %} @@ -671,13 +767,12 @@ $I->dontSeeRecord('app\models\User', array('name' => 'davert')); {% endhighlight %} - * `param` $model - * `param array` $attributes - * `[Part]` orm - #### dontSeeResponseCodeIs - + +* `param int` $code +* `return void` + Checks that response code is equal to value provided. {% highlight php %} @@ -692,7 +787,11 @@ $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK); #### fillField - + +* `param ` $field +* `param ` $value +* `return void` + Fills a text field or textarea with the given string. {% highlight php %} @@ -705,7 +804,9 @@ $I->fillField(['name' => 'email'], 'jon@example.com'); #### followRedirect - + +* `return void` + Follow pending redirect if there is one. {% highlight php %} @@ -717,15 +818,20 @@ $I->followRedirect(); #### getInternalDomains - -Returns a list of regex patterns for recognized domain names - * `return array` +* `return array` + +Returns a list of regex patterns for recognized domain names #### grabAttributeFrom - + +* `param ` $cssOrXpath +* `param string` $attribute +* `return mixed` + Grabs the value of the given attribute value from the given element. + Fails if element is not found. {% highlight php %} @@ -737,7 +843,12 @@ $I->grabAttributeFrom('#tooltip', 'title'); #### grabComponent - + +@deprecated +* `param ` $component +* `throws \Codeception\Exception\ModuleException` +* `return mixed` + Gets a component from the Yii container. Throws an exception if the component is not available @@ -748,21 +859,29 @@ $mailer = $I->grabComponent('mailer'); {% endhighlight %} - * `param` $component -@throws \Codeception\Exception\ModuleException -@deprecated in your tests you can use \Yii::$app directly. - #### grabCookie - + +* `param string` $cookie +* `param array` $params +* `return mixed` + Grabs a cookie value. + You can set additional cookie params like `domain`, `path` in array passed as last argument. If the cookie is set by an ajax request (XMLHttpRequest), there might be some delay caused by the browser, so try `$I->wait(0.1)`. #### grabFixture - + +* `part` fixtures +* `param ` $name +* `param ` $index +* `throws \Codeception\Exception\ModuleException` if the fixture is not found +* `return mixed` + 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: @@ -779,23 +898,24 @@ $user = $I->grabFixture('users', 'user1'); {% endhighlight %} - * `param` $name -@throws \Codeception\Exception\ModuleException if the fixture is not found - * `[Part]` fixtures - #### grabFixtures - + +* `part` fixtures +* `return array` + Returns all loaded fixtures. -Array of fixture instances - * `[Part]` fixtures - * `return array` +Array of fixture instances #### grabFromCurrentUrl - + +* `param ?string` $uri +* `return mixed` + Executes the given regular expression against the current URI and returns the first capturing group. + If no parameters are provided, the full URI is returned. {% highlight php %} @@ -808,7 +928,10 @@ $uri = $I->grabFromCurrentUrl(); #### grabLastSentEmail - + +* `part` email +* `return object` + Returns the last sent email: {% highlight php %} @@ -819,11 +942,14 @@ $message = $I->grabLastSentEmail(); $I->assertEquals('admin@site,com', $message->getTo()); {% endhighlight %} - * `[Part]` email #### grabMultiple - + +* `param ` $cssOrXpath +* `param ?string` $attribute +* `return string[]` + Grabs either the text content, or attribute values, of nodes matched by $cssOrXpath and returns them as an array. @@ -846,19 +972,22 @@ $aLinks = $I->grabMultiple('a', 'href'); {% endhighlight %} - * `return string[]` - #### grabPageSource - -Grabs current page source code. -@throws ModuleException if no page was opened. - * `return string` Current page source code. +* `throws ModuleException` if no page was opened. +* `return string` Current page source code. + +Grabs current page source code. #### grabRecord - + +* `part` orm +* `param ` $model +* `param array` $attributes +* `return mixed` + Retrieves a record from the database {% highlight php %} @@ -867,14 +996,15 @@ $category = $I->grabRecord('app\models\User', array('name' => 'davert')); {% endhighlight %} - * `param` $model - * `param array` $attributes - * `[Part]` orm - #### grabSentEmails - + +* `part` email +* `throws \Codeception\Exception\ModuleException` +* `return array` + Returns array of all sent email messages. + Each message implements the `yii\mail\MessageInterface` interface. Useful to perform additional checks using the `Asserts` module: @@ -887,14 +1017,14 @@ $I->assertEquals('admin@site,com', $messages[0]->getTo()); {% endhighlight %} - * `[Part]` email - * `return array` -@throws \Codeception\Exception\ModuleException - #### grabTextFrom - + +* `param ` $cssOrXPathOrRegex +* `return mixed` + Finds and returns the text contents of the given element. + If a fuzzy locator is used, the element is found using CSS, XPath, and by matching the full page source by regular expression. @@ -909,8 +1039,12 @@ $value = $I->grabTextFrom('~grabValueFrom(['name' => 'username']); #### haveFixtures - + +* `part` fixtures +* `param ` $fixtures + Creates and loads fixtures from a config. + The signature is the same as for the `fixtures()` method of `yii\test\FixtureTrait` {% highlight php %} @@ -962,12 +1100,14 @@ public function _fixtures(){ {% endhighlight %} instead of calling `haveFixtures` in Cest `_before` - * `param` $fixtures - * `[Part]` fixtures - #### haveHttpHeader - + +* `param string` $name the name of the request header +* `param string` $value the value to set it to for subsequent + requests +* `return void` + Sets the HTTP header to the passed value - which is used on subsequent HTTP requests through PhpBrowser. @@ -992,13 +1132,14 @@ $I->haveHttpHeader('Client_Id', 'Codeception'); {% endhighlight %} - * `param string` $name the name of the request header - * `param string` $value the value to set it to for subsequent - requests - #### haveRecord - + +* `part` orm +* `param ` $model +* `param array` $attributes +* `return mixed` + Inserts a record into the database. {% highlight php %} @@ -1009,13 +1150,13 @@ $user_id = $I->haveRecord('app\models\User', array('name' => 'Davert')); {% endhighlight %} - * `param` $model - * `param array` $attributes - * `[Part]` orm - #### haveServerParameter - + +* `param string` $name +* `param string` $value +* `return void` + Sets SERVER parameter valid for all next requests. {% highlight php %} @@ -1026,7 +1167,10 @@ $I->haveServerParameter('name', 'value'); #### makeHtmlSnapshot - + +* `param ?string` $name +* `return void` + Use this method within an [interactive pause](https://codeception.com/docs/02-GettingStarted#Interactive-Pause) to save the HTML source code of the current page. {% highlight php %} @@ -1041,22 +1185,30 @@ $I->makeHtmlSnapshot(); #### moveBack - -Moves back in history. - * `param int` $numberOfSteps (default value 1) +* `param int` $numberOfSteps (default value 1) +* `return void` + +Moves back in history. #### resetCookie - + +* `param ` $cookie +* `param ` $params +* `return mixed|void` + Unsets cookie with the given name. -You can set additional cookie params like `domain`, `path` in array passed as last argument. - * `return mixed|void` +You can set additional cookie params like `domain`, `path` in array passed as last argument. #### see - + +* `param array|string` $selector optional +* `param string` $text +* `return void` + 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 @@ -1086,11 +1238,12 @@ But will *not* be true for strings like: For checking the raw source code, use `seeInSource()`. - * `param array|string` $selector optional - #### seeCheckboxIsChecked - + +* `param ` $checkbox +* `return void` + Checks that the specified checkbox is checked. {% highlight php %} @@ -1104,8 +1257,13 @@ $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); #### seeCookie - + +* `param ` $cookie +* `param ` $params +* `return mixed|void` + Checks that a cookie with the given name is set. + You can set additional cookie params like `domain`, `path` as array passed in last argument. {% highlight php %} @@ -1115,12 +1273,14 @@ $I->seeCookie('PHPSESSID'); {% endhighlight %} - * `return mixed|void` - #### seeCurrentUrlEquals - + +* `param string` $uri +* `return void` + Checks that the current URL is equal to the given string. + Unlike `seeInCurrentUrl`, this only matches the full URL. {% highlight php %} @@ -1133,7 +1293,10 @@ $I->seeCurrentUrlEquals('/'); #### seeCurrentUrlMatches - + +* `param string` $uri +* `return void` + Checks that the current URL matches the given regular expression. {% highlight php %} @@ -1146,8 +1309,13 @@ $I->seeCurrentUrlMatches('~^/users/(\d+)~'); #### seeElement - + +* `param ` $selector +* `param array` $attributes +* `return void` + Checks that the given element exists on the page and is visible. + You can also specify expected attributes of this element. {% highlight php %} @@ -1165,7 +1333,12 @@ $I->seeElement(['css' => 'form input'], ['name' => 'login']); #### seeEmailIsSent - + +* `part` email +* `param int` $num +* `throws \Codeception\Exception\ModuleException` +* `return void` + Checks that an email is sent. {% highlight php %} @@ -1179,13 +1352,12 @@ $I->seeEmailIsSent(3); {% endhighlight %} - * `param int` $num -@throws \Codeception\Exception\ModuleException - * `[Part]` email - #### seeInCurrentUrl - + +* `param string` $uri +* `return void` + Checks that current URI contains the given string. {% highlight php %} @@ -1200,8 +1372,13 @@ $I->seeInCurrentUrl('/users/'); #### seeInField - + +* `param string|array` $field +* `param ` $value +* `return void` + Checks that the given input field or textarea *equals* (i.e. not just contains) the given value. + Fields are matched by label text, the "name" attribute, CSS, or XPath. {% highlight php %} @@ -1216,11 +1393,13 @@ $I->seeInField(['name' => 'search'], 'Search'); {% endhighlight %} - * `param string|array` $field - #### seeInFormFields - + +* `param ` $formSelector +* `param array` $params +* `return void` + Checks if the array of form parameters (name => value) are set on the form matched with the passed selector. @@ -1284,7 +1463,10 @@ $I->seeInFormFields('//form[@id=my-form]', string $form); #### seeInSource - + +* `param string` $raw +* `return void` + Checks that the current page contains the given string in its raw source code. @@ -1297,7 +1479,10 @@ $I->seeInSource('

Green eggs & ham

'); #### seeInTitle - + +* `param ` $title +* `return mixed|void` + Checks that the page title contains the given string. {% highlight php %} @@ -1307,12 +1492,15 @@ $I->seeInTitle('Blog - Post #1'); {% endhighlight %} - * `return mixed|void` - #### seeLink - + +* `param string` $text +* `param ?string` $url +* `return void` + Checks that there's a link with the specified text. + Give a full URL as the second parameter to match links with that exact URL. {% highlight php %} @@ -1325,7 +1513,11 @@ $I->seeLink('Logout','/logout'); // matches Logout #### seeNumberOfElements - + +* `param int|int[]` $expected +* `param ` $selector +* `return void` + Checks that there are a certain number of elements matched by the given locator on the page. {% highlight php %} @@ -1336,11 +1528,13 @@ $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements {% endhighlight %} - * `param int|int[]` $expected - #### seeOptionIsSelected - + +* `param ` $selector +* `param ` $optionText +* `return mixed|void` + Checks that the given option is selected. {% highlight php %} @@ -1350,16 +1544,21 @@ $I->seeOptionIsSelected('#form input[name=payment]', 'Visa'); {% endhighlight %} - * `return mixed|void` - #### seePageNotFound - + +* `return void` + Asserts that current page has 404 response status code. #### seeRecord - + +* `part` orm +* `param ` $model +* `param array` $attributes +* `return void` + Checks that a record exists in the database. {% highlight php %} @@ -1368,13 +1567,12 @@ $I->seeRecord('app\models\User', array('name' => 'davert')); {% endhighlight %} - * `param` $model - * `param array` $attributes - * `[Part]` orm - #### seeResponseCodeIs - + +* `param int` $code +* `return void` + Checks that response code is equal to value provided. {% highlight php %} @@ -1389,32 +1587,48 @@ $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK); #### seeResponseCodeIsBetween - + +* `param int` $from +* `param int` $to +* `return void` + Checks that response code is between a certain range. Between actually means [from <= CODE <= to] #### seeResponseCodeIsClientError - + +* `return void` + Checks that the response code is 4xx #### seeResponseCodeIsRedirection - + +* `return void` + Checks that the response code 3xx #### seeResponseCodeIsServerError - + +* `return void` + Checks that the response code is 5xx #### seeResponseCodeIsSuccessful - + +* `return void` + Checks that the response code 2xx #### selectOption - + +* `param ` $select +* `param ` $option +* `return void` + Selects an option in a select tag or in radio button group. {% highlight php %} @@ -1447,14 +1661,24 @@ $I->selectOption('Which OS do you use?', array('value' => 'windows')); // Only s #### sendAjaxGetRequest - + +* `param string` $uri +* `param array` $params +* `return void` + Sends an ajax GET request with the passed parameters. + See `sendAjaxPostRequest()` #### sendAjaxPostRequest - + +* `param string` $uri +* `param array` $params +* `return void` + Sends an ajax POST request with the passed parameters. + The appropriate HTTP header is added automatically: `X-Requested-With: XMLHttpRequest` Example: @@ -1479,8 +1703,14 @@ $I->sendAjaxPostRequest('/add-task', ['form' => [ #### sendAjaxRequest - + +* `param string` $method +* `param string` $uri +* `param array` $params +* `return void` + Sends an ajax request, using the passed HTTP method. + See `sendAjaxPostRequest()` Example: {% highlight php %} @@ -1492,15 +1722,19 @@ $I->sendAjaxRequest('PUT', '/posts/7', ['title' => 'new title']); #### setCookie - + +* `param string` $name The name of the cookie +* `param string` $val The value of the cookie +* `param array` $params Additional cookie params like `domain`, `path`, `expires` and `secure`. + Sets a cookie and, if validation is enabled, signs it. - * `param string` $name The name of the cookie - * `param string` $val The value of the cookie - * `param array` $params Additional cookie params like `domain`, `path`, `expires` and `secure`. #### setMaxRedirects - + +* `param int` $maxRedirects +* `return void` + Sets the maximum number of redirects that the Client can follow. {% highlight php %} @@ -1512,8 +1746,12 @@ $I->setMaxRedirects(2); #### setServerParameters - + +* `param array` $params +* `return void` + Sets SERVER parameters valid for all next requests. + this will remove old ones. {% highlight php %} @@ -1524,7 +1762,9 @@ $I->setServerParameters([]); #### startFollowingRedirects - + +* `return void` + Enables automatic redirects to be followed by the client. {% highlight php %} @@ -1536,7 +1776,9 @@ $I->startFollowingRedirects(); #### stopFollowingRedirects - + +* `return void` + Prevents automatic redirects to be followed by the client. {% highlight php %} @@ -1548,7 +1790,12 @@ $I->stopFollowingRedirects(); #### submitForm - + +* `param ` $selector +* `param array` $params +* `param ?string` $button +* `return void` + Submits the given form on the page, with the given form values. Pass the form field's values as an array in the second parameter. @@ -1738,7 +1985,10 @@ $I->submitForm('#my-form', [ #### switchToIframe - + +* `param string` $name +* `return void` + Switch to iframe or frame on the page. Example: @@ -1758,7 +2008,10 @@ $I->switchToIframe("another_frame"); #### uncheckOption - + +* `param ` $option +* `return void` + Unticks a checkbox. {% highlight php %} diff --git a/docs/reference/Autoload.md b/docs/reference/Autoload.md index e975d3736..d9b36665c 100644 --- a/docs/reference/Autoload.md +++ b/docs/reference/Autoload.md @@ -14,7 +14,14 @@ and can be used to autoload your `Helper`, `Page`, and `Step` classes. #### addNamespace() - *public static* addNamespace($prefix, $baseDir, $prepend = false) + *public static* addNamespace($prefix, $baseDir, $prepend = false) + + +* `param string` $prefix The namespace prefix. +* `param string` $baseDir A base directory for class files in the namespace. +* `param bool` $prepend If true, prepend the base directory to the stack instead of appending it; + this causes it to be searched first rather than last. +* `return void` Adds a base directory for a namespace prefix. @@ -33,16 +40,15 @@ Autoload::addNamespace('app\Codeception', '/path/to/controllers'); {% endhighlight %} - * `param string` $prefix The namespace prefix. - * `param string` $baseDir A base directory for class files in the namespace. - * `param bool` $prepend If true, prepend the base directory to the stack instead of appending it; - this causes it to be searched first rather than last. - [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Util/Autoload.php#L53) #### load() - *public static* load($class) + *public static* load($class) + + +* `param string` $class +* `return string|false` [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Util/Autoload.php#L80) diff --git a/docs/reference/Commands.md b/docs/reference/Commands.md index 96f4ef973..a21891814 100644 --- a/docs/reference/Commands.md +++ b/docs/reference/Commands.md @@ -5,13 +5,22 @@ title: Commands - Codeception - Documentation # Console Commands -## GenerateScenarios +## Console -Generates user-friendly text scenarios from scenario-driven tests (Cest). +Try to execute test commands in run-time. You may try commands before writing the test. -* `codecept g:scenarios acceptance` - for all acceptance tests -* `codecept g:scenarios acceptance --format html` - in html format -* `codecept g:scenarios acceptance --path doc` - generate scenarios to `doc` dir +* `codecept console acceptance` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands. + + + +## GeneratePageObject + +Generates PageObject. Can be generated either globally, or just for one suite. +If PageObject is generated globally it will act as UIMap, without any logic in it. + +* `codecept g:page Login` +* `codecept g:page Registration` +* `codecept g:page acceptance Login` @@ -29,66 +38,44 @@ Usage: -## GenerateTest - -Generates skeleton for Unit Test that extends `Codeception\TestCase\Test`. - -* `codecept g:test unit User` -* `codecept g:test unit "App\User"` - - - -## SelfUpdate - -Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar' . - -* `php codecept.phar self-update` - -@author Franck Cassedanne - - - -## GenerateFeature - -Generates Feature file (in Gherkin): - -* `codecept generate:feature suite Login` -* `codecept g:feature suite subdir/subdir/login.feature` -* `codecept g:feature suite login.feature -c path/to/project` +## Clean +Recursively cleans `output` directory and generated code. +* `codecept clean` -## CompletionFallback +## Bootstrap -## Console - -Try to execute test commands in run-time. You may try commands before writing the test. +Creates default config, tests directory and sample suites for current project. +Use this command to start building a test suite. -* `codecept console acceptance` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands. +By default it will create 3 suites **acceptance**, **functional**, and **unit**. +* `codecept bootstrap` - creates `tests` dir and `codeception.yml` in current dir. +* `codecept bootstrap --empty` - creates `tests` dir without suites +* `codecept bootstrap --namespace Frontend` - creates tests, and use `Frontend` namespace for actor classes and helpers. +* `codecept bootstrap --actor Wizard` - sets actor as Wizard, to have `TestWizard` actor in tests. +* `codecept bootstrap path/to/the/project` - provide different path to a project, where tests should be placed -## GeneratePageObject -Generates PageObject. Can be generated either globally, or just for one suite. -If PageObject is generated globally it will act as UIMap, without any logic in it. -* `codecept g:page Login` -* `codecept g:page Registration` -* `codecept g:page acceptance Login` +## DryRun +Shows step by step execution process for scenario driven tests without actually running them. +* `codecept dry-run acceptance` +* `codecept dry-run acceptance MyCest` +* `codecept dry-run acceptance checkout.feature` +* `codecept dry-run tests/acceptance/MyCest.php` -## GenerateStepObject -Generates StepObject class. You will be asked for steps you want to implement. -* `codecept g:stepobject acceptance AdminSteps` -* `codecept g:stepobject acceptance UserSteps --silent` - skip action questions +## CompletionFallback @@ -180,6 +167,17 @@ Options: +## GenerateStepObject + +Generates StepObject class. You will be asked for steps you want to implement. + +* `codecept g:stepobject acceptance AdminSteps` +* `codecept g:stepobject acceptance UserSteps --silent` - skip action questions + + + + + ## GherkinSteps Prints all steps from all Gherkin contexts for a specific suite @@ -192,12 +190,27 @@ codecept gherkin:steps acceptance -## Clean +## GenerateCest -Recursively cleans `output` directory and generated code. +Generates Cest (scenario-driven object-oriented test) file: -* `codecept clean` +* `codecept generate:cest suite Login` +* `codecept g:cest suite subdir/subdir/testnameCest.php` +* `codecept g:cest suite LoginCest -c path/to/project` +* `codecept g:cest "App\Login"` + + + + +## GenerateSnapshot +Generates Snapshot. +Snapshot can be used to test dynamical data. +If suite name is provided, an actor class will be included into placeholder + +* `codecept g:snapshot UserEmails` +* `codecept g:snapshot Products` +* `codecept g:snapshot acceptance UserEmails` @@ -211,82 +224,78 @@ Creates empty Helper class. -## Init +## GenerateFeature +Generates Feature file (in Gherkin): +* `codecept generate:feature suite Login` +* `codecept g:feature suite subdir/subdir/login.feature` +* `codecept g:feature suite login.feature -c path/to/project` -## GenerateCest -Generates Cest (scenario-driven object-oriented test) file: -* `codecept generate:cest suite Login` -* `codecept g:cest suite subdir/subdir/testnameCest.php` -* `codecept g:cest suite LoginCest -c path/to/project` -* `codecept g:cest "App\Login"` +## Build +Generates Actor classes (initially Guy classes) from suite configs. +Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually. +* `codecept build` +* `codecept build path/to/project` -## ConfigValidate -Validates and prints Codeception config. -Use it do debug Yaml configs -Check config: -* `codecept config`: check global config -* `codecept config unit`: check suite config +## GenerateTest -Load config: +Generates skeleton for Unit Test that extends `Codeception\TestCase\Test`. -* `codecept config:validate -c path/to/another/config`: from another dir -* `codecept config:validate -c another_config.yml`: from another config file +* `codecept g:test unit User` +* `codecept g:test unit "App\User"` -Check overriding config values (like in `run` command) -* `codecept config:validate -o "settings: shuffle: true"`: enable shuffle -* `codecept config:validate -o "settings: lint: false"`: disable linting -* `codecept config:validate -o "reporters: report: \Custom\Reporter" --report`: use custom reporter +## GenerateEnvironment +Generates empty environment configuration file into envs dir: + * `codecept g:env firefox` -## Build +Required to have `envs` path to be specified in `codeception.yml` -Generates Actor classes (initially Guy classes) from suite configs. -Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually. -* `codecept build` -* `codecept build path/to/project` +## ConfigValidate +Validates and prints Codeception config. +Use it do debug Yaml configs +Check config: -## Bootstrap +* `codecept config`: check global config +* `codecept config unit`: check suite config -Creates default config, tests directory and sample suites for current project. -Use this command to start building a test suite. +Load config: -By default it will create 3 suites **acceptance**, **functional**, and **unit**. +* `codecept config:validate -c path/to/another/config`: from another dir +* `codecept config:validate -c another_config.yml`: from another config file -* `codecept bootstrap` - creates `tests` dir and `codeception.yml` in current dir. -* `codecept bootstrap --empty` - creates `tests` dir without suites -* `codecept bootstrap --namespace Frontend` - creates tests, and use `Frontend` namespace for actor classes and helpers. -* `codecept bootstrap --actor Wizard` - sets actor as Wizard, to have `TestWizard` actor in tests. -* `codecept bootstrap path/to/the/project` - provide different path to a project, where tests should be placed +Check overriding config values (like in `run` command) +* `codecept config:validate -o "settings: shuffle: true"`: enable shuffle +* `codecept config:validate -o "settings: lint: false"`: disable linting +* `codecept config:validate -o "reporters: report: \Custom\Reporter" --report`: use custom reporter -## GenerateSuite -Create new test suite. Requires suite name and actor name +## SelfUpdate -* `` -* `codecept g:suite api` -> api + ApiTester -* `codecept g:suite integration Code` -> integration + CodeTester -* `codecept g:suite frontend Front` -> frontend + FrontTester +Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar' . + +* `php codecept.phar self-update` +@author Franck Cassedanne @@ -298,38 +307,29 @@ Creates empty GroupObject - extension which handles all group events. - -## GenerateEnvironment - -Generates empty environment configuration file into envs dir: - - * `codecept g:env firefox` - -Required to have `envs` path to be specified in `codeception.yml` +## Init -## DryRun +## GenerateScenarios -Shows step by step execution process for scenario driven tests without actually running them. +Generates user-friendly text scenarios from scenario-driven tests (Cest). -* `codecept dry-run acceptance` -* `codecept dry-run acceptance MyCest` -* `codecept dry-run acceptance checkout.feature` -* `codecept dry-run tests/acceptance/MyCest.php` +* `codecept g:scenarios acceptance` - for all acceptance tests +* `codecept g:scenarios acceptance --format html` - in html format +* `codecept g:scenarios acceptance --path doc` - generate scenarios to `doc` dir +## GenerateSuite -## GenerateSnapshot +Create new test suite. Requires suite name and actor name -Generates Snapshot. -Snapshot can be used to test dynamical data. -If suite name is provided, an actor class will be included into placeholder +* `` +* `codecept g:suite api` -> api + ApiTester +* `codecept g:suite integration Code` -> integration + CodeTester +* `codecept g:suite frontend Front` -> frontend + FrontTester -* `codecept g:snapshot UserEmails` -* `codecept g:snapshot Products` -* `codecept g:snapshot acceptance UserEmails` diff --git a/docs/reference/Fixtures.md b/docs/reference/Fixtures.md index 166ac624d..3f935dc9b 100644 --- a/docs/reference/Fixtures.md +++ b/docs/reference/Fixtures.md @@ -22,25 +22,41 @@ Fixtures::exists('user1'); #### add() - *public static* add($name, $data) + *public static* add($name, $data) + + +* `param string` $name +* `param ` $data +* `return void` [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Util/Fixtures.php#L23) #### cleanup() - *public static* cleanup($name = '') + *public static* cleanup($name = '') + + +* `param string` $name +* `return void` [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Util/Fixtures.php#L37) #### exists() - *public static* exists($name) + *public static* exists($name) + + +* `param string` $name +* `return bool` [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Util/Fixtures.php#L47) #### get() - *public static* get($name) + *public static* get($name) + + +* `param string` $name [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Util/Fixtures.php#L28) diff --git a/docs/reference/HttpCode.md b/docs/reference/HttpCode.md index 43f91bd03..e015c371a 100644 --- a/docs/reference/HttpCode.md +++ b/docs/reference/HttpCode.md @@ -27,7 +27,11 @@ $I->dontSeeResponseCodeIs(HttpCode::NOT_FOUND); #### getDescription() - *public static* getDescription($code) + *public static* getDescription($code) + + +* `param int` $code +* `return string|int` Returns string with HTTP code and its description diff --git a/docs/reference/InitTemplate.md b/docs/reference/InitTemplate.md index 4b3173f58..1dac3fe3d 100644 --- a/docs/reference/InitTemplate.md +++ b/docs/reference/InitTemplate.md @@ -32,25 +32,42 @@ This class provides various helper methods for building customized setup #### __construct() - *public* __construct($input, $output) + *public* __construct($input, $output) + + +* `param \Symfony\Component\Console\Input\InputInterface` $input +* `param \Symfony\Component\Console\Output\OutputInterface` $output [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/InitTemplate.php#L60) #### addModulesToComposer() - *protected* addModulesToComposer(array $modules) + *protected* addModulesToComposer(array $modules) + + +* `param array` $modules +* `return ?int` [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/InitTemplate.php#L237) #### addStyles() - *public* addStyles($output) + *public* addStyles($output) + + +* `param \Symfony\Component\Console\Output\OutputInterface` $output +* `return void` [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/InitTemplate.php#L12) #### ask() - *protected* ask($question, $answer = null) + *protected* ask($question, $answer = null) + + +* `param string` $question +* `param array|string|bool|null` $answer +* `return mixed|string` {% highlight php %} @@ -65,48 +82,75 @@ $this->ask('select the browser of your choice', ['firefox', 'chrome']); $this->ask('do you want to proceed (y/n)', true); {% endhighlight %} - * `return` mixed|string [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/InitTemplate.php#L100) #### breakParts() - *protected* breakParts($class) - * `return` string[] + *protected* breakParts($class) + + +* `param string` $class +* `return string[]` [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/InitTemplate.php#L19) #### checkInstalled() - *protected* checkInstalled($dir = '.') + *protected* checkInstalled($dir = '.') + + +* `param string` $dir +* `return void` [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/InitTemplate.php#L198) #### completeSuffix() - *protected* completeSuffix($filename, $suffix) + *protected* completeSuffix($filename, $suffix) + + +* `param string` $filename +* `param string` $suffix +* `return string` [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/InitTemplate.php#L37) #### createActor() - *protected* createActor($name, $directory, array $suiteConfig) + *protected* createActor($name, $directory, array $suiteConfig) + + +* `param array $suiteConfig +* `param string` $name +* `param string` $directory +* `param array` $suiteConfig +* `return void` Create an Actor class and generate actions for it. + Requires a suite config as array in 3rd parameter. - * `param array` $suiteConfig [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/InitTemplate.php#L210) #### createDirectoryFor() - *protected* createDirectoryFor($basePath, $className = '') + *protected* createDirectoryFor($basePath, $className = '') + + +* `param string` $basePath +* `param string` $className +* `return string` [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/InitTemplate.php#L22) #### createEmptyDirectory() - *protected* createEmptyDirectory($dir) + *protected* createEmptyDirectory($dir) + + +* `param string` $dir +* `return void` Create an empty directory and add a placeholder file into it @@ -114,13 +158,26 @@ Create an empty directory and add a placeholder file into it #### createFile() - *protected* createFile($filename, $contents, $force = false, $flags = 0) + *protected* createFile($filename, $contents, $force = false, $flags = 0) + + +* `param string` $filename +* `param string` $contents +* `param bool` $force +* `param int` $flags +* `return bool` [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/InitTemplate.php#L58) #### createHelper() - *protected* createHelper($name, $directory, array $settings = array ( )) + *protected* createHelper($name, $directory, array $settings = array ( )) + + +* `param string` $name +* `param string` $directory +* `param array` $settings +* `return void` Create a helper class inside a directory @@ -128,37 +185,61 @@ Create a helper class inside a directory #### getNamespaceHeader() - *protected* getNamespaceHeader($class) + *protected* getNamespaceHeader($class) + + +* `param string` $class +* `return string` [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/InitTemplate.php#L38) #### getNamespaceString() - *protected* getNamespaceString($class) + *protected* getNamespaceString($class) + + +* `param string` $class +* `return string` [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/InitTemplate.php#L32) #### getNamespaces() - *protected* getNamespaces($class) + *protected* getNamespaces($class) + + +* `param string` $class +* `return array` [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/InitTemplate.php#L47) #### getShortClassName() - *protected* getShortClassName($class) + *protected* getShortClassName($class) + + +* `param string` $class +* `return string` [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/InitTemplate.php#L26) #### gitIgnore() - *protected* gitIgnore($path) + *protected* gitIgnore($path) + + +* `param string` $path +* `return void` [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/InitTemplate.php#L193) #### initDir() - *public* initDir($workDir) + *public* initDir($workDir) + + +* `param string` $workDir +* `return void` Change the directory where Codeception should be installed. @@ -166,13 +247,22 @@ Change the directory where Codeception should be installed. #### removeSuffix() - *protected* removeSuffix($classname, $suffix) + *protected* removeSuffix($classname, $suffix) + + +* `param string` $classname +* `param string` $suffix +* `return string` [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/InitTemplate.php#L52) #### say() - *protected* say($message = '') + *protected* say($message = '') + + +* `param string` $message +* `return void` Print a message to console. @@ -187,7 +277,11 @@ $this->say('Welcome to Setup'); #### sayError() - *protected* sayError($message) + *protected* sayError($message) + + +* `param string` $message +* `return void` Print error message @@ -195,7 +289,11 @@ Print error message #### sayInfo() - *protected* sayInfo($message) + *protected* sayInfo($message) + + +* `param string` $message +* `return void` Print info message @@ -203,7 +301,11 @@ Print info message #### saySuccess() - *protected* saySuccess($message) + *protected* saySuccess($message) + + +* `param string` $message +* `return void` Print a successful message @@ -211,7 +313,11 @@ Print a successful message #### sayWarning() - *protected* sayWarning($message) + *protected* sayWarning($message) + + +* `param string` $message +* `return void` Print warning message @@ -219,16 +325,22 @@ Print warning message #### setup() - *abstract public* setup() + *abstract public* setup() + + +* `return mixed` Override this class to create customized setup. - * `return` mixed [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/InitTemplate.php#L83) #### updateComposerClassMap() - *private* updateComposerClassMap($vendorDir = 'vendor') + *private* updateComposerClassMap($vendorDir = 'vendor') + + +* `param string` $vendorDir +* `return void` [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/InitTemplate.php#L309) diff --git a/docs/reference/JsonType.md b/docs/reference/JsonType.md index 79b4ed404..dbd30b99a 100644 --- a/docs/reference/JsonType.md +++ b/docs/reference/JsonType.md @@ -36,21 +36,29 @@ Class JsonType #### __construct() - *public* __construct($jsonArray) + *public* __construct($jsonArray) + + +* `param ` $jsonArray array|JsonArray Creates instance of JsonType Pass an array or `\Codeception\Util\JsonArray` with data. -If non-associative array is passed - the very first element of it will be used for matching. - * `param` $jsonArray array|JsonArray +If non-associative array is passed - the very first element of it will be used for matching. [See source](https://github.com/Codeception/module-rest/blob/master/src/Codeception/Util/JsonType.php#L47) #### addCustomFilter() - *public static* addCustomFilter($name, callable $callable) + *public static* addCustomFilter($name, callable $callable) + + +* `param string` $name +* `param callable` $callable +* `return void` Adds custom filter to JsonType list. + You should specify a name and parameters of a filter. Example: @@ -76,7 +84,10 @@ JsonType::addCustomFilter('/len\((.*?)\)/', function($value, $len) { #### cleanCustomFilters() - *public static* cleanCustomFilters() + *public static* cleanCustomFilters() + + +* `return void` Removes all custom filters @@ -84,9 +95,14 @@ Removes all custom filters #### matches() - *public* matches(array $jsonType) + *public* matches(array $jsonType) + + +* `param array` $jsonType +* `return string|bool` Checks data against passed JsonType. + If matching fails function returns a string with a message describing failure. On success returns `true`. diff --git a/docs/reference/Locator.md b/docs/reference/Locator.md index 026efaf3c..453285b58 100644 --- a/docs/reference/Locator.md +++ b/docs/reference/Locator.md @@ -15,9 +15,17 @@ Please check them before writing complex functional or acceptance tests. #### combine() - *public static* combine($selector1, $selector2) + *public static* combine($selector1, $selector2) + + +* `static` +* `param string` $selector1 +* `param string` $selector2 +* `throws Exception` +* `return string` Applies OR operator to any number of CSS or XPath selectors. + You can mix up CSS and XPath selectors here. {% highlight php %} @@ -42,15 +50,20 @@ $I->fillField(Locator::combine('form input[type=text]','//form/textarea[2]'), 'q {% endhighlight %} As a result the Locator will produce a mixed XPath value that will be used in fillField action. - * `static` * `throws` Exception [See source](https://github.com/Codeception/lib-web/blob/master/src/Codeception/Util/Locator.php#L61) #### contains() - *public static* contains($element, $text) + *public static* contains($element, $text) + + +* `param string` $element +* `param string` $text +* `return string` Locates an element containing a text inside. + Either CSS or XPath locator can be passed, however they will be converted to XPath. {% highlight php %} @@ -67,9 +80,15 @@ Locator::contains('div[@contenteditable=true]', 'hello world'); #### elementAt() - *public static* elementAt($element, $position) + *public static* elementAt($element, $position) + + +* `param string` $element CSS or XPath locator +* `param int|string` $position xPath index +* `return string` Locates element at position. + Either CSS or XPath locator can be passed as locator, position is an integer. If a negative value is provided, counting starts from the last element. First element has index 1 @@ -85,14 +104,17 @@ Locator::elementAt('table#grind>tr', -2); // previous than last row {% endhighlight %} - * `param string` $element CSS or XPath locator - * `param int|string` $position xPath index - [See source](https://github.com/Codeception/lib-web/blob/master/src/Codeception/Util/Locator.php#L280) #### find() - *public static* find($element, array $attributes) + *public static* find($element, array $attributes) + + +* `static` +* `param string` $element +* `param array` $attributes +* `return string` Finds element by it's attribute(s) @@ -104,14 +126,19 @@ use \Codeception\Util\Locator; $I->seeElement(Locator::find('img', ['title' => 'diagram'])); {% endhighlight %} - * `static` + [See source](https://github.com/Codeception/lib-web/blob/master/src/Codeception/Util/Locator.php#L147) #### firstElement() - *public static* firstElement($element) + *public static* firstElement($element) + + +* `param string` $element +* `return string` Locates first element of group elements. + Either CSS or XPath locator can be passed as locator, Equal to `Locator::elementAt($locator, 1)` @@ -128,7 +155,12 @@ Locator::firstElement('//table/tr'); #### href() - *public static* href($url) + *public static* href($url) + + +* `static` +* `param string` $url +* `return string` Matches the *a* element with given URL @@ -140,12 +172,16 @@ use \Codeception\Util\Locator; $I->see('Log In', Locator::href('/login.php')); {% endhighlight %} - * `static` + [See source](https://github.com/Codeception/lib-web/blob/master/src/Codeception/Util/Locator.php#L84) #### humanReadableString() - *public static* humanReadableString($selector) + *public static* humanReadableString($selector) + + +* `param \Facebook\WebDriver\WebDriverBy|array|string` $selector +* `return string` Transforms strict locator, \Facebook\WebDriver\WebDriverBy into a string representation @@ -153,7 +189,11 @@ Transforms strict locator, \Facebook\WebDriver\WebDriverBy into a string represe #### isCSS() - *public static* isCSS($selector) + *public static* isCSS($selector) + + +* `param string` $selector +* `return bool` Checks that provided string is CSS selector @@ -170,7 +210,11 @@ Locator::isCSS('//body/p/user') => false #### isClass() - *public static* isClass($class) + *public static* isClass($class) + + +* `param string` $class +* `return bool` Checks that a string is valid CSS class @@ -187,7 +231,11 @@ Locator::isClass('//body/p/user') => false #### isID() - *public static* isID($id) + *public static* isID($id) + + +* `param string` $id +* `return bool` Checks that a string is valid CSS ID @@ -204,13 +252,21 @@ Locator::isID('//body/p/user') => false #### isPrecise() - *public static* isPrecise($locator) + *public static* isPrecise($locator) + + +* `param \Facebook\WebDriver\WebDriverBy|array|string` $locator +* `return bool` [See source](https://github.com/Codeception/lib-web/blob/master/src/Codeception/Util/Locator.php#L197) #### isXPath() - *public static* isXPath($locator) + *public static* isXPath($locator) + + +* `param string` $locator +* `return bool` Checks that locator is an XPath @@ -227,9 +283,14 @@ Locator::isXPath('//body/p/user') => true #### lastElement() - *public static* lastElement($element) + *public static* lastElement($element) + + +* `param string` $element +* `return string` Locates last element of group elements. + Either CSS or XPath locator can be passed as locator, Equal to `Locator::elementAt($locator, -1)` @@ -246,7 +307,11 @@ Locator::lastElement('//table/tr'); #### option() - *public static* option($value) + *public static* option($value) + + +* `param string` $value +* `return string` Matches option by text: @@ -263,7 +328,12 @@ $I->seeElement(Locator::option('Male'), '#select-gender'); #### tabIndex() - *public static* tabIndex($index) + *public static* tabIndex($index) + + +* `static` +* `param int` $index +* `return string` Matches the element with given tab index @@ -279,7 +349,7 @@ $I->fillField(Locator::tabIndex(2) , 'qwerty'); $I->click('Login'); {% endhighlight %} - * `static` + [See source](https://github.com/Codeception/lib-web/blob/master/src/Codeception/Util/Locator.php#L104)

 

Reference is taken from the source code. Help us to improve documentation. Edit module reference
diff --git a/docs/reference/Mock.md b/docs/reference/Mock.md index a431425f0..b37f27e8c 100644 --- a/docs/reference/Mock.md +++ b/docs/reference/Mock.md @@ -9,8 +9,18 @@ Declare mocks inside `Codeception\Test\Unit` class. If you want to use mocks outside it, check the reference for [Codeception/Stub](https://github.com/Codeception/Stub) library. -#### *public* make($class, array $params = array ( )) +#### *public* make($class, array $params = array ( )) + +* `template` RealInstanceType of object +* `param class-string|RealInstanceType|callable():` $ class-string $class - A class to be mocked +* `param array` $params - properties and methods to set +* `param ` $class +* `throws RuntimeException` when class does not exist +* `throws Exception` +* `return MockObject&RealInstanceType` - mock + Instantiates a class without executing a constructor. + Properties and methods can be set as a second parameter. Even protected and private properties can be set. @@ -41,16 +51,18 @@ $this->make('User', ['save' => function () { return true; }]); $this->make('User', ['save' => true]); {% endhighlight %} -@template RealInstanceType of object - * `param class-string|RealInstanceType|callable(): class-string` $class - A class to be mocked - * `param array` $params - properties and methods to set -@return MockObject&RealInstanceType - mock -@throws RuntimeException when class does not exist -@throws Exception +#### *public* makeEmpty($class, array $params = array ( )) + +* `template` RealInstanceType of object +* `param class-string|RealInstanceType|callable():` $ class-string $class - A class to be mocked +* `param array` $params +* `param ` $class +* `throws Exception` +* `return MockObject&RealInstanceType` -#### *public* makeEmpty($class, array $params = array ( )) Instantiates class having all methods replaced with dummies. + Constructor is not triggered. Properties and methods can be set as a second parameter. Even protected and private properties can be set. @@ -83,14 +95,18 @@ $this->makeEmpty('User', ['save' => true]); {% endhighlight %} -@template RealInstanceType of object - * `param class-string|RealInstanceType|callable(): class-string` $class - A class to be mocked - * `param array` $params -@return MockObject&RealInstanceType -@throws Exception +#### *public* makeEmptyExcept($class, $method, array $params = array ( )) + +* `template` RealInstanceType of object +* `param class-string|RealInstanceType|callable():` $ class-string $class - A class to be mocked +* `param ` $class +* `param string` $method +* `param array` $params +* `throws Exception` +* `return \PHPUnit\Framework\MockObject\MockObject&RealInstanceType` -#### *public* makeEmptyExcept($class, $method, array $params = array ( )) Instantiates class having all methods replaced with dummies except one. + Constructor is not triggered. Properties and methods can be replaced. Even protected and private properties can be set. @@ -123,14 +139,18 @@ $this->makeEmptyExcept('User', 'save', ['isValid' => true]); {% endhighlight %} -@template RealInstanceType of object - * `param class-string|RealInstanceType|callable(): class-string` $class - A class to be mocked +#### *public* construct($class, array $constructorParams = array ( ), array $params = array ( )) -@return \PHPUnit\Framework\MockObject\MockObject&RealInstanceType -@throws Exception +* `template` RealInstanceType of object +* `param class-string|RealInstanceType|callable():` $ class-string $class - A class to be mocked +* `param ` $class +* `param array` $constructorParams +* `param array` $params +* `throws Exception` +* `return MockObject&RealInstanceType` -#### *public* construct($class, array $constructorParams = array ( ), array $params = array ( )) Instantiates a class instance by running constructor. + Parameters for constructor passed as second argument Properties and methods can be set in third argument. Even protected and private properties can be set. @@ -163,13 +183,17 @@ $this->construct('User', [], ['save' => true]); {% endhighlight %} -@template RealInstanceType of object - * `param class-string|RealInstanceType|callable(): class-string` $class - A class to be mocked -@return MockObject&RealInstanceType -@throws Exception +#### *public* constructEmpty($class, array $constructorParams = array ( ), array $params = array ( )) + +* `template` RealInstanceType of object +* `param class-string|RealInstanceType|callable():` $ class-string $class - A class to be mocked +* `param ` $class +* `param array` $constructorParams +* `param array` $params +* `return MockObject&RealInstanceType` -#### *public* constructEmpty($class, array $constructorParams = array ( ), array $params = array ( )) Instantiates a class instance by running constructor with all methods replaced with dummies. + Parameters for constructor passed as second argument Properties and methods can be set in third argument. Even protected and private properties can be set. @@ -213,12 +237,18 @@ $this->constructEmpty('User', [], [ {% endhighlight %} -@template RealInstanceType of object - * `param class-string|RealInstanceType|callable(): class-string` $class - A class to be mocked -@return MockObject&RealInstanceType +#### *public* constructEmptyExcept($class, $method, array $constructorParams = array ( ), array $params = array ( )) + +* `template` RealInstanceType of object +* `param class-string|RealInstanceType|callable():` $ class-string $class - A class to be mocked +* `param ` $class +* `param string` $method +* `param array` $constructorParams +* `param array` $params +* `return MockObject&RealInstanceType` -#### *public* constructEmptyExcept($class, $method, array $constructorParams = array ( ), array $params = array ( )) Instantiates a class instance by running constructor with all methods replaced with dummies, except one. + Parameters for constructor passed as second argument Properties and methods can be set in third argument. Even protected and private properties can be set. @@ -251,14 +281,14 @@ $this->constructEmptyExcept('User', 'save', [], ['save' => true]); {% endhighlight %} -@template RealInstanceType of object - * `param class-string|RealInstanceType|callable(): class-string` $class - A class to be mocked -@return MockObject&RealInstanceType +#### *public static* never($params = null) + +* `param mixed` $params +* `return \Codeception\Stub\StubMarshaler` -#### *public static* never($params = null) Checks if a method never has been invoked If method invoked, it will immediately throw an @@ -277,9 +307,11 @@ $user->someMethod(); {% endhighlight %} - * `param mixed` $params +#### *public static* once($params = null) + +* `param mixed` $params +* `return \Codeception\Stub\StubMarshaler` -#### *public static* once($params = null) Checks if a method has been invoked exactly one time. @@ -311,9 +343,11 @@ Expected::once(function() { return Faker::name(); }); {% endhighlight %} - * `param mixed` $params +#### *public static* atLeastOnce($params = null) + +* `param mixed` $params +* `return \Codeception\Stub\StubMarshaler` -#### *public static* atLeastOnce($params = null) Checks if a method has been invoked at least one time. @@ -346,11 +380,15 @@ Expected::atLeastOnce(function() { return Faker::name(); }); {% endhighlight %} - * `param mixed` $params +#### *public static* exactly($count, $params = null) + +* `param mixed` $params +* `param int` $count +* `return \Codeception\Stub\StubMarshaler` -#### *public static* exactly($count, $params = null) Checks if a method has been invoked a certain amount of times. + If the number of invocations exceeds the value it will immediately throw an exception, If the number is less it will later be checked in verify() and also throw an @@ -384,6 +422,4 @@ Expected::exactly(function() { return Faker::name() }); {% endhighlight %} - * `param mixed` $params - diff --git a/docs/reference/Module.md b/docs/reference/Module.md index a90b8ab1a..1bb0cfaba 100644 --- a/docs/reference/Module.md +++ b/docs/reference/Module.md @@ -46,7 +46,11 @@ Allows to explicitly exclude actions from module. Allows to rename actions #### __construct() - *public* __construct($moduleContainer, array $config = null) + *public* __construct($moduleContainer, array $config = null) + + +* `param \Codeception\Lib\ModuleContainer` $moduleContainer +* `param ?array` $config Module constructor. @@ -56,7 +60,10 @@ Requires module container (to provide access between modules of suite) and confi #### _after() - *public* _after($test) + *public* _after($test) + + +* `param \Codeception\TestInterface` $test **HOOK** executed after test @@ -64,7 +71,10 @@ Requires module container (to provide access between modules of suite) and confi #### _afterStep() - *public* _afterStep($step) + *public* _afterStep($step) + + +* `param \Codeception\Step` $step **HOOK** executed after step @@ -72,7 +82,8 @@ Requires module container (to provide access between modules of suite) and confi #### _afterSuite() - *public* _afterSuite() + *public* _afterSuite() + **HOOK** executed after suite @@ -80,7 +91,10 @@ Requires module container (to provide access between modules of suite) and confi #### _before() - *public* _before($test) + *public* _before($test) + + +* `param \Codeception\TestInterface` $test **HOOK** executed before test @@ -88,7 +102,10 @@ Requires module container (to provide access between modules of suite) and confi #### _beforeStep() - *public* _beforeStep($step) + *public* _beforeStep($step) + + +* `param \Codeception\Step` $step **HOOK** executed before step @@ -96,7 +113,10 @@ Requires module container (to provide access between modules of suite) and confi #### _beforeSuite() - *public* _beforeSuite(array $settings = array ( )) + *public* _beforeSuite(array $settings = array ( )) + + +* `param array` $settings **HOOK** executed before suite @@ -104,7 +124,11 @@ Requires module container (to provide access between modules of suite) and confi #### _failed() - *public* _failed($test, $fail) + *public* _failed($test, $fail) + + +* `param \Codeception\TestInterface` $test +* `param \Exception` $fail **HOOK** executed when test fails but before `_after` @@ -112,18 +136,22 @@ Requires module container (to provide access between modules of suite) and confi #### _getConfig() - *public* _getConfig($key = null) + *public* _getConfig($key = null) -Get config values or specific config item. - * `param string|null` $key - * `return` mixed the config item's value or null if it doesn't exist +* `param string|null` $key +* `return mixed` the config item's value or null if it doesn't exist + +Get config values or specific config item. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L301) #### _getName() - *public* _getName() + *public* _getName() + + +* `return string` Returns a module name for a Module, a class name for Helper @@ -131,7 +159,10 @@ Returns a module name for a Module, a class name for Helper #### _hasRequiredFields() - *public* _hasRequiredFields() + *public* _hasRequiredFields() + + +* `return bool` Checks if a module has required fields @@ -139,7 +170,8 @@ Checks if a module has required fields #### _initialize() - *public* _initialize() + *public* _initialize() + **HOOK** triggered after module is created and configuration is loaded @@ -147,9 +179,15 @@ Checks if a module has required fields #### _reconfigure() - *public* _reconfigure(array $config) + *public* _reconfigure(array $config) + + +* `param array` $config +* `throws ModuleConfigException|ModuleException` +* `return void` Allows to redefine config for a specific test. + Config is restored at the end of a test. {% highlight php %} @@ -163,13 +201,15 @@ public function _before(Test $test) { } {% endhighlight %} - * `throws` ModuleConfigException|ModuleException [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L104) #### _resetConfig() - *public* _resetConfig() + *public* _resetConfig() + + +* `return void` Reverts config changed by `_reconfigure` @@ -177,9 +217,15 @@ Reverts config changed by `_reconfigure` #### _setConfig() - *public* _setConfig(array $config) + *public* _setConfig(array $config) + + +* `param array` $config +* `throws ModuleConfigException|ModuleException` +* `return void` Allows to define initial module config. + Can be used in `_beforeSuite` hook of Helpers or Extensions {% highlight php %} @@ -190,41 +236,53 @@ public function _beforeSuite($settings = []) { } {% endhighlight %} - * `throws` ModuleConfigException|ModuleException [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L81) #### assert() - *protected* assert(array $arguments, $not = false) + *protected* assert(array $arguments, $not = false) + + +* `param array` $arguments +* `param bool` $not [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L16) #### assertArrayHasKey() - *protected* assertArrayHasKey($key, $array, $message = '') + *protected* assertArrayHasKey($key, $array, $message = '') -Asserts that an array has a specified key. - * `param int|string` $key - * `param array|ArrayAccess` $array +* `param int|string` $key +* `param array|ArrayAccess` $array +* `param string` $message + +Asserts that an array has a specified key. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L22) #### assertArrayNotHasKey() - *protected* assertArrayNotHasKey($key, $array, $message = '') + *protected* assertArrayNotHasKey($key, $array, $message = '') -Asserts that an array does not have a specified key. - * `param int|string` $key - * `param array|ArrayAccess` $array +* `param int|string` $key +* `param array|ArrayAccess` $array +* `param string` $message + +Asserts that an array does not have a specified key. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L33) #### assertClassHasAttribute() - *protected* assertClassHasAttribute($attributeName, $className, $message = '') + *protected* assertClassHasAttribute($attributeName, $className, $message = '') + + +* `param string` $attributeName +* `param string` $className +* `param string` $message Asserts that a class has a specified attribute. @@ -232,7 +290,12 @@ Asserts that a class has a specified attribute. #### assertClassHasStaticAttribute() - *protected* assertClassHasStaticAttribute($attributeName, $className, $message = '') + *protected* assertClassHasStaticAttribute($attributeName, $className, $message = '') + + +* `param string` $attributeName +* `param string` $className +* `param string` $message Asserts that a class has a specified static attribute. @@ -240,7 +303,12 @@ Asserts that a class has a specified static attribute. #### assertClassNotHasAttribute() - *protected* assertClassNotHasAttribute($attributeName, $className, $message = '') + *protected* assertClassNotHasAttribute($attributeName, $className, $message = '') + + +* `param string` $attributeName +* `param string` $className +* `param string` $message Asserts that a class does not have a specified attribute. @@ -248,7 +316,12 @@ Asserts that a class does not have a specified attribute. #### assertClassNotHasStaticAttribute() - *protected* assertClassNotHasStaticAttribute($attributeName, $className, $message = '') + *protected* assertClassNotHasStaticAttribute($attributeName, $className, $message = '') + + +* `param string` $attributeName +* `param string` $className +* `param string` $message Asserts that a class does not have a specified static attribute. @@ -256,25 +329,37 @@ Asserts that a class does not have a specified static attribute. #### assertContains() - *protected* assertContains($needle, $haystack, $message = '') + *protected* assertContains($needle, $haystack, $message = '') -Asserts that a haystack contains a needle. - * `param mixed` $needle +* `param mixed` $needle +* `param iterable` $haystack +* `param string` $message + +Asserts that a haystack contains a needle. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L75) #### assertContainsEquals() - *protected* assertContainsEquals($needle, $haystack, $message = '') + *protected* assertContainsEquals($needle, $haystack, $message = '') + - * `param mixed` $needle +* `param mixed` $needle +* `param iterable` $haystack +* `param string` $message [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L83) #### assertContainsOnly() - *protected* assertContainsOnly($type, $haystack, $isNativeType = null, $message = '') + *protected* assertContainsOnly($type, $haystack, $isNativeType = null, $message = '') + + +* `param string` $type +* `param iterable` $haystack +* `param ?bool` $isNativeType +* `param string` $message Asserts that a haystack contains only values of a given type. @@ -282,7 +367,12 @@ Asserts that a haystack contains only values of a given type. #### assertContainsOnlyInstancesOf() - *protected* assertContainsOnlyInstancesOf($className, $haystack, $message = '') + *protected* assertContainsOnlyInstancesOf($className, $haystack, $message = '') + + +* `param string` $className +* `param iterable` $haystack +* `param string` $message Asserts that a haystack contains only instances of a given class name. @@ -290,17 +380,24 @@ Asserts that a haystack contains only instances of a given class name. #### assertCount() - *protected* assertCount($expectedCount, $haystack, $message = '') + *protected* assertCount($expectedCount, $haystack, $message = '') -Asserts the number of elements of an array, Countable or Traversable. - * `param Countable|iterable` $haystack +* `param Countable|iterable` $haystack +* `param int` $expectedCount +* `param string` $message + +Asserts the number of elements of an array, Countable or Traversable. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L109) #### assertDirectoryDoesNotExist() - *protected* assertDirectoryDoesNotExist($directory, $message = '') + *protected* assertDirectoryDoesNotExist($directory, $message = '') + + +* `param string` $directory +* `param string` $message Asserts that a directory does not exist. @@ -308,7 +405,11 @@ Asserts that a directory does not exist. #### assertDirectoryExists() - *protected* assertDirectoryExists($directory, $message = '') + *protected* assertDirectoryExists($directory, $message = '') + + +* `param string` $directory +* `param string` $message Asserts that a directory exists. @@ -316,7 +417,11 @@ Asserts that a directory exists. #### assertDirectoryIsNotReadable() - *protected* assertDirectoryIsNotReadable($directory, $message = '') + *protected* assertDirectoryIsNotReadable($directory, $message = '') + + +* `param string` $directory +* `param string` $message Asserts that a directory exists and is not readable. @@ -324,7 +429,11 @@ Asserts that a directory exists and is not readable. #### assertDirectoryIsNotWritable() - *protected* assertDirectoryIsNotWritable($directory, $message = '') + *protected* assertDirectoryIsNotWritable($directory, $message = '') + + +* `param string` $directory +* `param string` $message Asserts that a directory exists and is not writable. @@ -332,7 +441,11 @@ Asserts that a directory exists and is not writable. #### assertDirectoryIsReadable() - *protected* assertDirectoryIsReadable($directory, $message = '') + *protected* assertDirectoryIsReadable($directory, $message = '') + + +* `param string` $directory +* `param string` $message Asserts that a directory exists and is readable. @@ -340,7 +453,11 @@ Asserts that a directory exists and is readable. #### assertDirectoryIsWritable() - *protected* assertDirectoryIsWritable($directory, $message = '') + *protected* assertDirectoryIsWritable($directory, $message = '') + + +* `param string` $directory +* `param string` $message Asserts that a directory exists and is writable. @@ -348,7 +465,12 @@ Asserts that a directory exists and is writable. #### assertDoesNotMatchRegularExpression() - *protected* assertDoesNotMatchRegularExpression($pattern, $string, $message = '') + *protected* assertDoesNotMatchRegularExpression($pattern, $string, $message = '') + + +* `param string` $pattern +* `param string` $string +* `param string` $message Asserts that a string does not match a given regular expression. @@ -356,71 +478,88 @@ Asserts that a string does not match a given regular expression. #### assertEmpty() - *protected* assertEmpty($actual, $message = '') + *protected* assertEmpty($actual, $message = '') -Asserts that a variable is empty. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is empty. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L175) #### assertEquals() - *protected* assertEquals($expected, $actual, $message = '') + *protected* assertEquals($expected, $actual, $message = '') -Asserts that two variables are equal. - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that two variables are equal. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L186) #### assertEqualsCanonicalizing() - *protected* assertEqualsCanonicalizing($expected, $actual, $message = '') + *protected* assertEqualsCanonicalizing($expected, $actual, $message = '') -Asserts that two variables are equal (canonicalizing). - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that two variables are equal (canonicalizing). [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L197) #### assertEqualsIgnoringCase() - *protected* assertEqualsIgnoringCase($expected, $actual, $message = '') + *protected* assertEqualsIgnoringCase($expected, $actual, $message = '') -Asserts that two variables are equal (ignoring case). - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that two variables are equal (ignoring case). [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L208) #### assertEqualsWithDelta() - *protected* assertEqualsWithDelta($expected, $actual, $delta, $message = '') + *protected* assertEqualsWithDelta($expected, $actual, $delta, $message = '') -Asserts that two variables are equal (with delta). - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param float` $delta +* `param string` $message + +Asserts that two variables are equal (with delta). [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L219) #### assertFalse() - *protected* assertFalse($condition, $message = '') + *protected* assertFalse($condition, $message = '') -Asserts that a condition is false. - * `param mixed` $condition +* `param mixed` $condition +* `param string` $message + +Asserts that a condition is false. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L229) #### assertFileDoesNotExist() - *protected* assertFileDoesNotExist($filename, $message = '') + *protected* assertFileDoesNotExist($filename, $message = '') + + +* `param string` $filename +* `param string` $message Asserts that a file does not exist. @@ -428,7 +567,12 @@ Asserts that a file does not exist. #### assertFileEquals() - *protected* assertFileEquals($expected, $actual, $message = '') + *protected* assertFileEquals($expected, $actual, $message = '') + + +* `param string` $expected +* `param string` $actual +* `param string` $message Asserts that the contents of one file is equal to the contents of another file. @@ -436,7 +580,12 @@ Asserts that the contents of one file is equal to the contents of another file. #### assertFileEqualsCanonicalizing() - *protected* assertFileEqualsCanonicalizing($expected, $actual, $message = '') + *protected* assertFileEqualsCanonicalizing($expected, $actual, $message = '') + + +* `param string` $expected +* `param string` $actual +* `param string` $message Asserts that the contents of one file is equal to the contents of another file (canonicalizing). @@ -444,7 +593,12 @@ Asserts that the contents of one file is equal to the contents of another file ( #### assertFileEqualsIgnoringCase() - *protected* assertFileEqualsIgnoringCase($expected, $actual, $message = '') + *protected* assertFileEqualsIgnoringCase($expected, $actual, $message = '') + + +* `param string` $expected +* `param string` $actual +* `param string` $message Asserts that the contents of one file is equal to the contents of another file (ignoring case). @@ -452,7 +606,11 @@ Asserts that the contents of one file is equal to the contents of another file ( #### assertFileExists() - *protected* assertFileExists($filename, $message = '') + *protected* assertFileExists($filename, $message = '') + + +* `param string` $filename +* `param string` $message Asserts that a file exists. @@ -460,7 +618,11 @@ Asserts that a file exists. #### assertFileIsNotReadable() - *protected* assertFileIsNotReadable($file, $message = '') + *protected* assertFileIsNotReadable($file, $message = '') + + +* `param string` $file +* `param string` $message Asserts that a file exists and is not readable. @@ -468,7 +630,11 @@ Asserts that a file exists and is not readable. #### assertFileIsNotWritable() - *protected* assertFileIsNotWritable($file, $message = '') + *protected* assertFileIsNotWritable($file, $message = '') + + +* `param string` $file +* `param string` $message Asserts that a file exists and is not writable. @@ -476,7 +642,11 @@ Asserts that a file exists and is not writable. #### assertFileIsReadable() - *protected* assertFileIsReadable($file, $message = '') + *protected* assertFileIsReadable($file, $message = '') + + +* `param string` $file +* `param string` $message Asserts that a file exists and is readable. @@ -484,7 +654,11 @@ Asserts that a file exists and is readable. #### assertFileIsWritable() - *protected* assertFileIsWritable($file, $message = '') + *protected* assertFileIsWritable($file, $message = '') + + +* `param string` $file +* `param string` $message Asserts that a file exists and is writable. @@ -492,7 +666,12 @@ Asserts that a file exists and is writable. #### assertFileNotEquals() - *protected* assertFileNotEquals($expected, $actual, $message = '') + *protected* assertFileNotEquals($expected, $actual, $message = '') + + +* `param string` $expected +* `param string` $actual +* `param string` $message Asserts that the contents of one file is not equal to the contents of another file. @@ -500,7 +679,12 @@ Asserts that the contents of one file is not equal to the contents of another fi #### assertFileNotEqualsCanonicalizing() - *protected* assertFileNotEqualsCanonicalizing($expected, $actual, $message = '') + *protected* assertFileNotEqualsCanonicalizing($expected, $actual, $message = '') + + +* `param string` $expected +* `param string` $actual +* `param string` $message Asserts that the contents of one file is not equal to the contents of another file (canonicalizing). @@ -508,7 +692,12 @@ Asserts that the contents of one file is not equal to the contents of another fi #### assertFileNotEqualsIgnoringCase() - *protected* assertFileNotEqualsIgnoringCase($expected, $actual, $message = '') + *protected* assertFileNotEqualsIgnoringCase($expected, $actual, $message = '') + + +* `param string` $expected +* `param string` $actual +* `param string` $message Asserts that the contents of one file is not equal to the contents of another file (ignoring case). @@ -516,7 +705,11 @@ Asserts that the contents of one file is not equal to the contents of another fi #### assertFileNotExists() - *protected* assertFileNotExists($filename, $message = '') + *protected* assertFileNotExists($filename, $message = '') + + +* `param string` $filename +* `param string` $message Asserts that a file does not exist. @@ -524,240 +717,291 @@ Asserts that a file does not exist. #### assertFinite() - *protected* assertFinite($actual, $message = '') + *protected* assertFinite($actual, $message = '') -Asserts that a variable is finite. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is finite. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L335) #### assertGreaterOrEquals() - *protected* assertGreaterOrEquals($expected, $actual, $message = '') + *protected* assertGreaterOrEquals($expected, $actual, $message = '') -Asserts that a value is greater than or equal to another value. - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that a value is greater than or equal to another value. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L52) #### assertGreaterThan() - *protected* assertGreaterThan($expected, $actual, $message = '') + *protected* assertGreaterThan($expected, $actual, $message = '') -Asserts that a value is greater than another value. - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that a value is greater than another value. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L346) #### assertGreaterThanOrEqual() - *protected* assertGreaterThanOrEqual($expected, $actual, $message = '') + *protected* assertGreaterThanOrEqual($expected, $actual, $message = '') -Asserts that a value is greater than or equal to another value. - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that a value is greater than or equal to another value. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L357) #### assertInfinite() - *protected* assertInfinite($actual, $message = '') + *protected* assertInfinite($actual, $message = '') -Asserts that a variable is infinite. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is infinite. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L367) #### assertInstanceOf() - *protected* assertInstanceOf($expected, $actual, $message = '') + *protected* assertInstanceOf($expected, $actual, $message = '') -Asserts that a variable is of a given type. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $expected +* `param string` $message + +Asserts that a variable is of a given type. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L377) #### assertIsArray() - *protected* assertIsArray($actual, $message = '') + *protected* assertIsArray($actual, $message = '') -Asserts that a variable is of type array. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is of type array. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L387) #### assertIsBool() - *protected* assertIsBool($actual, $message = '') + *protected* assertIsBool($actual, $message = '') -Asserts that a variable is of type bool. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is of type bool. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L397) #### assertIsCallable() - *protected* assertIsCallable($actual, $message = '') + *protected* assertIsCallable($actual, $message = '') -Asserts that a variable is of type callable. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is of type callable. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L407) #### assertIsClosedResource() - *protected* assertIsClosedResource($actual, $message = '') + *protected* assertIsClosedResource($actual, $message = '') -Asserts that a variable is of type resource and is closed. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is of type resource and is closed. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L417) #### assertIsEmpty() - *protected* assertIsEmpty($actual, $message = '') + *protected* assertIsEmpty($actual, $message = '') -Asserts that a variable is empty. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is empty. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L62) #### assertIsFloat() - *protected* assertIsFloat($actual, $message = '') + *protected* assertIsFloat($actual, $message = '') -Asserts that a variable is of type float. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is of type float. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L427) #### assertIsInt() - *protected* assertIsInt($actual, $message = '') + *protected* assertIsInt($actual, $message = '') -Asserts that a variable is of type int. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is of type int. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L437) #### assertIsIterable() - *protected* assertIsIterable($actual, $message = '') + *protected* assertIsIterable($actual, $message = '') -Asserts that a variable is of type iterable. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is of type iterable. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L447) #### assertIsNotArray() - *protected* assertIsNotArray($actual, $message = '') + *protected* assertIsNotArray($actual, $message = '') -Asserts that a variable is not of type array. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not of type array. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L457) #### assertIsNotBool() - *protected* assertIsNotBool($actual, $message = '') + *protected* assertIsNotBool($actual, $message = '') -Asserts that a variable is not of type bool. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not of type bool. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L467) #### assertIsNotCallable() - *protected* assertIsNotCallable($actual, $message = '') + *protected* assertIsNotCallable($actual, $message = '') -Asserts that a variable is not of type callable. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not of type callable. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L477) #### assertIsNotClosedResource() - *protected* assertIsNotClosedResource($actual, $message = '') + *protected* assertIsNotClosedResource($actual, $message = '') -Asserts that a variable is not of type resource. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not of type resource. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L487) #### assertIsNotFloat() - *protected* assertIsNotFloat($actual, $message = '') + *protected* assertIsNotFloat($actual, $message = '') -Asserts that a variable is not of type float. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not of type float. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L497) #### assertIsNotInt() - *protected* assertIsNotInt($actual, $message = '') + *protected* assertIsNotInt($actual, $message = '') -Asserts that a variable is not of type int. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not of type int. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L507) #### assertIsNotIterable() - *protected* assertIsNotIterable($actual, $message = '') + *protected* assertIsNotIterable($actual, $message = '') -Asserts that a variable is not of type iterable. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not of type iterable. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L517) #### assertIsNotNumeric() - *protected* assertIsNotNumeric($actual, $message = '') + *protected* assertIsNotNumeric($actual, $message = '') -Asserts that a variable is not of type numeric. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not of type numeric. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L527) #### assertIsNotObject() - *protected* assertIsNotObject($actual, $message = '') + *protected* assertIsNotObject($actual, $message = '') -Asserts that a variable is not of type object. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not of type object. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L537) #### assertIsNotReadable() - *protected* assertIsNotReadable($filename, $message = '') + *protected* assertIsNotReadable($filename, $message = '') + + +* `param string` $filename +* `param string` $message Asserts that a file/dir exists and is not readable. @@ -765,37 +1009,47 @@ Asserts that a file/dir exists and is not readable. #### assertIsNotResource() - *protected* assertIsNotResource($actual, $message = '') + *protected* assertIsNotResource($actual, $message = '') -Asserts that a variable is not of type resource. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not of type resource. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L555) #### assertIsNotScalar() - *protected* assertIsNotScalar($actual, $message = '') + *protected* assertIsNotScalar($actual, $message = '') -Asserts that a variable is not of type scalar. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not of type scalar. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L565) #### assertIsNotString() - *protected* assertIsNotString($actual, $message = '') + *protected* assertIsNotString($actual, $message = '') -Asserts that a variable is not of type string. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not of type string. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L575) #### assertIsNotWritable() - *protected* assertIsNotWritable($filename, $message = '') + *protected* assertIsNotWritable($filename, $message = '') + + +* `param string` $filename +* `param string` $message Asserts that a file/dir exists and is not writable. @@ -803,27 +1057,35 @@ Asserts that a file/dir exists and is not writable. #### assertIsNumeric() - *protected* assertIsNumeric($actual, $message = '') + *protected* assertIsNumeric($actual, $message = '') -Asserts that a variable is of type numeric. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is of type numeric. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L593) #### assertIsObject() - *protected* assertIsObject($actual, $message = '') + *protected* assertIsObject($actual, $message = '') -Asserts that a variable is of type object. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is of type object. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L603) #### assertIsReadable() - *protected* assertIsReadable($filename, $message = '') + *protected* assertIsReadable($filename, $message = '') + + +* `param string` $filename +* `param string` $message Asserts that a file/dir is readable. @@ -831,37 +1093,47 @@ Asserts that a file/dir is readable. #### assertIsResource() - *protected* assertIsResource($actual, $message = '') + *protected* assertIsResource($actual, $message = '') -Asserts that a variable is of type resource. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is of type resource. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L621) #### assertIsScalar() - *protected* assertIsScalar($actual, $message = '') + *protected* assertIsScalar($actual, $message = '') -Asserts that a variable is of type scalar. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is of type scalar. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L631) #### assertIsString() - *protected* assertIsString($actual, $message = '') + *protected* assertIsString($actual, $message = '') -Asserts that a variable is of type string. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is of type string. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L641) #### assertIsWritable() - *protected* assertIsWritable($filename, $message = '') + *protected* assertIsWritable($filename, $message = '') + + +* `param string` $filename +* `param string` $message Asserts that a file/dir exists and is writable. @@ -869,7 +1141,11 @@ Asserts that a file/dir exists and is writable. #### assertJson() - *protected* assertJson($actualJson, $message = '') + *protected* assertJson($actualJson, $message = '') + + +* `param string` $actualJson +* `param string` $message Asserts that a string is a valid JSON string. @@ -877,7 +1153,12 @@ Asserts that a string is a valid JSON string. #### assertJsonFileEqualsJsonFile() - *protected* assertJsonFileEqualsJsonFile($expectedFile, $actualFile, $message = '') + *protected* assertJsonFileEqualsJsonFile($expectedFile, $actualFile, $message = '') + + +* `param string` $expectedFile +* `param string` $actualFile +* `param string` $message Asserts that two JSON files are equal. @@ -885,7 +1166,12 @@ Asserts that two JSON files are equal. #### assertJsonFileNotEqualsJsonFile() - *protected* assertJsonFileNotEqualsJsonFile($expectedFile, $actualFile, $message = '') + *protected* assertJsonFileNotEqualsJsonFile($expectedFile, $actualFile, $message = '') + + +* `param string` $expectedFile +* `param string` $actualFile +* `param string` $message Asserts that two JSON files are not equal. @@ -893,7 +1179,12 @@ Asserts that two JSON files are not equal. #### assertJsonStringEqualsJsonFile() - *protected* assertJsonStringEqualsJsonFile($expectedFile, $actualJson, $message = '') + *protected* assertJsonStringEqualsJsonFile($expectedFile, $actualJson, $message = '') + + +* `param string` $expectedFile +* `param string` $actualJson +* `param string` $message Asserts that the generated JSON encoded object and the content of the given file are equal. @@ -901,7 +1192,12 @@ Asserts that the generated JSON encoded object and the content of the given file #### assertJsonStringEqualsJsonString() - *protected* assertJsonStringEqualsJsonString($expectedJson, $actualJson, $message = '') + *protected* assertJsonStringEqualsJsonString($expectedJson, $actualJson, $message = '') + + +* `param string` $expectedJson +* `param string` $actualJson +* `param string` $message Asserts that two given JSON encoded objects or arrays are equal. @@ -909,7 +1205,12 @@ Asserts that two given JSON encoded objects or arrays are equal. #### assertJsonStringNotEqualsJsonFile() - *protected* assertJsonStringNotEqualsJsonFile($expectedFile, $actualJson, $message = '') + *protected* assertJsonStringNotEqualsJsonFile($expectedFile, $actualJson, $message = '') + + +* `param string` $expectedFile +* `param string` $actualJson +* `param string` $message Asserts that the generated JSON encoded object and the content of the given file are not equal. @@ -917,7 +1218,12 @@ Asserts that the generated JSON encoded object and the content of the given file #### assertJsonStringNotEqualsJsonString() - *protected* assertJsonStringNotEqualsJsonString($expectedJson, $actualJson, $message = '') + *protected* assertJsonStringNotEqualsJsonString($expectedJson, $actualJson, $message = '') + + +* `param string` $expectedJson +* `param string` $actualJson +* `param string` $message Asserts that two given JSON encoded objects or arrays are not equal. @@ -925,40 +1231,51 @@ Asserts that two given JSON encoded objects or arrays are not equal. #### assertLessOrEquals() - *protected* assertLessOrEquals($expected, $actual, $message = '') + *protected* assertLessOrEquals($expected, $actual, $message = '') -Asserts that a value is smaller than or equal to another value. - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that a value is smaller than or equal to another value. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L73) #### assertLessThan() - *protected* assertLessThan($expected, $actual, $message = '') + *protected* assertLessThan($expected, $actual, $message = '') -Asserts that a value is smaller than another value. - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that a value is smaller than another value. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L716) #### assertLessThanOrEqual() - *protected* assertLessThanOrEqual($expected, $actual, $message = '') + *protected* assertLessThanOrEqual($expected, $actual, $message = '') -Asserts that a value is smaller than or equal to another value. - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that a value is smaller than or equal to another value. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L727) #### assertMatchesRegularExpression() - *protected* assertMatchesRegularExpression($pattern, $string, $message = '') + *protected* assertMatchesRegularExpression($pattern, $string, $message = '') + + +* `param string` $pattern +* `param string` $string +* `param string` $message Asserts that a string matches a given regular expression. @@ -966,39 +1283,58 @@ Asserts that a string matches a given regular expression. #### assertNan() - *protected* assertNan($actual, $message = '') + *protected* assertNan($actual, $message = '') -Asserts that a variable is nan. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is nan. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L745) #### assertNot() - *protected* assertNot($arguments) + *protected* assertNot($arguments) + + +* `param ` $arguments [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L33) #### assertNotContains() - *protected* assertNotContains($needle, $haystack, $message = '') + *protected* assertNotContains($needle, $haystack, $message = '') -Asserts that a haystack does not contain a needle. - * `param mixed` $needle +* `param mixed` $needle +* `param iterable` $haystack +* `param string` $message + +Asserts that a haystack does not contain a needle. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L755) #### assertNotContainsEquals() - *protected* assertNotContainsEquals($needle, $haystack, $message = '') + *protected* assertNotContainsEquals($needle, $haystack, $message = '') + + +* `param ` $needle +* `param iterable` $haystack +* `param string` $message [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L760) #### assertNotContainsOnly() - *protected* assertNotContainsOnly($type, $haystack, $isNativeType = null, $message = '') + *protected* assertNotContainsOnly($type, $haystack, $isNativeType = null, $message = '') + + +* `param string` $type +* `param iterable` $haystack +* `param ?bool` $isNativeType +* `param string` $message Asserts that a haystack does not contain only values of a given type. @@ -1006,101 +1342,127 @@ Asserts that a haystack does not contain only values of a given type. #### assertNotCount() - *protected* assertNotCount($expectedCount, $haystack, $message = '') + *protected* assertNotCount($expectedCount, $haystack, $message = '') -Asserts the number of elements of an array, Countable or Traversable. - * `param Countable|iterable` $haystack +* `param Countable|iterable` $haystack +* `param int` $expectedCount +* `param string` $message + +Asserts the number of elements of an array, Countable or Traversable. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L778) #### assertNotEmpty() - *protected* assertNotEmpty($actual, $message = '') + *protected* assertNotEmpty($actual, $message = '') -Asserts that a variable is not empty. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not empty. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L788) #### assertNotEquals() - *protected* assertNotEquals($expected, $actual, $message = '') + *protected* assertNotEquals($expected, $actual, $message = '') -Asserts that two variables are not equal. - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that two variables are not equal. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L799) #### assertNotEqualsCanonicalizing() - *protected* assertNotEqualsCanonicalizing($expected, $actual, $message = '') + *protected* assertNotEqualsCanonicalizing($expected, $actual, $message = '') -Asserts that two variables are not equal (canonicalizing). - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that two variables are not equal (canonicalizing). [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L810) #### assertNotEqualsIgnoringCase() - *protected* assertNotEqualsIgnoringCase($expected, $actual, $message = '') + *protected* assertNotEqualsIgnoringCase($expected, $actual, $message = '') -Asserts that two variables are not equal (ignoring case). - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that two variables are not equal (ignoring case). [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L821) #### assertNotEqualsWithDelta() - *protected* assertNotEqualsWithDelta($expected, $actual, $delta, $message = '') + *protected* assertNotEqualsWithDelta($expected, $actual, $delta, $message = '') -Asserts that two variables are not equal (with delta). - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param float` $delta +* `param string` $message + +Asserts that two variables are not equal (with delta). [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L832) #### assertNotFalse() - *protected* assertNotFalse($condition, $message = '') + *protected* assertNotFalse($condition, $message = '') -Asserts that a condition is not false. - * `param mixed` $condition +* `param mixed` $condition +* `param string` $message + +Asserts that a condition is not false. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L842) #### assertNotInstanceOf() - *protected* assertNotInstanceOf($expected, $actual, $message = '') + *protected* assertNotInstanceOf($expected, $actual, $message = '') -Asserts that a variable is not of a given type. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $expected +* `param string` $message + +Asserts that a variable is not of a given type. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L852) #### assertNotNull() - *protected* assertNotNull($actual, $message = '') + *protected* assertNotNull($actual, $message = '') -Asserts that a variable is not null. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is not null. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L862) #### assertNotRegExp() - *protected* assertNotRegExp($pattern, $string, $message = '') + *protected* assertNotRegExp($pattern, $string, $message = '') + + +* `param string` $pattern +* `param string` $string +* `param string` $message Asserts that a string does not match a given regular expression. @@ -1108,49 +1470,62 @@ Asserts that a string does not match a given regular expression. #### assertNotSame() - *protected* assertNotSame($expected, $actual, $message = '') + *protected* assertNotSame($expected, $actual, $message = '') -Asserts that two variables do not have the same type and value. - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that two variables do not have the same type and value. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L873) #### assertNotSameSize() - *protected* assertNotSameSize($expected, $actual, $message = '') + *protected* assertNotSameSize($expected, $actual, $message = '') -Assert that the size of two arrays (or `Countable` or `Traversable` objects) is not the same. - * `param Countable|iterable` $expected - * `param Countable|iterable` $actual +* `param Countable|iterable` $expected +* `param Countable|iterable` $actual +* `param string` $message + +Assert that the size of two arrays (or `Countable` or `Traversable` objects) is not the same. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L884) #### assertNotTrue() - *protected* assertNotTrue($condition, $message = '') + *protected* assertNotTrue($condition, $message = '') -Asserts that a condition is not true. - * `param mixed` $condition +* `param mixed` $condition +* `param string` $message + +Asserts that a condition is not true. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L894) #### assertNull() - *protected* assertNull($actual, $message = '') + *protected* assertNull($actual, $message = '') -Asserts that a variable is null. - * `param mixed` $actual +* `param mixed` $actual +* `param string` $message + +Asserts that a variable is null. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L904) #### assertObjectHasAttribute() - *protected* assertObjectHasAttribute($attributeName, $object, $message = '') + *protected* assertObjectHasAttribute($attributeName, $object, $message = '') + + +* `param string` $attributeName +* `param object` $object +* `param string` $message Asserts that an object has a specified attribute. @@ -1158,7 +1533,12 @@ Asserts that an object has a specified attribute. #### assertObjectNotHasAttribute() - *protected* assertObjectNotHasAttribute($attributeName, $object, $message = '') + *protected* assertObjectNotHasAttribute($attributeName, $object, $message = '') + + +* `param string` $attributeName +* `param object` $object +* `param string` $message Asserts that an object does not have a specified attribute. @@ -1166,7 +1546,12 @@ Asserts that an object does not have a specified attribute. #### assertRegExp() - *protected* assertRegExp($pattern, $string, $message = '') + *protected* assertRegExp($pattern, $string, $message = '') + + +* `param string` $pattern +* `param string` $string +* `param string` $message Asserts that a string matches a given regular expression. @@ -1174,41 +1559,60 @@ Asserts that a string matches a given regular expression. #### assertSame() - *protected* assertSame($expected, $actual, $message = '') + *protected* assertSame($expected, $actual, $message = '') -Asserts that two variables have the same type and value. - * `param mixed` $expected - * `param mixed` $actual +* `param mixed` $expected +* `param mixed` $actual +* `param string` $message + +Asserts that two variables have the same type and value. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L931) #### assertSameSize() - *protected* assertSameSize($expected, $actual, $message = '') + *protected* assertSameSize($expected, $actual, $message = '') -Assert that the size of two arrays (or `Countable` or `Traversable` objects) is the same. - * `param Countable|iterable` $expected - * `param Countable|iterable` $actual +* `param Countable|iterable` $expected +* `param Countable|iterable` $actual +* `param string` $message + +Assert that the size of two arrays (or `Countable` or `Traversable` objects) is the same. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L942) #### assertStringContainsString() - *protected* assertStringContainsString($needle, $haystack, $message = '') + *protected* assertStringContainsString($needle, $haystack, $message = '') + + +* `param string` $needle +* `param string` $haystack +* `param string` $message [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L947) #### assertStringContainsStringIgnoringCase() - *protected* assertStringContainsStringIgnoringCase($needle, $haystack, $message = '') + *protected* assertStringContainsStringIgnoringCase($needle, $haystack, $message = '') + + +* `param string` $needle +* `param string` $haystack +* `param string` $message [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L952) #### assertStringEndsNotWith() - *protected* assertStringEndsNotWith($suffix, $string, $message = '') + *protected* assertStringEndsNotWith($suffix, $string, $message = '') + + +* `param string` $suffix +* `param string` $string +* `param string` $message Asserts that a string ends not with a given suffix. @@ -1216,7 +1620,12 @@ Asserts that a string ends not with a given suffix. #### assertStringEndsWith() - *protected* assertStringEndsWith($suffix, $string, $message = '') + *protected* assertStringEndsWith($suffix, $string, $message = '') + + +* `param string` $suffix +* `param string` $string +* `param string` $message Asserts that a string ends with a given suffix. @@ -1224,7 +1633,12 @@ Asserts that a string ends with a given suffix. #### assertStringEqualsFile() - *protected* assertStringEqualsFile($expectedFile, $actualString, $message = '') + *protected* assertStringEqualsFile($expectedFile, $actualString, $message = '') + + +* `param string` $expectedFile +* `param string` $actualString +* `param string` $message Asserts that the contents of a string is equal to the contents of a file. @@ -1232,7 +1646,12 @@ Asserts that the contents of a string is equal to the contents of a file. #### assertStringEqualsFileCanonicalizing() - *protected* assertStringEqualsFileCanonicalizing($expectedFile, $actualString, $message = '') + *protected* assertStringEqualsFileCanonicalizing($expectedFile, $actualString, $message = '') + + +* `param string` $expectedFile +* `param string` $actualString +* `param string` $message Asserts that the contents of a string is equal to the contents of a file (canonicalizing). @@ -1240,7 +1659,12 @@ Asserts that the contents of a string is equal to the contents of a file (canoni #### assertStringEqualsFileIgnoringCase() - *protected* assertStringEqualsFileIgnoringCase($expectedFile, $actualString, $message = '') + *protected* assertStringEqualsFileIgnoringCase($expectedFile, $actualString, $message = '') + + +* `param string` $expectedFile +* `param string` $actualString +* `param string` $message Asserts that the contents of a string is equal to the contents of a file (ignoring case). @@ -1248,7 +1672,12 @@ Asserts that the contents of a string is equal to the contents of a file (ignori #### assertStringMatchesFormat() - *protected* assertStringMatchesFormat($format, $string, $message = '') + *protected* assertStringMatchesFormat($format, $string, $message = '') + + +* `param string` $format +* `param string` $string +* `param string` $message Asserts that a string matches a given format string. @@ -1256,7 +1685,12 @@ Asserts that a string matches a given format string. #### assertStringMatchesFormatFile() - *protected* assertStringMatchesFormatFile($formatFile, $string, $message = '') + *protected* assertStringMatchesFormatFile($formatFile, $string, $message = '') + + +* `param string` $formatFile +* `param string` $string +* `param string` $message Asserts that a string matches a given format file. @@ -1264,19 +1698,34 @@ Asserts that a string matches a given format file. #### assertStringNotContainsString() - *protected* assertStringNotContainsString($needle, $haystack, $message = '') + *protected* assertStringNotContainsString($needle, $haystack, $message = '') + + +* `param string` $needle +* `param string` $haystack +* `param string` $message [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L1013) #### assertStringNotContainsStringIgnoringCase() - *protected* assertStringNotContainsStringIgnoringCase($needle, $haystack, $message = '') + *protected* assertStringNotContainsStringIgnoringCase($needle, $haystack, $message = '') + + +* `param string` $needle +* `param string` $haystack +* `param string` $message [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L1018) #### assertStringNotEqualsFile() - *protected* assertStringNotEqualsFile($expectedFile, $actualString, $message = '') + *protected* assertStringNotEqualsFile($expectedFile, $actualString, $message = '') + + +* `param string` $expectedFile +* `param string` $actualString +* `param string` $message Asserts that the contents of a string is not equal to the contents of a file. @@ -1284,7 +1733,12 @@ Asserts that the contents of a string is not equal to the contents of a file. #### assertStringNotEqualsFileCanonicalizing() - *protected* assertStringNotEqualsFileCanonicalizing($expectedFile, $actualString, $message = '') + *protected* assertStringNotEqualsFileCanonicalizing($expectedFile, $actualString, $message = '') + + +* `param string` $expectedFile +* `param string` $actualString +* `param string` $message Asserts that the contents of a string is not equal to the contents of a file (canonicalizing). @@ -1292,7 +1746,12 @@ Asserts that the contents of a string is not equal to the contents of a file (ca #### assertStringNotEqualsFileIgnoringCase() - *protected* assertStringNotEqualsFileIgnoringCase($expectedFile, $actualString, $message = '') + *protected* assertStringNotEqualsFileIgnoringCase($expectedFile, $actualString, $message = '') + + +* `param string` $expectedFile +* `param string` $actualString +* `param string` $message Asserts that the contents of a string is not equal to the contents of a file (ignoring case). @@ -1300,7 +1759,12 @@ Asserts that the contents of a string is not equal to the contents of a file (ig #### assertStringNotMatchesFormat() - *protected* assertStringNotMatchesFormat($format, $string, $message = '') + *protected* assertStringNotMatchesFormat($format, $string, $message = '') + + +* `param string` $format +* `param string` $string +* `param string` $message Asserts that a string does not match a given format string. @@ -1308,7 +1772,12 @@ Asserts that a string does not match a given format string. #### assertStringNotMatchesFormatFile() - *protected* assertStringNotMatchesFormatFile($formatFile, $string, $message = '') + *protected* assertStringNotMatchesFormatFile($formatFile, $string, $message = '') + + +* `param string` $formatFile +* `param string` $string +* `param string` $message Asserts that a string does not match a given format string. @@ -1316,7 +1785,12 @@ Asserts that a string does not match a given format string. #### assertStringStartsNotWith() - *protected* assertStringStartsNotWith($prefix, $string, $message = '') + *protected* assertStringStartsNotWith($prefix, $string, $message = '') + + +* `param string` $prefix +* `param string` $string +* `param string` $message Asserts that a string starts not with a given prefix. @@ -1324,7 +1798,12 @@ Asserts that a string starts not with a given prefix. #### assertStringStartsWith() - *protected* assertStringStartsWith($prefix, $string, $message = '') + *protected* assertStringStartsWith($prefix, $string, $message = '') + + +* `param string` $prefix +* `param string` $string +* `param string` $message Asserts that a string starts with a given prefix. @@ -1332,37 +1811,50 @@ Asserts that a string starts with a given prefix. #### assertThat() - *protected* assertThat($value, $constraint, $message = '') + *protected* assertThat($value, $constraint, $message = '') -Evaluates a PHPUnit\Framework\Constraint matcher object. - * `param mixed` $value +* `param mixed` $value +* `param \PHPUnit\Framework\Constraint\Constraint` $constraint +* `param string` $message + +Evaluates a PHPUnit\Framework\Constraint matcher object. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L1084) #### assertThatItsNot() - *protected* assertThatItsNot($value, $constraint, $message = '') + *protected* assertThatItsNot($value, $constraint, $message = '') -Evaluates a PHPUnit\Framework\Constraint matcher object. - * `param mixed` $value +* `param mixed` $value +* `param \PHPUnit\Framework\Constraint\Constraint` $constraint +* `param string` $message + +Evaluates a PHPUnit\Framework\Constraint matcher object. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L99) #### assertTrue() - *protected* assertTrue($condition, $message = '') + *protected* assertTrue($condition, $message = '') -Asserts that a condition is true. - * `param mixed` $condition +* `param mixed` $condition +* `param string` $message + +Asserts that a condition is true. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L1094) #### assertXmlFileEqualsXmlFile() - *protected* assertXmlFileEqualsXmlFile($expectedFile, $actualFile, $message = '') + *protected* assertXmlFileEqualsXmlFile($expectedFile, $actualFile, $message = '') + + +* `param string` $expectedFile +* `param string` $actualFile +* `param string` $message Asserts that two XML files are equal. @@ -1370,7 +1862,12 @@ Asserts that two XML files are equal. #### assertXmlFileNotEqualsXmlFile() - *protected* assertXmlFileNotEqualsXmlFile($expectedFile, $actualFile, $message = '') + *protected* assertXmlFileNotEqualsXmlFile($expectedFile, $actualFile, $message = '') + + +* `param string` $expectedFile +* `param string` $actualFile +* `param string` $message Asserts that two XML files are not equal. @@ -1378,49 +1875,63 @@ Asserts that two XML files are not equal. #### assertXmlStringEqualsXmlFile() - *protected* assertXmlStringEqualsXmlFile($expectedFile, $actualXml, $message = '') + *protected* assertXmlStringEqualsXmlFile($expectedFile, $actualXml, $message = '') -Asserts that two XML documents are equal. - * `param DOMDocument|string` $actualXml +* `param DOMDocument|string` $actualXml +* `param string` $expectedFile +* `param string` $message + +Asserts that two XML documents are equal. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L1120) #### assertXmlStringEqualsXmlString() - *protected* assertXmlStringEqualsXmlString($expectedXml, $actualXml, $message = '') + *protected* assertXmlStringEqualsXmlString($expectedXml, $actualXml, $message = '') -Asserts that two XML documents are equal. - * `param DOMDocument|string` $expectedXml - * `param DOMDocument|string` $actualXml +* `param DOMDocument|string` $expectedXml +* `param DOMDocument|string` $actualXml +* `param string` $message + +Asserts that two XML documents are equal. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L1131) #### assertXmlStringNotEqualsXmlFile() - *protected* assertXmlStringNotEqualsXmlFile($expectedFile, $actualXml, $message = '') + *protected* assertXmlStringNotEqualsXmlFile($expectedFile, $actualXml, $message = '') -Asserts that two XML documents are not equal. - * `param DOMDocument|string` $actualXml +* `param DOMDocument|string` $actualXml +* `param string` $expectedFile +* `param string` $message + +Asserts that two XML documents are not equal. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L1141) #### assertXmlStringNotEqualsXmlString() - *protected* assertXmlStringNotEqualsXmlString($expectedXml, $actualXml, $message = '') + *protected* assertXmlStringNotEqualsXmlString($expectedXml, $actualXml, $message = '') -Asserts that two XML documents are not equal. - * `param DOMDocument|string` $expectedXml - * `param DOMDocument|string` $actualXml +* `param DOMDocument|string` $expectedXml +* `param DOMDocument|string` $actualXml +* `param string` $message + +Asserts that two XML documents are not equal. [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L1152) #### debug() - *protected* debug($message) + *protected* debug($message) + + +* `param mixed` $message +* `return void` Print debug message to the screen. @@ -1428,7 +1939,12 @@ Print debug message to the screen. #### debugSection() - *protected* debugSection($title, $message) + *protected* debugSection($title, $message) + + +* `param string` $title +* `param mixed` $message +* `return void` Print debug message with a title @@ -1436,7 +1952,10 @@ Print debug message with a title #### fail() - *protected* fail($message = '') + *protected* fail($message = '') + + +* `param string` $message Fails a test with the given message. @@ -1444,7 +1963,12 @@ Fails a test with the given message. #### getModule() - *protected* getModule($name) + *protected* getModule($name) + + +* `param string` $name +* `throws ModuleException` +* `return \Codeception\Module` Get another module by its name: @@ -1454,13 +1978,15 @@ Get another module by its name: $this->getModule('WebDriver')->_findElements('.items'); {% endhighlight %} - * `throws` ModuleException [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L287) #### getModules() - *protected* getModules() + *protected* getModules() + + +* `return array` Get all enabled modules @@ -1468,7 +1994,11 @@ Get all enabled modules #### hasModule() - *protected* hasModule($name) + *protected* hasModule($name) + + +* `param string` $name +* `return bool` Checks that module is enabled. @@ -1476,7 +2006,10 @@ Checks that module is enabled. #### markTestIncomplete() - *protected* markTestIncomplete($message = '') + *protected* markTestIncomplete($message = '') + + +* `param string` $message Mark the test as incomplete. @@ -1484,7 +2017,10 @@ Mark the test as incomplete. #### markTestSkipped() - *protected* markTestSkipped($message = '') + *protected* markTestSkipped($message = '') + + +* `param string` $message Mark the test as skipped. @@ -1492,7 +2028,8 @@ Mark the test as skipped. #### onReconfigure() - *protected* onReconfigure() + *protected* onReconfigure() + HOOK to be executed when config changes with `_reconfigure`. @@ -1500,13 +2037,22 @@ HOOK to be executed when config changes with `_reconfigure`. #### scalarizeArray() - *protected* scalarizeArray(array $array) + *protected* scalarizeArray(array $array) + + +* `param array` $array +* `return array` [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L312) #### shortenMessage() - *protected* shortenMessage($message, $chars = 150) + *protected* shortenMessage($message, $chars = 150) + + +* `param string` $message +* `param int` $chars +* `return string` Short text message to an amount of chars @@ -1514,10 +2060,13 @@ Short text message to an amount of chars #### validateConfig() - *protected* validateConfig() + *protected* validateConfig() + + +* `throws ModuleConfigException|ModuleException` +* `return void` Validates current config for required fields and required packages. - * `throws` ModuleConfigException|ModuleException [See source](https://github.com/Codeception/Codeception/blob/5.0/src/Codeception/Module.php#L132) diff --git a/docs/reference/Stub.md b/docs/reference/Stub.md index 24d934977..6f5a674da 100644 --- a/docs/reference/Stub.md +++ b/docs/reference/Stub.md @@ -8,8 +8,19 @@ title: Stub - Codeception - Documentation -#### *public static* make($class, array $params = array ( ), $testCase = null) +#### *public static* make($class, array $params = array ( ), $testCase = null) + +* `template` RealInstanceType of object +* `param class-string|RealInstanceType|callable():` $ class-string $class - A class to be mocked +* `param array` $params - properties and methods to set +* `param bool|PHPUnitTestCase` $testCase +* `param ` $class +* `throws RuntimeException` when class does not exist +* `throws Exception` +* `return PHPUnitMockObject&RealInstanceType` - mock + Instantiates a class without executing a constructor. + Properties and methods can be set as a second parameter. Even protected and private properties can be set. @@ -52,23 +63,29 @@ Stub::make('User', [ {% endhighlight %} - * template RealInstanceType of object - * `param class-string|RealInstanceType|callable(): class-string` $class - A class to be mocked - * `param array` $params - properties and methods to set - * `param bool|PHPUnitTestCase` $testCase +#### *public static* factory($class, $num = 1, array $params = array ( )) - * return PHPUnitMockObject&RealInstanceType - mock - * throws RuntimeException when class does not exist - * throws Exception +* `param mixed` $class +* `param int` $num +* `param array` $params +* `throws Exception` +* `return array` -#### *public static* factory($class, $num = 1, array $params = array ( )) Creates $num instances of class through `Stub::make`. - * `param mixed` $class - * throws Exception +#### *public static* makeEmptyExcept($class, $method, array $params = array ( ), $testCase = null) + +* `template` RealInstanceType of object +* `param class-string|RealInstanceType|callable():` $ class-string $class - A class to be mocked +* `param string` $method +* `param array` $params +* `param bool|PHPUnitTestCase` $testCase +* `param ` $class +* `throws Exception` +* `return PHPUnitMockObject&RealInstanceType` -#### *public static* makeEmptyExcept($class, $method, array $params = array ( ), $testCase = null) Instantiates class having all methods replaced with dummies except one. + Constructor is not triggered. Properties and methods can be replaced. Even protected and private properties can be set. @@ -111,17 +128,19 @@ Stub::makeEmptyExcept('User', 'validate', [ ], $this); {% endhighlight %} - * template RealInstanceType of object - * `param class-string|RealInstanceType|callable(): class-string` $class - A class to be mocked - * `param string` $method - * `param array` $params - * `param bool|PHPUnitTestCase` $testCase - * return PHPUnitMockObject&RealInstanceType - * throws Exception +#### *public static* makeEmpty($class, array $params = array ( ), $testCase = null) + +* `template` RealInstanceType of object +* `param class-string|RealInstanceType|callable():` $ class-string $class - A class to be mocked +* `param bool|PHPUnitTestCase` $testCase +* `param ` $class +* `param array` $params +* `throws Exception` +* `return PHPUnitMockObject&RealInstanceType` -#### *public static* makeEmpty($class, array $params = array ( ), $testCase = null) Instantiates class having all methods replaced with dummies. + Constructor is not triggered. Properties and methods can be set as a second parameter. Even protected and private properties can be set. @@ -165,23 +184,28 @@ Stub::makeEmpty('User', [ {% endhighlight %} - * template RealInstanceType of object - * `param class-string|RealInstanceType|callable(): class-string` $class - A class to be mocked - * `param bool|PHPUnitTestCase` $testCase +#### *public static* copy($obj, array $params = array ( )) - * return PHPUnitMockObject&RealInstanceType - * throws Exception +* `param ` $obj +* `param array` $params +* `throws Exception` +* `return mixed` -#### *public static* copy($obj, array $params = array ( )) Clones an object and redefines it's properties (even protected and private) - * `param` $obj - * `param array` $params - * return mixed - * throws Exception +#### *public static* construct($class, array $constructorParams = array ( ), array $params = array ( ), $testCase = null) + +* `template` RealInstanceType of object +* `param class-string|RealInstanceType|callable():` $ class-string $class - A class to be mocked +* `param bool|PHPUnitTestCase` $testCase +* `param ` $class +* `param array` $constructorParams +* `param array` $params +* `throws Exception` +* `return PHPUnitMockObject&RealInstanceType` -#### *public static* construct($class, array $constructorParams = array ( ), array $params = array ( ), $testCase = null) Instantiates a class instance by running constructor. + Parameters for constructor passed as second argument Properties and methods can be set in third argument. Even protected and private properties can be set. @@ -225,15 +249,19 @@ Stub::construct('User', [], [ {% endhighlight %} - * template RealInstanceType of object - * `param class-string|RealInstanceType|callable(): class-string` $class - A class to be mocked - * `param bool|PHPUnitTestCase` $testCase +#### *public static* constructEmpty($class, array $constructorParams = array ( ), array $params = array ( ), $testCase = null) - * return PHPUnitMockObject&RealInstanceType - * throws Exception +* `template` RealInstanceType of object +* `param class-string|RealInstanceType|callable():` $ class-string $class - A class to be mocked +* `param array` $constructorParams +* `param array` $params +* `param bool|PHPUnitTestCase` $testCase +* `param ` $class +* `throws ReflectionException` +* `return PHPUnitMockObject&RealInstanceType` -#### *public static* constructEmpty($class, array $constructorParams = array ( ), array $params = array ( ), $testCase = null) Instantiates a class instance by running constructor with all methods replaced with dummies. + Parameters for constructor passed as second argument Properties and methods can be set in third argument. Even protected and private properties can be set. @@ -277,17 +305,20 @@ Stub::constructEmpty('User', [], [ {% endhighlight %} - * template RealInstanceType of object - * `param class-string|RealInstanceType|callable(): class-string` $class - A class to be mocked - * `param array` $constructorParams - * `param array` $params - * `param bool|PHPUnitTestCase` $testCase +#### *public static* constructEmptyExcept($class, $method, array $constructorParams = array ( ), array $params = array ( ), $testCase = null) - * return PHPUnitMockObject&RealInstanceType - * throws ReflectionException +* `template` RealInstanceType of object +* `param class-string|RealInstanceType|callable():` $ class-string $class - A class to be mocked +* `param bool|PHPUnitTestCase` $testCase +* `param ` $class +* `param string` $method +* `param array` $constructorParams +* `param array` $params +* `throws ReflectionException` +* `return PHPUnitMockObject&RealInstanceType` -#### *public static* constructEmptyExcept($class, $method, array $constructorParams = array ( ), array $params = array ( ), $testCase = null) Instantiates a class instance by running constructor with all methods replaced with dummies, except one. + Parameters for constructor passed as second argument Properties and methods can be set in third argument. Even protected and private properties can be set. @@ -331,22 +362,19 @@ Stub::constructEmptyExcept('User', 'save', [], [ {% endhighlight %} - * template RealInstanceType of object - * `param class-string|RealInstanceType|callable(): class-string` $class - A class to be mocked - * `param bool|PHPUnitTestCase` $testCase +#### *public static* update($mock, array $params) - * return PHPUnitMockObject&RealInstanceType - * throws ReflectionException +* `param PHPUnitMockObject|object` $mock +* `param array` $params +* `throws LogicException` +* `return object` -#### *public static* update($mock, array $params) Replaces properties of current stub - * `param PHPUnitMockObject|object` $mock - * `param array` $params - * return object -throws LogicException +#### *public static* consecutive() + +* `return \Codeception\Stub\ConsecutiveMap` -#### *public static* consecutive() Stubbing a method call to return a list of values in the specified order. {% highlight php %} diff --git a/docs/reference/XmlBuilder.md b/docs/reference/XmlBuilder.md index a3e52cc64..a0f463ab4 100644 --- a/docs/reference/XmlBuilder.md +++ b/docs/reference/XmlBuilder.md @@ -77,13 +77,19 @@ Export: #### __construct() - *public* __construct() + *public* __construct() + + [See source](https://github.com/Codeception/lib-xml/blob/master/src/Codeception/Util/XmlBuilder.php#L80) #### __get() - *public* __get($tag) + *public* __get($tag) + + +* `param string` $tag +* `return \Codeception\Util\XmlBuilder` Appends child node @@ -91,13 +97,21 @@ Appends child node #### __toString() - *public* __toString() + *public* __toString() + + +* `return string` [See source](https://github.com/Codeception/lib-xml/blob/master/src/Codeception/Util/XmlBuilder.php#L152) #### attr() - *public* attr($attr, $val) + *public* attr($attr, $val) + + +* `param string` $attr +* `param string` $val +* `return \Codeception\Util\XmlBuilder` Sets attribute for current node @@ -105,13 +119,19 @@ Sets attribute for current node #### getDom() - *public* getDom() + *public* getDom() + + +* `return \DOMDocument` [See source](https://github.com/Codeception/lib-xml/blob/master/src/Codeception/Util/XmlBuilder.php#L162) #### parent() - *public* parent() + *public* parent() + + +* `return \Codeception\Util\XmlBuilder` Traverses to parent @@ -119,16 +139,24 @@ Traverses to parent #### parents() - *public* parents($tagName) + *public* parents($tagName) + + +* `param string` $tagName +* `throws Exception` +* `return \Codeception\Util\XmlBuilder` Traverses to parent with $tagName - * `throws` Exception [See source](https://github.com/Codeception/lib-xml/blob/master/src/Codeception/Util/XmlBuilder.php#L132) #### val() - *public* val($val) + *public* val($val) + + +* `param string` $val +* `return \Codeception\Util\XmlBuilder` [See source](https://github.com/Codeception/lib-xml/blob/master/src/Codeception/Util/XmlBuilder.php#L97)