diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 0bc45d58c..fc8539063 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -33,7 +33,7 @@ jobs:
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
- php-version: 8.1
+ php-version: 8.2
- name: Install dependencies
run: composer install --prefer-dist --no-progress
diff --git a/RoboFile.php b/RoboFile.php
index 8382cd5c5..bca066714 100644
--- a/RoboFile.php
+++ b/RoboFile.php
@@ -10,8 +10,8 @@ class RoboFile extends \Robo\Tasks
use DocumentationHelpers;
const REPO_BLOB_URL = 'https://github.com/Codeception/Codeception/blob';
- const BRANCH_4x = '4.2';
- const BRANCH_5x = '5.1';
+ const BRANCH_5x = '5.3';
+ const BRANCH_MAIN = 'main';
function post()
{
@@ -263,7 +263,7 @@ public function buildDocsExtensions()
->prepend("# Official Extensions\n")
->processClassSignature(function (ReflectionClass $r, $text) {
$name = $r->getShortName();
- return "## $name\n\n[See Source](" . self::REPO_BLOB_URL . "/" . self::BRANCH_5x . "/ext/$name.php)";
+ return "## $name\n\n[See Source](" . self::REPO_BLOB_URL . "/" . self::BRANCH_MAIN . "/ext/$name.php)";
})
->filterMethods(function (ReflectionMethod $r) {
return false;
@@ -277,7 +277,7 @@ public function buildDocsExtensions()
protected function documentApiClass($file, $className, $all = false, $repositoryName = null)
{
if ($repositoryName === null) {
- $repositoryUrl = self::REPO_BLOB_URL . "/" . self::BRANCH_5x;
+ $repositoryUrl = self::REPO_BLOB_URL . "/" . self::BRANCH_MAIN;
} else {
$repositoryUrl = 'https://github.com/Codeception/' . $repositoryName . '/blob/master';
}
@@ -412,102 +412,34 @@ private function postProcessFile($pageName, $documentationFile)
file_put_contents($documentationFile, $contents);
}
- public function buildPhar80()
+ public function buildPhar82()
{
- $version = self::BRANCH_5x . '.' . date('Ymd');
- $releaseDir = "releases/$version";
- $this->stopOnFail();
-
- $this->taskFilesystemStack()->mkdir('build/80')->run();
- $this->setCodeceptionVersionTo('^' . self::BRANCH_5x);
- $this->setPlatformVersionTo('8.0.2');
- $buildFile = 'build/80/codecept.phar';
- $this->buildPhar($buildFile);
- $this->updateVersionFile($buildFile, 'php80/codecept.version');
- $versionedFile = "$releaseDir/codecept.phar";
- $this->taskFilesystemStack()
- ->stopOnFail()
- ->mkdir($releaseDir)
- ->copy($buildFile, $versionedFile)
- ->remove('php80/codecept.phar')
- ->symlink("../$versionedFile", 'php80/codecept.phar')
- ->run();
- }
+ $ignoredPlatformReqs = array(
+ 'ext-apcu',
+ 'ext-mongodb',
+ 'ext-phalcon',
+ );
- public function buildPhar72()
- {
- $version = self::BRANCH_4x . '.' . date('Ymd');
+ $version = self::BRANCH_5x . '.' . date('Ymd');
$releaseDir = "releases/$version";
$this->stopOnFail();
-
- $this->taskFilesystemStack()->mkdir('build/72')->run();
- $this->setCodeceptionVersionTo('^4.1');
- $this->setPlatformVersionTo('7.2.0');
- $this->requireHoaConsole();
- $buildFile = 'build/72/codecept.phar';
+ $this->taskFilesystemStack()->mkdir('build/82')->run();
+ $this->setCodeceptionVersionTo('^' . self::BRANCH_5x, $ignoredPlatformReqs);
+ $this->setPlatformVersionTo('8.2.0', $ignoredPlatformReqs);
+ $buildFile = 'build/82/codecept.phar';
$this->buildPhar($buildFile);
- $this->updateVersionFile($buildFile, 'codecept.version');
+ $this->updateVersionFile($buildFile, 'php82/codecept.version');
$versionedFile = "$releaseDir/codecept.phar";
$this->taskFilesystemStack()
->stopOnFail()
->mkdir($releaseDir)
->copy($buildFile, $versionedFile)
- ->remove('codecept.phar')
- ->symlink($versionedFile, 'codecept.phar')
+ ->remove('php82/codecept.phar')
+ ->symlink("../$versionedFile", 'php82/codecept.phar')
->run();
}
- public function buildPhar56()
- {
- $version = self::BRANCH_4x . '.' . date('Ymd');
- $releaseDir = "releases/$version";
- $this->stopOnFail();
-
- $this->taskFilesystemStack()->mkdir('build/56')->run();
- $this->setCodeceptionVersionTo('^4.1');
- $this->setPlatformVersionTo('5.6.4');
- $this->requireHoaConsole();
- //filenames must be different, because Phar refuses to build second file with the same name
- $buildFile = 'build/56/codecept.phar';
- $this->buildPhar($buildFile);
- $this->updateVersionFile($buildFile, 'php56/codecept.version');
- $versionedFile = "$releaseDir/php56/codecept.phar";
- $this->taskFilesystemStack()
- ->stopOnFail()
- ->mkdir("$releaseDir/php56")
- ->copy($buildFile, $versionedFile)
- ->remove('php56/codecept.phar')
- ->symlink("../$versionedFile", 'php56/codecept.phar')
- ->run();
- }
-
- private function requireHoaConsole(): void
- {
- $this->taskComposerRequire()
- ->dependency('hoa/console')
- ->workingDir('package')
- ->run();
- }
-
- public function release()
- {
- $version = self::BRANCH_4x . '.' . date('Ymd');
- $releaseDir = "releases/$version";
- $this->updateBuildsPage();
-
- $this->taskGitStack()
- ->stopOnFail()
- ->checkout('-- package/composer.json')
- ->add('builds.markdown')
- ->add('codecept.phar')
- ->add('codecept.version')
- ->add('php56/codecept.phar')
- ->add('php56/codecept.version')
- ->add($releaseDir)
- ->run();
- }
-
- public function release80()
+ public function release82()
{
$version = self::BRANCH_5x . '.' . date('Ymd');
$releaseDir = "releases/$version";
@@ -517,23 +449,30 @@ public function release80()
->stopOnFail()
->checkout('-- package/composer.json')
->add('builds.markdown')
- ->add('php80/codecept.phar')
- ->add('php80/codecept.version')
+ ->add('php82/codecept.phar')
+ ->add('php82/codecept.version')
->add($releaseDir)
->run();
}
- private function setPlatformVersionTo($version)
+ private function setPlatformVersionTo($version, $ignoredPlatformReqs = array())
{
$this->taskComposerConfig()->workingDir('package')->set('platform.php', $version)->run();
- $this->taskComposerUpdate()->preferDist()->optimizeAutoloader()->workingDir('package')->run();
+ $composerUpdate = $this->taskComposerUpdate();
+ foreach ($ignoredPlatformReqs as $ignoredPlatformReq) {
+ $composerUpdate->option('--ignore-platform-req', $ignoredPlatformReq);
+ }
+ $composerUpdate->preferDist()->optimizeAutoloader()->workingDir('package')->run();
}
- private function setCodeceptionVersionTo($version)
+ private function setCodeceptionVersionTo($version, $ignoredPlatformReqs = array())
{
- $this->taskComposerRequire()
- ->dependency('codeception/codeception', $version)
- ->workingDir('package')
+ $composerRequire = $this->taskComposerRequire()
+ ->dependency('codeception/codeception', $version);
+ foreach ($ignoredPlatformReqs as $ignoredPlatformReq) {
+ $composerRequire->option('--ignore-platform-req', $ignoredPlatformReq);
+ }
+ $composerRequire->workingDir('package')
->run();
}
@@ -638,7 +577,7 @@ public function processChangelog()
$repo = $release['repo'] ?? 'Codeception';
$changelog .= sprintf("\n\n### %s %s: %s\n\n", $repo, $release['tag_name'], $release['name']);
- $changelog .= sprintf("Released by [ %s](%s) on %s",
+ $changelog .= sprintf('Released by [{:height="16" width="16"} %s](%s) on %s',
$release['author']['avatar_url'] . '&s=16',
$release['author']['login'],
$release['author']['html_url'],
@@ -695,8 +634,10 @@ public function updateBuildsPage()
$releaseFile->line("*Requires: PHP 5.4 and higher + CURL*\n");
} elseif ($major < 5) {
$releaseFile->line("*Requires: PHP 5.6 and higher + CURL*\n");
- } else {
+ } elseif ($minor < 3) {
$releaseFile->line("*Requires: PHP 8.0 and higher + CURL*\n");
+ } else {
+ $releaseFile->line("*Requires: PHP 8.2 and higher + CURL*\n");
}
$releaseFile->line("* **[Download Latest $branch Release]($downloadUrl)**");
}
diff --git a/_data/modules.yml b/_data/modules.yml
index 6b8b770e3..d36e1192f 100644
--- a/_data/modules.yml
+++ b/_data/modules.yml
@@ -15,6 +15,10 @@
link: https://github.com/walterwhites/Appium-codeception-module
description: Easy Appium integration, iOS Automation
+- name: Axeception
+ link: https://github.com/flowdgmbh/codeception-axeception
+ description: Run axe-core acceptance tests in codeception
+
- name: BrowserMob
link: https://github.com/edno/codeception-browsermob
description: Codeception module for BrowserMob Proxy.
@@ -87,10 +91,14 @@
description: Codeception module to test email using MailCare.io (Free, Open Source or paid services).
color: "#e65722"
+- name: Mailpit
+ image: ../images/mailpit.svg
+ link: https://github.com/koehnlein/codeception-email-mailpit
+ description: Mailpit is a standalone local SMTP server to test email deliveries. The Codeception module provides assertions such as `$I->haveUnreadEmails();` or `$I->seeInOpenedEmailHtmlBody()`.
+
- name: MailCatcher
link: https://github.com/captbaritone/codeception-mailcatcher-module
description: MailCatcher is a standalone software which can be configured to catch *any* email sent by your development server, and display it on a webpage. The MailCatcher Module allows you to test the contents of those emails in an acceptance test.
- color: "#FFF5C4"
- name: MailSMTP
link: https://github.com/AhmedSamy/codeception-smtp-mail
@@ -161,3 +169,7 @@
- name: Yandex
link: https://github.com/portrino/codeception-yandex-module
description: Validation of structured data via yandex API.
+
+- name: Grpc
+ link: https://github.com/MercerMorning/codeception-grpc-module
+ description: Validation of grpc server.
diff --git a/_includes/extensions.md b/_includes/extensions.md
index 742c0b9a2..0552d693e 100644
--- a/_includes/extensions.md
+++ b/_includes/extensions.md
@@ -2,10 +2,10 @@
## DotReporter
-[See Source](https://github.com/Codeception/Codeception/blob/5.1/ext/DotReporter.php)
+[See Source](https://github.com/Codeception/Codeception/blob/main/ext/DotReporter.php)
DotReporter provides less verbose output for test execution.
-Like PHPUnit printer it prints dots "." for successful testes and "F" for failures.
+Like PHPUnit printer it prints dots "." for successful tests and "F" for failures.

@@ -38,7 +38,7 @@ Use this extension as an example for building custom reporters.
## Logger
-[See Source](https://github.com/Codeception/Codeception/blob/5.1/ext/Logger.php)
+[See Source](https://github.com/Codeception/Codeception/blob/main/ext/Logger.php)
Log suites/tests/steps using Monolog library.
Monolog should be installed additionally by Composer.
@@ -66,16 +66,16 @@ extensions:
## Recorder
-[See Source](https://github.com/Codeception/Codeception/blob/5.1/ext/Recorder.php)
+[See Source](https://github.com/Codeception/Codeception/blob/main/ext/Recorder.php)
-Saves a screenshot of each step in acceptance tests and shows them as a slideshow on one HTML page (here's an [example](https://codeception.com/images/recorder.gif))
-Activated only for suites with WebDriver module enabled.
+Saves a screenshot of each step in acceptance tests and shows them as a slideshow on one HTML page (here's an [example](https://codeception.com/images/recorder.gif)).
+Works only for suites with WebDriver module enabled.
The screenshots are saved to `tests/_output/record_*` directories, open `index.html` to see them as a slideshow.
#### Installation
-Add this to the list of enabled extensions in `codeception.yml` or `acceptance.suite.yml`:
+Add this to the list of enabled extensions in `codeception.yml` or `Acceptance.suite.yml`:
``` yaml
extensions:
@@ -106,7 +106,7 @@ extensions:
```
#### Skipping recording of steps with annotations
-It is also possible to skip recording of steps for specified tests by using the @skipRecording annotation.
+It is also possible to skip recording of steps for specified tests by using the `@skipRecording` annotation.
```php
/**
@@ -122,10 +122,9 @@ public function testLogin(AcceptanceTester $I)
-
## RunBefore
-[See Source](https://github.com/Codeception/Codeception/blob/5.1/ext/RunBefore.php)
+[See Source](https://github.com/Codeception/Codeception/blob/main/ext/RunBefore.php)
Extension for execution of some processes before running tests.
@@ -156,9 +155,9 @@ HINT: you can use different configurations per environment.
## RunFailed
-[See Source](https://github.com/Codeception/Codeception/blob/5.1/ext/RunFailed.php)
+[See Source](https://github.com/Codeception/Codeception/blob/main/ext/RunFailed.php)
-Saves failed tests into tests/_output/failed in order to rerun failed tests.
+Saves failed tests into `tests/_output/failed` in order to rerun failed tests.
To rerun failed tests just run the `failed` group:
@@ -170,9 +169,9 @@ To change failed group name add:
```
--override "extensions: config: Codeception\Extension\RunFailed: fail-group: another_group1"
```
-Remember: if you run tests and they generated custom-named fail group, to run this group, you should add override too
+Remember: If you run tests and they generated custom-named fail group, to run this group, you should add override too
-Starting from Codeception 2.1 **this extension is enabled by default**.
+**This extension is enabled by default.**
``` yaml
extensions:
@@ -185,15 +184,16 @@ On each execution failed tests are logged and saved into `tests/_output/failed`
## RunProcess
-[See Source](https://github.com/Codeception/Codeception/blob/5.1/ext/RunProcess.php)
+[See Source](https://github.com/Codeception/Codeception/blob/main/ext/RunProcess.php)
Extension to start and stop processes per suite.
-Can be used to start/stop selenium server, chromedriver, mailcatcher, etc.
+Can be used to start/stop selenium server, chromedriver, etc.
+Each command is executed only once, at the beginning of the test suite. To execute a command before each test, see [Before/After Attributes](https://codeception.com/docs/AdvancedUsage#BeforeAfter-Attributes).
-Can be configured in suite config:
+Can be enabled in suite config:
```yaml
-# acceptance.suite.yml
+# Acceptance.suite.yml
extensions:
enabled:
- Codeception\Extension\RunProcess:
@@ -203,8 +203,7 @@ extensions:
Multiple parameters can be passed as array:
```yaml
-# acceptance.suite.yml
-
+# Acceptance.suite.yml
extensions:
enabled:
- Codeception\Extension\RunProcess:
@@ -214,28 +213,33 @@ extensions:
In the end of a suite all launched processes will be stopped.
-To wait for the process to be launched use `sleep` option.
-In this case you need configuration to be specified as object:
+To wait for the process to be launched use the `sleep` option. In this case you need configuration to be specified as object:
```yaml
extensions:
enabled:
- Codeception\Extension\RunProcess:
- 0: java -jar ~/selenium-server.jar
- 1: mailcatcher
- sleep: 5 # wait 5 seconds for processes to boot
+ 0: php -S 127.0.0.1:8000 -t tests/data/app
+ 1: java -jar ~/selenium-server.jar
+ sleep: 5 # wait 5 seconds for the processes to boot
```
-HINT: you can use different configurations per environment.
+HINT: You can use different configurations per environment.
## SimpleReporter
-[See Source](https://github.com/Codeception/Codeception/blob/5.1/ext/SimpleReporter.php)
+[See Source](https://github.com/Codeception/Codeception/blob/main/ext/SimpleReporter.php)
This extension demonstrates how you can implement console output of your own.
Recommended to be used for development purposes only.
+## SuiteInitSubscriberTrait
+
+[See Source](https://github.com/Codeception/Codeception/blob/main/ext/SuiteInitSubscriberTrait.php)
+
+
+
diff --git a/_layouts/bootstrap.html b/_layouts/bootstrap.html
index 4b62edd6b..299f8ffea 100644
--- a/_layouts/bootstrap.html
+++ b/_layouts/bootstrap.html
@@ -90,7 +90,7 @@
create quest on StackOverflow (and send link to IRC chat, that will speed up things).
diff --git a/docs/4.x/AcceptanceTests.md b/docs/4.x/AcceptanceTests.md
index 5bc8f8d31..0a100510f 100644
--- a/docs/4.x/AcceptanceTests.md
+++ b/docs/4.x/AcceptanceTests.md
@@ -244,7 +244,7 @@ you can pass instance `\Codeception\Step\Argument\PasswordArgument` with the dat
{% highlight php %}
amOnPage('/form/password_argument');
$I->fillField('password', new PasswordArgument('thisissecret'));
diff --git a/docs/4.x/Customization.md b/docs/4.x/Customization.md
index 287199276..998908dda 100644
--- a/docs/4.x/Customization.md
+++ b/docs/4.x/Customization.md
@@ -158,7 +158,7 @@ The extension class itself is inherited from `Codeception\Extension`:
{% highlight php %}
Improve this guide
diff --git a/docs/AcceptanceTests.md b/docs/AcceptanceTests.md
index 67cc3f682..6d51b81d9 100644
--- a/docs/AcceptanceTests.md
+++ b/docs/AcceptanceTests.md
@@ -57,7 +57,7 @@ Common PhpBrowser drawbacks:
We need to specify the `url` parameter in the acceptance suite config:
```yaml
-# acceptance.suite.yml
+# Acceptance.suite.yml
actor: AcceptanceTester
modules:
enabled:
@@ -68,10 +68,10 @@ modules:
We should start by creating a test with the next command:
```
-php vendor/bin/codecept g:cest acceptance Signin
+php vendor/bin/codecept g:cest Acceptance Signin
```
-It will be placed into `tests/acceptance` directory.
+It will be placed into `tests/Acceptance` directory.
```php
class SigninCest
@@ -209,7 +209,7 @@ If you need to fill in sensitive data (like passwords) and hide it in logs,
you can pass instance `\Codeception\Step\Argument\PasswordArgument` with the data which needs to be hidden.
```php
-use \Codeception\Step\Argument\PasswordArgument;
+use Codeception\Step\Argument\PasswordArgument;
$I->amOnPage('/form/password_argument');
$I->fillField('password', new PasswordArgument('thisissecret'));
@@ -268,10 +268,10 @@ Each failed assertion will be shown in the test results, but it won't stop the t
Conditional assertions are disabled in bootstrap setup. To enable them you should add corresponding step decorators to suite config:
-> If you started project as `codecept init acceptance` they should be already enabled in config
+> If you started project as `codecept init Acceptance` they should be already enabled in config
```yaml
-# in acceptance.suite.yml
+# in Acceptance.suite.yml
# or in codeception.yml inside suites section
step_decorators:
- \Codeception\Step\ConditionalAssertion
@@ -390,7 +390,7 @@ Now, you are ready to run WebDriver tests using Codeception.
To execute a test in a browser you need to change the suite configuration to use **WebDriver** module.
-Modify your `acceptance.suite.yml` file:
+Modify your `Acceptance.suite.yml` file:
```yaml
actor: AcceptanceTester
@@ -503,10 +503,10 @@ $I->retry(4, 400);
Retries are disabled by default. To enable them you should add retry step decorators to suite config:
-> If you started project as `codecept init acceptance` they should be already enabled in config
+> If you started project as `codecept init Acceptance` they should be already enabled in config
```yaml
-# in acceptance.suite.yml
+# in Acceptance.suite.yml
# or in codeception.yml inside suites section
step_decorators:
- \Codeception\Step\Retry
@@ -578,10 +578,10 @@ if ($I->tryToSeeElement('.alert')) {
A/B testing is disabled by default. To enable it you should add corresponding step decorators to suite config:
-> If you started project as `codecept init acceptance` in Codeception >= 3.0 they should be already enabled in config
+> If you started project as `codecept init Acceptance` in Codeception >= 3.0 they should be already enabled in config
```yaml
-# in acceptance.suite.yml
+# in Acceptance.suite.yml
# or in codeception.yml inside suites section
step_decorators:
- \Codeception\Step\TryTo
diff --git a/docs/AdvancedUsage.md b/docs/AdvancedUsage.md
index 13bcc1265..16d44070d 100644
--- a/docs/AdvancedUsage.md
+++ b/docs/AdvancedUsage.md
@@ -54,7 +54,7 @@ As you see, we are passing the Actor object into `tryToTest` method. This allows
sendGet($example['url']);
+ $I->seeResponseCodeIs($example['expectedReponseCode']);
+ }
+}
+
+```
+
## Example Annotation
As well as the `\Codeception\Attribute\Examples` attribute, available for Cest tests, the `@example` attribute allows you to
@@ -291,8 +317,8 @@ You can also use the `@dataProvider` annotation for creating dynamic examples fo
amOnPage('/login');
$I->fillField('Username', 'miles');
@@ -341,21 +366,26 @@ class ModeratorCest {
}
#[Before('login')]
- public function banUser(AcceptanceTester $I)
+ public function banUser(FunctionalTester $I): void
{
$I->amOnPage('/users/charlie-parker');
$I->see('Ban', '.button');
$I->click('Ban');
}
- // you can specify multiple before and after methods:
+ // Multiple `#[Before]` or `#[After]` attributes are invoked in order from top to bottom:
+ #[Before('login')]
+ #[Before('cleanup')]
+ public function addUser(FunctionalTester $I): void
+ {
+ // ...
+ }
+
+ // But you can also pass multiple methods in each attribute:
#[Before('login', 'cleanup')]
- #[After('logout', 'close')]
- public function addUser(AcceptanceTester $I)
+ public function addUser(FunctionalTester $I): void
{
- $I->amOnPage('/users/charlie-parker');
- $I->see('Ban', '.button');
- $I->click('Ban');
+ // ...
}
}
```
@@ -372,8 +402,8 @@ namespace Tests\Acceptance;
use Codeception\Attribute\Depends;
-class ModeratorCest {
-
+class ModeratorCest
+{
public function login(AcceptanceTester $I)
{
// logs moderator in
@@ -399,7 +429,6 @@ Signature: ModeratorCest:login`
Codeception reorders tests so dependent tests will always be executed before the tests that rely on them.
-
## Environments
For cases where you need to run tests with different configurations, you can define different config environments.
diff --git a/docs/BDD.md b/docs/BDD.md
index 94b2fd182..85cbe3d53 100644
--- a/docs/BDD.md
+++ b/docs/BDD.md
@@ -88,7 +88,7 @@ Feature file is written in Gherkin format. Codeception can generate a feature fi
We will assume that we will use scenarios in feature files for acceptance tests, so feature files to be placed in `acceptance` suite directory:
```bash
-php vendor/bin/codecept g:feature acceptance checkout
+php vendor/bin/codecept g:feature Acceptance checkout
```
Generated template will look like this:
@@ -151,13 +151,13 @@ And in the end we are verifying our expectation using **Then** keyword. The acti
We can test this scenario by executing it in dry-run mode. In this mode test won't be executed (actually, we didn't define any step for it, so it won't be executed in any case).
```bash
-php vendor/bin/codecept dry-run acceptance checkout.feature
+php vendor/bin/codecept dry-run Acceptance checkout.feature
```
```bash
checkout: order several products
Signature: checkout:order several products
-Test: tests/acceptance/checkout.feature:order several products
+Test: tests/Acceptance/checkout.feature:order several products
Scenario --
In order to buy product
As a customer
@@ -181,7 +181,7 @@ Besides the scenario steps listed we got the notification that our steps are not
We can define them easily by executing `gherkin:snippets` command for the given suite:
```bash
-php vendor/bin/codecept gherkin:snippets acceptance
+php vendor/bin/codecept gherkin:snippets Acceptance
```
This will produce code templates for all undefined steps in all feature files of this suite.
@@ -403,7 +403,7 @@ Inside a step definition data is stored in argument passed as `\Behat\Gherkin\No
public function iHaveProductsInCart(\Behat\Gherkin\Node\TableNode $products)
{
// iterate over all rows
- foreach ($node->getRows() as $index => $row) {
+ foreach ($products->getRows() as $index => $row) {
if ($index === 0) { // first row to define fields
$keys = $row;
continue;
@@ -551,7 +551,7 @@ While Behat is a great tool for Behavior Driven Development, you still may prefe
If you decided to run your features with Codeception, we recommend to start with symlinking your `features` directory into one of the test suites:
```bash
-ln -s $PWD/features tests/acceptance
+ln -s $PWD/features tests/Acceptance
```
Then you will need to implement all step definitions. Run `gherkin:snippets` to generate stubs for them.
diff --git a/docs/Codecoverage.md b/docs/Codecoverage.md
index c684c4f73..d164cfd1a 100644
--- a/docs/Codecoverage.md
+++ b/docs/Codecoverage.md
@@ -153,7 +153,7 @@ coverage:
### Remote Server
But if you run tests on different server (or your webserver doesn't use code from current directory) a single option `remote` should be added to config.
-For example, let's turn on remote coverage for acceptance suite in `acceptance.suite.yml`:
+For example, let's turn on remote coverage for acceptance suite in `Acceptance.suite.yml`:
```yaml
diff --git a/docs/ContinuousIntegration.md b/docs/ContinuousIntegration.md
index a7c781502..c8c893d7d 100644
--- a/docs/ContinuousIntegration.md
+++ b/docs/ContinuousIntegration.md
@@ -89,39 +89,36 @@ Jenkins should locate `report.html` at `tests/_output/`. Now Jenkins will displa
GitHub Actions CI can be used to launch tests. Install PHP and Composer and execute tests:
```yaml
-on:
- pull_request:
- branches-ignore: gh-pages
- push:
- branches-ignore: gh-pages
-
name: Codeception Tests
-
+on:
+ pull_request:
+ branches-ignore: gh-pages
+ push:
+ branches-ignore: gh-pages
+
jobs:
- build:
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout
- uses: actions/checkout@v2
-
- - name: Install PHP
- uses: shivammathur/setup-php@v2
- with:
- php-version: ${{ matrix.php }}
- extensions: curl, mbstring, openssl, pdo, pdo_sqlite
- ini-values: memory_limit=-1, date.timezone='UTC'
- coverage: xdebug
- tools: composer:v2
-
- - name: Validate composer.json and composer.lock
- run: composer validate
-
- - name: Install dependencies
- run: composer install --prefer-dist --no-progress --no-interaction --no-suggest
-
- - name: Run tests
- run: php vendor/bin/codecept run
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ - name: Install PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ matrix.php }}
+ extensions: curl, mbstring, openssl, pdo, pdo_sqlite
+ ini-values: memory_limit=-1, date.timezone='UTC'
+ coverage: xdebug
+ tools: composer:v2
+
+ - name: Validate composer.json and composer.lock
+ run: composer validate
+
+ - name: Install dependencies
+ run: composer install --prefer-dist --no-progress --no-interaction --no-suggest
+
+ - name: Run tests
+ run: php vendor/bin/codecept run
```
## GitLab CI
@@ -181,7 +178,7 @@ before_script:
# Test
test:
script:
- - vendor/bin/codecept run acceptance --xml --html
+ - vendor/bin/codecept run Acceptance --xml --html
artifacts:
when: always
expire_in: 1 week
diff --git a/docs/Customization.md b/docs/Customization.md
index 5a4632135..393897afd 100644
--- a/docs/Customization.md
+++ b/docs/Customization.md
@@ -35,10 +35,10 @@ and you want to get a single report in JUnit and HTML format. The code coverage
If you want to run a specific suite from the application you can execute:
```bash
-php vendor/bin/codecept run unit -c frontend
+php vendor/bin/codecept run Unit -c frontend
```
-Where `unit` is the name of suite and the `-c` option specifies the path to the `codeception.yml` configuration file to use.
+Where `Unit` is the name of suite and the `-c` option specifies the path to the `codeception.yml` configuration file to use.
In this example we will assume that there is `frontend/codeception.yml` configuration file
and that we will execute the unit tests for only that app.
@@ -147,7 +147,7 @@ The extension class itself is inherited from `Codeception\Extension`:
```php
Improve this guide
diff --git a/docs/FunctionalTests.md b/docs/FunctionalTests.md
index 8708a8e85..f1e065637 100644
--- a/docs/FunctionalTests.md
+++ b/docs/FunctionalTests.md
@@ -25,7 +25,7 @@ This is a sample functional test:
namespace Tests\Functional;
-use \Tests\Support\FunctionalTester;
+use Tests\Support\FunctionalTester;
class LoginCest
{
diff --git a/docs/GettingStarted.md b/docs/GettingStarted.md
index a468f6bed..c5cf46406 100644
--- a/docs/GettingStarted.md
+++ b/docs/GettingStarted.md
@@ -119,25 +119,6 @@ final class SigninCest
}
```
-This scenario can probably be read by everybody, even non-developers. If you just remove all special characters,
-this test transforms into plain english text:
-
-```yaml
-I amOnPage '/login'
-I fillField 'Username', 'davert'
-I fillField 'Password', 'qwerty'
-I click 'Login'
-I see 'Hello, davert'
-```
-
-Codeception generates this text representation from PHP code by executing:
-
-```bash
-php vendor/bin/codecept generate:scenarios Acceptance
-```
-
-These generated scenarios will be stored in your `tests/Support/Data/scenarios/Functional` directory in `*.txt` files.
-
Before we execute this test, we should make sure that the website is running on a local web server.
Let's open the `tests/Acceptance.suite.yml` file and fill in the URL of your web application:
@@ -302,7 +283,6 @@ There are plenty of useful Codeception commands:
* `generate:test` *suite* *filename* - Generates a sample PHPUnit Test with Codeception hooks
* `generate:feature` *suite* *filename* - Generates Gherkin feature file
* `generate:suite` *suite* *actor* - Generates a new suite with the given Actor class name
-* `generate:scenarios` *suite* - Generates text files containing scenarios from tests
* `generate:helper` *filename* - Generates a sample Helper File
* `generate:pageobject` *suite* *filename* - Generates a sample Page object
* `generate:stepobject` *suite* *filename* - Generates a sample Step object
diff --git a/docs/ParallelExecution.md b/docs/ParallelExecution.md
index 8bf25da48..c3c2a15e8 100644
--- a/docs/ParallelExecution.md
+++ b/docs/ParallelExecution.md
@@ -146,9 +146,9 @@ Codeception can organize tests into [groups](https://codeception.com/docs/Advanc
```bash
-tests/functional/LoginCept.php
-tests/functional/AdminCest.php:createUser
-tests/functional/AdminCest.php:deleteUser
+tests/Functional/LoginCept.php
+tests/Functional/AdminCest.php:createUser
+tests/Functional/AdminCest.php:deleteUser
```
Tasks from `\Codeception\Task\SplitTestsByGroups` will generate non-intersecting group files. You can either split your tests by files or by single tests:
@@ -159,7 +159,7 @@ public function parallelSplitTests()
// Split your tests by files
$this->taskSplitTestFilesByGroups(5)
->projectRoot('.')
- ->testsFrom('tests/acceptance')
+ ->testsFrom('tests/Acceptance')
->groupsTo('tests/Support/Data/paracept_')
->run();
@@ -167,7 +167,7 @@ public function parallelSplitTests()
// Split your tests by single tests (alternatively)
$this->taskSplitTestsByGroups(5)
->projectRoot('.')
- ->testsFrom('tests/acceptance')
+ ->testsFrom('tests/Acceptance')
->groupsTo('tests/Support/Data/paracept_')
->run();
*/
@@ -207,7 +207,7 @@ Let's try to execute tests from the second group:
```bash
-php vendor/bin/codecept run acceptance -g paracept_2
+php vendor/bin/codecept run Acceptance -g paracept_2
```
#### Step 2: Running Tests
@@ -228,7 +228,7 @@ public function parallelRun()
for ($i = 1; $i <= 5; $i++) {
$parallel->process(
$this->taskCodecept() // use built-in Codecept task
- ->suite('acceptance') // run acceptance tests
+ ->suite('Acceptance') // run acceptance tests
->group("paracept_$i") // for all paracept_* groups
->xml("tests/_log/result_$i.xml") // save XML results
);
diff --git a/docs/ReusingTestCode.md b/docs/ReusingTestCode.md
index 18ef9559a..87b89090e 100644
--- a/docs/ReusingTestCode.md
+++ b/docs/ReusingTestCode.md
@@ -95,7 +95,7 @@ Do not hard-code complex CSS or XPath locators in your tests but rather move the
Codeception can generate a PageObject class for you with command:
```
-php vendor/bin/codecept generate:pageobject acceptance Login
+php vendor/bin/codecept generate:pageobject Acceptance Login
```
> It is recommended to use page objects for acceptance testing only
@@ -167,8 +167,8 @@ In the case of a PageObject you should declare a class as a parameter for a test
namespace Tests\Acceptance;
-use \Tests\Support\AcceptanceTester;
-use \Tests\Support\Page\Acceptance\Login;
+use Tests\Support\AcceptanceTester;
+use Tests\Support\Page\Acceptance\Login;
class UserCest
{
@@ -197,17 +197,17 @@ We call such a classes StepObjects.
Lets create an Admin StepObject with the generator:
```
-php vendor/bin/codecept generate:stepobject acceptance Admin
+php vendor/bin/codecept generate:stepobject Acceptance Admin
```
You can supply optional action names. Enter one at a time, followed by a newline.
End with an empty line to continue to StepObject creation.
```
-php vendor/bin/codecept generate:stepobject acceptance Admin
+php vendor/bin/codecept generate:stepobject Acceptance Admin
Add action to StepObject class (ENTER to exit): loginAsAdmin
Add action to StepObject class (ENTER to exit):
-StepObject was created in /tests/acceptance/_support/Step/Acceptance/Admin.php
+StepObject was created in /tests/Acceptance/_support/Step/Acceptance/Admin.php
```
This will generate a class in `/tests/Support/Step/Acceptance/Admin.php` similar to this:
diff --git a/docs/UnitTests.md b/docs/UnitTests.md
index d4d088212..972e26494 100644
--- a/docs/UnitTests.md
+++ b/docs/UnitTests.md
@@ -19,7 +19,7 @@ Create a test using `generate:test` command with a suite and test names as param
php vendor/bin/codecept generate:test Unit Example
```
-It creates a new `ExampleTest` file located in the `tests/unit` directory.
+It creates a new `ExampleTest` file located in the `tests/Unit` directory.
As always, you can run the newly created test with this command:
@@ -40,7 +40,7 @@ A test created by the `generate:test` command will look like this:
namespace Tests\Unit;
-use \Tests\Support\UnitTester;
+use Tests\Support\UnitTester;
class ExampleTest extends \Codeception\Test\Unit
{
@@ -76,7 +76,7 @@ A typical unit test may look like this:
namespace Tests\Unit;
-use \Tests\Support\UnitTester;
+use Tests\Support\UnitTester;
class UserTest extends \Codeception\Test\Unit
{
@@ -255,7 +255,7 @@ function testSavingUser()
```
To enable the database functionality in unit tests, make sure the `Db` module is included
-in the `unit.suite.yml` configuration file.
+in the `Unit.suite.yml` configuration file.
The database will be cleaned and populated after each test, the same way it happens for acceptance and functional tests.
If that's not your required behavior, change the settings of the `Db` module for the current suite. See [Db Module](https://codeception.com/docs/modules/Db)
@@ -355,8 +355,8 @@ $em = $this->getModule('Doctrine')->em;
If you use the `Symfony` module, here is how you can access the Symfony container:
```php
-/** @var Symfony\Component\DependencyInjection\Container */
-$container = $this->getModule('Symfony')->container;
+/** @var Symfony\Component\DependencyInjection\ContainerInterface */
+$container = $this->getModule('Symfony')->_getContainer();
```
The same can be done for all public properties of an enabled module. Accessible properties are listed in the module reference.
@@ -403,7 +403,7 @@ For this case we have a stand-alone project [Specify](https://github.com/Codecep
namespace Tests\Unit;
-use \Tests\Support\UnitTester;
+use Tests\Support\UnitTester;
class UserTest extends \Codeception\Test\Unit
{
diff --git a/docs/modules/AMQP.md b/docs/modules/AMQP.md
index 887e83965..c53997267 100644
--- a/docs/modules/AMQP.md
+++ b/docs/modules/AMQP.md
@@ -35,6 +35,7 @@ To use this module with Composer you need "php-amqplib/php-amqplib": "~2.4"<
* cleanup: true - defined queues will be purged before running every test.
* queues: [mail, twitter] - queues to cleanup
* single_channel - create and use only one channel during test execution
+* reconnect - reconnects before each test to drop unused open channels
#### Example
@@ -48,6 +49,7 @@ To use this module with Composer you need "php-amqplib/php-amqplib": "~2.4"<
vhost: '/'
queues: [queue1, queue2]
single_channel: false
+ reconnect: false
### Public Properties
diff --git a/docs/modules/Asserts.md b/docs/modules/Asserts.md
index 792c7a220..125aa4c4b 100644
--- a/docs/modules/Asserts.md
+++ b/docs/modules/Asserts.md
@@ -25,18 +25,20 @@ Special module for using asserts in your tests.
#### assertArrayHasKey
-* `param int|string` $key
-* `param array|\ArrayAccess` $array
+* `param string|int` $key
+* `param \ArrayAccess|array` $array
* `param string` $message
+* `return void`
Asserts that an array has a specified key.
#### assertArrayNotHasKey
-* `param int|string` $key
-* `param array|\ArrayAccess` $array
+* `param string|int` $key
+* `param \ArrayAccess|array` $array
* `param string` $message
+* `return void`
Asserts that an array does not have a specified key.
@@ -44,8 +46,9 @@ Asserts that an array does not have a specified key.
#### assertClassHasAttribute
* `param string` $attributeName
-* `param string` $className
+* `param class-string` $className
* `param string` $message
+* `return void`
Asserts that a class has a specified attribute.
@@ -53,8 +56,9 @@ Asserts that a class has a specified attribute.
#### assertClassHasStaticAttribute
* `param string` $attributeName
-* `param string` $className
+* `param class-string` $className
* `param string` $message
+* `return void`
Asserts that a class has a specified static attribute.
@@ -62,8 +66,9 @@ Asserts that a class has a specified static attribute.
#### assertClassNotHasAttribute
* `param string` $attributeName
-* `param string` $className
+* `param class-string` $className
* `param string` $message
+* `return void`
Asserts that a class does not have a specified attribute.
@@ -71,8 +76,9 @@ Asserts that a class does not have a specified attribute.
#### assertClassNotHasStaticAttribute
* `param string` $attributeName
-* `param string` $className
+* `param class-string` $className
* `param string` $message
+* `return void`
Asserts that a class does not have a specified static attribute.
@@ -80,8 +86,9 @@ Asserts that a class does not have a specified static attribute.
#### assertContains
* `param mixed` $needle
-* `param iterable` $haystack
+* `param iterable` $haystack
* `param string` $message
+* `return void`
Asserts that a haystack contains a needle.
@@ -89,34 +96,228 @@ Asserts that a haystack contains a needle.
#### assertContainsEquals
* `param mixed` $needle
-* `param iterable` $haystack
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
+#### assertContainsNotOnlyArray
+
+* `param iterable` $haystack
* `param string` $message
+* `return void`
+
+
+#### assertContainsNotOnlyBool
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
+#### assertContainsNotOnlyCallable
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
+#### assertContainsNotOnlyClosedResource
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
+#### assertContainsNotOnlyFloat
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
+#### assertContainsNotOnlyInstancesOf
+
+* `param class-string` $className
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
+#### assertContainsNotOnlyInt
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
+#### assertContainsNotOnlyIterable
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
+#### assertContainsNotOnlyNull
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
+#### assertContainsNotOnlyNumeric
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
+#### assertContainsNotOnlyObject
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
+#### assertContainsNotOnlyResource
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
+#### assertContainsNotOnlyScalar
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
+#### assertContainsNotOnlyString
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
#### assertContainsOnly
* `param string` $type
-* `param iterable` $haystack
+* `param iterable` $haystack
* `param ?bool` $isNativeType
* `param string` $message
+* `return void`
Asserts that a haystack contains only values of a given type.
+#### assertContainsOnlyArray
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
+#### assertContainsOnlyBool
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
+#### assertContainsOnlyCallable
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
+#### assertContainsOnlyClosedResource
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
+#### assertContainsOnlyFloat
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
#### assertContainsOnlyInstancesOf
-* `param string` $className
-* `param iterable` $haystack
+* `param class-string` $className
+* `param iterable` $haystack
* `param string` $message
+* `return void`
Asserts that a haystack contains only instances of a given class name.
+#### assertContainsOnlyInt
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
+#### assertContainsOnlyIterable
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
+#### assertContainsOnlyNull
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
+#### assertContainsOnlyNumeric
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
+#### assertContainsOnlyObject
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
+#### assertContainsOnlyResource
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
+#### assertContainsOnlyScalar
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
+#### assertContainsOnlyString
+
+* `param iterable` $haystack
+* `param string` $message
+* `return void`
+
+
#### assertCount
* `param int` $expectedCount
-* `param \Countable|iterable` $haystack
+* `param \Countable|iterable` $haystack
* `param string` $message
+* `return void`
Asserts the number of elements of an array, Countable or Traversable.
@@ -125,6 +326,7 @@ Asserts the number of elements of an array, Countable or Traversable.
* `param string` $directory
* `param string` $message
+* `return void`
Asserts that a directory does not exist.
@@ -133,6 +335,7 @@ Asserts that a directory does not exist.
* `param string` $directory
* `param string` $message
+* `return void`
Asserts that a directory exists.
@@ -141,6 +344,7 @@ Asserts that a directory exists.
* `param string` $directory
* `param string` $message
+* `return void`
Asserts that a directory exists and is not readable.
@@ -149,6 +353,7 @@ Asserts that a directory exists and is not readable.
* `param string` $directory
* `param string` $message
+* `return void`
Asserts that a directory exists and is not writable.
@@ -157,6 +362,7 @@ Asserts that a directory exists and is not writable.
* `param string` $directory
* `param string` $message
+* `return void`
Asserts that a directory exists and is readable.
@@ -165,6 +371,7 @@ Asserts that a directory exists and is readable.
* `param string` $directory
* `param string` $message
+* `return void`
Asserts that a directory exists and is writable.
@@ -174,14 +381,17 @@ Asserts that a directory exists and is writable.
* `param string` $pattern
* `param string` $string
* `param string` $message
+* `return void`
Asserts that a string does not match a given regular expression.
#### assertEmpty
+* `phpstan-assert` empty $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is empty.
@@ -191,6 +401,7 @@ Asserts that a variable is empty.
* `param mixed` $expected
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that two variables are equal.
@@ -200,6 +411,7 @@ Asserts that two variables are equal.
* `param mixed` $expected
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that two variables are equal (canonicalizing).
@@ -209,6 +421,7 @@ Asserts that two variables are equal (canonicalizing).
* `param mixed` $expected
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that two variables are equal (ignoring case).
@@ -219,14 +432,17 @@ Asserts that two variables are equal (ignoring case).
* `param mixed` $actual
* `param float` $delta
* `param string` $message
+* `return void`
Asserts that two variables are equal (with delta).
#### assertFalse
+* `phpstan-assert` false $condition
* `param mixed` $condition
* `param string` $message
+* `return void`
Asserts that a condition is false.
@@ -235,6 +451,7 @@ Asserts that a condition is false.
* `param string` $filename
* `param string` $message
+* `return void`
Asserts that a file does not exist.
@@ -244,6 +461,7 @@ Asserts that a file does not exist.
* `param string` $expected
* `param string` $actual
* `param string` $message
+* `return void`
Asserts that the contents of one file is equal to the contents of another file.
@@ -253,6 +471,7 @@ Asserts that the contents of one file is equal to the contents of another file.
* `param string` $expected
* `param string` $actual
* `param string` $message
+* `return void`
Asserts that the contents of one file is equal to the contents of another file (canonicalizing).
@@ -262,6 +481,7 @@ Asserts that the contents of one file is equal to the contents of another file (
* `param string` $expected
* `param string` $actual
* `param string` $message
+* `return void`
Asserts that the contents of one file is equal to the contents of another file (ignoring case).
@@ -270,6 +490,7 @@ Asserts that the contents of one file is equal to the contents of another file (
* `param string` $filename
* `param string` $message
+* `return void`
Asserts that a file exists.
@@ -278,6 +499,7 @@ Asserts that a file exists.
* `param string` $file
* `param string` $message
+* `return void`
Asserts that a file exists and is not readable.
@@ -286,6 +508,7 @@ Asserts that a file exists and is not readable.
* `param string` $file
* `param string` $message
+* `return void`
Asserts that a file exists and is not writable.
@@ -294,6 +517,7 @@ Asserts that a file exists and is not writable.
* `param string` $file
* `param string` $message
+* `return void`
Asserts that a file exists and is readable.
@@ -302,6 +526,7 @@ Asserts that a file exists and is readable.
* `param string` $file
* `param string` $message
+* `return void`
Asserts that a file exists and is writable.
@@ -311,6 +536,7 @@ Asserts that a file exists and is writable.
* `param string` $expected
* `param string` $actual
* `param string` $message
+* `return void`
Asserts that the contents of one file is not equal to the contents of another file.
@@ -320,6 +546,7 @@ Asserts that the contents of one file is not equal to the contents of another fi
* `param string` $expected
* `param string` $actual
* `param string` $message
+* `return void`
Asserts that the contents of one file is not equal to the contents of another file (canonicalizing).
@@ -329,6 +556,7 @@ Asserts that the contents of one file is not equal to the contents of another fi
* `param string` $expected
* `param string` $actual
* `param string` $message
+* `return void`
Asserts that the contents of one file is not equal to the contents of another file (ignoring case).
@@ -337,6 +565,7 @@ Asserts that the contents of one file is not equal to the contents of another fi
* `param string` $filename
* `param string` $message
+* `return void`
Asserts that a file does not exist.
@@ -345,6 +574,7 @@ Asserts that a file does not exist.
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is finite.
@@ -354,6 +584,7 @@ Asserts that a variable is finite.
* `param mixed` $expected
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a value is greater than or equal to another value.
@@ -363,6 +594,7 @@ Asserts that a value is greater than or equal to another value.
* `param mixed` $expected
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a value is greater than another value.
@@ -372,6 +604,7 @@ Asserts that a value is greater than another value.
* `param mixed` $expected
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a value is greater than or equal to another value.
@@ -380,47 +613,59 @@ Asserts that a value is greater than or equal to another value.
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is infinite.
#### assertInstanceOf
-* `param string` $expected
+* `template` ExpectedType of object
+* `phpstan-assert` =ExpectedType $actual
+* `param class-string` $expected
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is of a given type.
#### assertIsArray
+* `phpstan-assert` array $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is of type array.
#### assertIsBool
+* `phpstan-assert` bool $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is of type bool.
#### assertIsCallable
+* `phpstan-assert` callable $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is of type callable.
#### assertIsClosedResource
+* `phpstan-assert` resource $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is of type resource and is closed.
@@ -429,102 +674,127 @@ Asserts that a variable is of type resource and is closed.
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is empty.
#### assertIsFloat
+* `phpstan-assert` float $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is of type float.
#### assertIsInt
+* `phpstan-assert` int $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is of type int.
#### assertIsIterable
+* `phpstan-assert` iterable $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is of type iterable.
#### assertIsNotArray
+* `phpstan-assert` !array $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is not of type array.
#### assertIsNotBool
+* `phpstan-assert` !bool $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is not of type bool.
#### assertIsNotCallable
+* `phpstan-assert` !callable $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is not of type callable.
#### assertIsNotClosedResource
+* `phpstan-assert` !resource $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is not of type resource.
#### assertIsNotFloat
+* `phpstan-assert` !float $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is not of type float.
#### assertIsNotInt
+* `phpstan-assert` !int $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is not of type int.
#### assertIsNotIterable
+* `phpstan-assert` !iterable $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is not of type iterable.
#### assertIsNotNumeric
+* `phpstan-assert` !numeric $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is not of type numeric.
#### assertIsNotObject
+* `phpstan-assert` !object $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is not of type object.
@@ -533,30 +803,37 @@ Asserts that a variable is not of type object.
* `param string` $filename
* `param string` $message
+* `return void`
Asserts that a file/dir exists and is not readable.
#### assertIsNotResource
+* `phpstan-assert` !resource $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is not of type resource.
#### assertIsNotScalar
+* `psalm-assert` !scalar $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is not of type scalar.
#### assertIsNotString
+* `phpstan-assert` !string $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is not of type string.
@@ -565,22 +842,27 @@ Asserts that a variable is not of type string.
* `param string` $filename
* `param string` $message
+* `return void`
Asserts that a file/dir exists and is not writable.
#### assertIsNumeric
+* `phpstan-assert` numeric $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is of type numeric.
#### assertIsObject
+* `phpstan-assert` object $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is of type object.
@@ -589,30 +871,37 @@ Asserts that a variable is of type object.
* `param string` $filename
* `param string` $message
+* `return void`
Asserts that a file/dir is readable.
#### assertIsResource
+* `phpstan-assert` resource $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is of type resource.
#### assertIsScalar
+* `phpstan-assert` scalar $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is of type scalar.
#### assertIsString
+* `phpstan-assert` string $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is of type string.
@@ -621,6 +910,7 @@ Asserts that a variable is of type string.
* `param string` $filename
* `param string` $message
+* `return void`
Asserts that a file/dir exists and is writable.
@@ -629,6 +919,7 @@ Asserts that a file/dir exists and is writable.
* `param string` $actualJson
* `param string` $message
+* `return void`
Asserts that a string is a valid JSON string.
@@ -638,6 +929,7 @@ Asserts that a string is a valid JSON string.
* `param string` $expectedFile
* `param string` $actualFile
* `param string` $message
+* `return void`
Asserts that two JSON files are equal.
@@ -647,6 +939,7 @@ Asserts that two JSON files are equal.
* `param string` $expectedFile
* `param string` $actualFile
* `param string` $message
+* `return void`
Asserts that two JSON files are not equal.
@@ -656,6 +949,7 @@ Asserts that two JSON files are not equal.
* `param string` $expectedFile
* `param string` $actualJson
* `param string` $message
+* `return void`
Asserts that the generated JSON encoded object and the content of the given file are equal.
@@ -665,6 +959,7 @@ Asserts that the generated JSON encoded object and the content of the given file
* `param string` $expectedJson
* `param string` $actualJson
* `param string` $message
+* `return void`
Asserts that two given JSON encoded objects or arrays are equal.
@@ -674,6 +969,7 @@ Asserts that two given JSON encoded objects or arrays are equal.
* `param string` $expectedFile
* `param string` $actualJson
* `param string` $message
+* `return void`
Asserts that the generated JSON encoded object and the content of the given file are not equal.
@@ -683,6 +979,7 @@ Asserts that the generated JSON encoded object and the content of the given file
* `param string` $expectedJson
* `param string` $actualJson
* `param string` $message
+* `return void`
Asserts that two given JSON encoded objects or arrays are not equal.
@@ -692,6 +989,7 @@ Asserts that two given JSON encoded objects or arrays are not equal.
* `param mixed` $expected
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a value is smaller than or equal to another value.
@@ -701,6 +999,7 @@ Asserts that a value is smaller than or equal to another value.
* `param mixed` $expected
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a value is smaller than another value.
@@ -710,6 +1009,7 @@ Asserts that a value is smaller than another value.
* `param mixed` $expected
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a value is smaller than or equal to another value.
@@ -719,6 +1019,7 @@ Asserts that a value is smaller than or equal to another value.
* `param string` $pattern
* `param string` $string
* `param string` $message
+* `return void`
Asserts that a string matches a given regular expression.
@@ -727,6 +1028,7 @@ Asserts that a string matches a given regular expression.
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is nan.
@@ -734,25 +1036,28 @@ Asserts that a variable is nan.
#### assertNotContains
* `param mixed` $needle
-* `param iterable` $haystack
+* `param iterable` $haystack
* `param string` $message
+* `return void`
Asserts that a haystack does not contain a needle.
#### assertNotContainsEquals
-* `param ` $needle
-* `param iterable` $haystack
+* `param mixed` $needle
+* `param iterable` $haystack
* `param string` $message
+* `return void`
#### assertNotContainsOnly
* `param string` $type
-* `param iterable` $haystack
+* `param iterable` $haystack
* `param ?bool` $isNativeType
* `param string` $message
+* `return void`
Asserts that a haystack does not contain only values of a given type.
@@ -760,16 +1065,19 @@ Asserts that a haystack does not contain only values of a given type.
#### assertNotCount
* `param int` $expectedCount
-* `param \Countable|iterable` $haystack
+* `param \Countable|iterable` $haystack
* `param string` $message
+* `return void`
Asserts the number of elements of an array, Countable or Traversable.
#### assertNotEmpty
+* `phpstan-assert` !empty $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is not empty.
@@ -779,6 +1087,7 @@ Asserts that a variable is not empty.
* `param mixed` $expected
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that two variables are not equal.
@@ -788,6 +1097,7 @@ Asserts that two variables are not equal.
* `param mixed` $expected
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that two variables are not equal (canonicalizing).
@@ -797,6 +1107,7 @@ Asserts that two variables are not equal (canonicalizing).
* `param mixed` $expected
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that two variables are not equal (ignoring case).
@@ -807,31 +1118,39 @@ Asserts that two variables are not equal (ignoring case).
* `param mixed` $actual
* `param float` $delta
* `param string` $message
+* `return void`
Asserts that two variables are not equal (with delta).
#### assertNotFalse
+* `phpstan-assert` !false $condition
* `param mixed` $condition
* `param string` $message
+* `return void`
Asserts that a condition is not false.
#### assertNotInstanceOf
-* `param string` $expected
+* `template` ExpectedType of object
+* `phpstan-assert` !ExpectedType $actual
+* `param class-string` $expected
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is not of a given type.
#### assertNotNull
+* `phpstan-assert` !null $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is not null.
@@ -841,6 +1160,7 @@ Asserts that a variable is not null.
* `param string` $pattern
* `param string` $string
* `param string` $message
+* `return void`
Asserts that a string does not match a given regular expression.
@@ -850,31 +1170,37 @@ Asserts that a string does not match a given regular expression.
* `param mixed` $expected
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that two variables do not have the same type and value.
#### assertNotSameSize
-* `param \Countable|iterable` $expected
-* `param \Countable|iterable` $actual
+* `param \Countable|iterable` $expected
+* `param \Countable|iterable` $actual
* `param string` $message
+* `return void`
Assert that the size of two arrays (or `Countable` or `Traversable` objects) is not the same.
#### assertNotTrue
+* `phpstan-assert` !true $condition
* `param mixed` $condition
* `param string` $message
+* `return void`
Asserts that a condition is not true.
#### assertNull
+* `phpstan-assert` null $actual
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that a variable is null.
@@ -884,6 +1210,7 @@ Asserts that a variable is null.
* `param string` $attributeName
* `param object` $object
* `param string` $message
+* `return void`
Asserts that an object has a specified attribute.
@@ -893,6 +1220,7 @@ Asserts that an object has a specified attribute.
* `param string` $attributeName
* `param object` $object
* `param string` $message
+* `return void`
Asserts that an object does not have a specified attribute.
@@ -902,24 +1230,32 @@ Asserts that an object does not have a specified attribute.
* `param string` $pattern
* `param string` $string
* `param string` $message
+* `return void`
Asserts that a string matches a given regular expression.
#### assertSame
-* `param mixed` $expected
+* `template` ExpectedType
+* `phpstan-assert` =ExpectedType $actual
+* `param ExpectedType` $expected
* `param mixed` $actual
* `param string` $message
+* `return void`
Asserts that two variables have the same type and value.
+Used on objects, it asserts that two variables reference
+the same object.
+
#### assertSameSize
-* `param \Countable|iterable` $expected
-* `param \Countable|iterable` $actual
+* `param \Countable|iterable` $expected
+* `param \Countable|iterable` $actual
* `param string` $message
+* `return void`
Assert that the size of two arrays (or `Countable` or `Traversable` objects) is the same.
@@ -929,6 +1265,7 @@ Assert that the size of two arrays (or `Countable` or `Traversable` objects) is
* `param string` $needle
* `param string` $haystack
* `param string` $message
+* `return void`
#### assertStringContainsStringIgnoringCase
@@ -936,22 +1273,25 @@ Assert that the size of two arrays (or `Countable` or `Traversable` objects) is
* `param string` $needle
* `param string` $haystack
* `param string` $message
+* `return void`
#### assertStringEndsNotWith
-* `param string` $suffix
+* `param non-empty-string` $suffix
* `param string` $string
* `param string` $message
+* `return void`
Asserts that a string ends not with a given suffix.
#### assertStringEndsWith
-* `param string` $suffix
+* `param non-empty-string` $suffix
* `param string` $string
* `param string` $message
+* `return void`
Asserts that a string ends with a given suffix.
@@ -961,6 +1301,7 @@ Asserts that a string ends with a given suffix.
* `param string` $expectedFile
* `param string` $actualString
* `param string` $message
+* `return void`
Asserts that the contents of a string is equal to the contents of a file.
@@ -970,6 +1311,7 @@ Asserts that the contents of a string is equal to the contents of a file.
* `param string` $expectedFile
* `param string` $actualString
* `param string` $message
+* `return void`
Asserts that the contents of a string is equal to the contents of a file (canonicalizing).
@@ -979,6 +1321,7 @@ Asserts that the contents of a string is equal to the contents of a file (canoni
* `param string` $expectedFile
* `param string` $actualString
* `param string` $message
+* `return void`
Asserts that the contents of a string is equal to the contents of a file (ignoring case).
@@ -988,6 +1331,7 @@ Asserts that the contents of a string is equal to the contents of a file (ignori
* `param string` $format
* `param string` $string
* `param string` $message
+* `return void`
Asserts that a string matches a given format string.
@@ -997,6 +1341,7 @@ Asserts that a string matches a given format string.
* `param string` $formatFile
* `param string` $string
* `param string` $message
+* `return void`
Asserts that a string matches a given format file.
@@ -1006,6 +1351,7 @@ Asserts that a string matches a given format file.
* `param string` $needle
* `param string` $haystack
* `param string` $message
+* `return void`
#### assertStringNotContainsStringIgnoringCase
@@ -1013,6 +1359,7 @@ Asserts that a string matches a given format file.
* `param string` $needle
* `param string` $haystack
* `param string` $message
+* `return void`
#### assertStringNotEqualsFile
@@ -1020,6 +1367,7 @@ Asserts that a string matches a given format file.
* `param string` $expectedFile
* `param string` $actualString
* `param string` $message
+* `return void`
Asserts that the contents of a string is not equal to the contents of a file.
@@ -1029,6 +1377,7 @@ Asserts that the contents of a string is not equal to the contents of a file.
* `param string` $expectedFile
* `param string` $actualString
* `param string` $message
+* `return void`
Asserts that the contents of a string is not equal to the contents of a file (canonicalizing).
@@ -1038,6 +1387,7 @@ Asserts that the contents of a string is not equal to the contents of a file (ca
* `param string` $expectedFile
* `param string` $actualString
* `param string` $message
+* `return void`
Asserts that the contents of a string is not equal to the contents of a file (ignoring case).
@@ -1047,6 +1397,7 @@ Asserts that the contents of a string is not equal to the contents of a file (ig
* `param string` $format
* `param string` $string
* `param string` $message
+* `return void`
Asserts that a string does not match a given format string.
@@ -1056,24 +1407,27 @@ Asserts that a string does not match a given format string.
* `param string` $formatFile
* `param string` $string
* `param string` $message
+* `return void`
Asserts that a string does not match a given format string.
#### assertStringStartsNotWith
-* `param string` $prefix
+* `param non-empty-string` $prefix
* `param string` $string
* `param string` $message
+* `return void`
Asserts that a string starts not with a given prefix.
#### assertStringStartsWith
-* `param string` $prefix
+* `param non-empty-string` $prefix
* `param string` $string
* `param string` $message
+* `return void`
Asserts that a string starts with a given prefix.
@@ -1083,6 +1437,7 @@ Asserts that a string starts with a given prefix.
* `param mixed` $value
* `param \PHPUnit\Framework\Constraint\Constraint` $constraint
* `param string` $message
+* `return void`
Evaluates a PHPUnit\Framework\Constraint matcher object.
@@ -1092,14 +1447,17 @@ Evaluates a PHPUnit\Framework\Constraint matcher object.
* `param mixed` $value
* `param \PHPUnit\Framework\Constraint\Constraint` $constraint
* `param string` $message
+* `return void`
Evaluates a PHPUnit\Framework\Constraint matcher object.
#### assertTrue
+* `phpstan-assert` true $condition
* `param mixed` $condition
* `param string` $message
+* `return void`
Asserts that a condition is true.
@@ -1109,6 +1467,7 @@ Asserts that a condition is true.
* `param string` $expectedFile
* `param string` $actualFile
* `param string` $message
+* `return void`
Asserts that two XML files are equal.
@@ -1118,6 +1477,7 @@ Asserts that two XML files are equal.
* `param string` $expectedFile
* `param string` $actualFile
* `param string` $message
+* `return void`
Asserts that two XML files are not equal.
@@ -1127,6 +1487,7 @@ Asserts that two XML files are not equal.
* `param string` $expectedFile
* `param \DOMDocument|string` $actualXml
* `param string` $message
+* `return void`
Asserts that two XML documents are equal.
@@ -1136,6 +1497,7 @@ Asserts that two XML documents are equal.
* `param \DOMDocument|string` $expectedXml
* `param \DOMDocument|string` $actualXml
* `param string` $message
+* `return void`
Asserts that two XML documents are equal.
@@ -1145,6 +1507,7 @@ Asserts that two XML documents are equal.
* `param string` $expectedFile
* `param \DOMDocument|string` $actualXml
* `param string` $message
+* `return void`
Asserts that two XML documents are not equal.
@@ -1154,6 +1517,7 @@ Asserts that two XML documents are not equal.
* `param \DOMDocument|string` $expectedXml
* `param \DOMDocument|string` $actualXml
* `param string` $message
+* `return void`
Asserts that two XML documents are not equal.
@@ -1180,6 +1544,7 @@ $I->expectThrowable(new MyException(), function() {
});
{% endhighlight %}
+
If you want to check message or throwable code, you can pass them with throwable instance:
{% highlight php %}
@@ -1195,6 +1560,7 @@ $I->expectThrowable(new MyError("Don't do bad things"), function() {
#### fail
* `param string` $message
+* `return never`
Fails a test with the given message.
@@ -1202,6 +1568,7 @@ Fails a test with the given message.
#### markTestIncomplete
* `param string` $message
+* `return never`
Mark the test as incomplete.
@@ -1209,6 +1576,7 @@ Mark the test as incomplete.
#### markTestSkipped
* `param string` $message
+* `return never`
Mark the test as skipped.
diff --git a/docs/modules/Db.md b/docs/modules/Db.md
index 9f203be0a..b017c643e 100644
--- a/docs/modules/Db.md
+++ b/docs/modules/Db.md
@@ -25,7 +25,7 @@ The most important function of this module is to clean a database before each te
This module also provides actions to perform checks in a database, e.g. [seeInDatabase()](https://codeception.com/docs/modules/Db#seeInDatabase)
In order to have your database populated with data you need a raw SQL dump.
-Simply put the dump in the `tests/_data` directory (by default) and specify the path in the config.
+Simply put the dump in the `tests/Support/Data` directory (by default) and specify the path in the config.
The next time after the database is cleared, all your data will be restored from the dump.
Don't forget to include `CREATE TABLE` statements in the dump.
@@ -40,85 +40,80 @@ Also available:
* MS SQL
* Oracle
-Connection is done by database Drivers, which are stored in the `Codeception\Lib\Driver` namespace.
-[Check out the drivers](https://github.com/Codeception/Codeception/tree/2.4/src/Codeception/Lib/Driver)
-if you run into problems loading dumps and cleaning databases.
-
-### Config
-
-* dsn *required* - PDO DSN
-* user *required* - username to access database
-* password *required* - password
-* dump - path to database dump
-* populate: false - whether the the dump should be loaded before the test suite is started
-* cleanup: false - whether the dump should be reloaded before each test
-* reconnect: false - whether the module should reconnect to the database before each test
-* waitlock: 0 - wait lock (in seconds) that the database session should use for DDL statements
-* ssl_key - path to the SSL key (MySQL specific, @see https://php.net/manual/de/ref.pdo-mysql.php#pdo.constants.mysql-attr-key)
-* ssl_cert - path to the SSL certificate (MySQL specific, @see https://php.net/manual/de/ref.pdo-mysql.php#pdo.constants.mysql-attr-ssl-cert)
-* ssl_ca - path to the SSL certificate authority (MySQL specific, @see https://php.net/manual/de/ref.pdo-mysql.php#pdo.constants.mysql-attr-ssl-ca)
-* ssl_verify_server_cert - disables certificate CN verification (MySQL specific, @see https://php.net/manual/de/ref.pdo-mysql.php)
-* ssl_cipher - list of one or more permissible ciphers to use for SSL encryption (MySQL specific, @see https://php.net/manual/de/ref.pdo-mysql.php#pdo.constants.mysql-attr-cipher)
-* databases - include more database configs and switch between them in tests.
-* initial_queries - list of queries to be executed right after connection to the database has been initiated, i.e. creating the database if it does not exist or preparing the database collation
-* skip_cleanup_if_failed - Do not perform the cleanup if the tests failed. If this is used, manual cleanup might be required when re-running
-### Example
-
- modules:
- enabled:
- - Db:
- dsn: 'mysql:host=localhost;dbname=testdb'
- user: 'root'
- password: ''
- dump: 'tests/_data/dump.sql'
- populate: true
- cleanup: true
- reconnect: true
- waitlock: 10
- skip_cleanup_if_failed: true
- ssl_key: '/path/to/client-key.pem'
- ssl_cert: '/path/to/client-cert.pem'
- ssl_ca: '/path/to/ca-cert.pem'
- ssl_verify_server_cert: false
- ssl_cipher: 'AES256-SHA'
- initial_queries:
- - 'CREATE DATABASE IF NOT EXISTS temp_db;'
- - 'USE temp_db;'
- - 'SET NAMES utf8;'
+Connection is done by database drivers, which are stored in the `Codeception\Lib\Driver` namespace.
+Check out the drivers if you run into problems loading dumps and cleaning databases.
+
+### Example `Functional.suite.yml`
+{% highlight yaml %}
+
+modules:
+ enabled:
+ - Db:
+ dsn: 'mysql:host=localhost;dbname=testdb'
+ user: 'root'
+ password: ''
+ dump: 'tests/Support/Data/dump.sql'
+ populate: true # whether the dump should be loaded before the test suite is started
+ cleanup: true # whether the dump should be reloaded before each test
+ reconnect: true # whether the module should reconnect to the database before each test
+ waitlock: 10 # wait lock (in seconds) that the database session should use for DDL statements
+ databases: # include more database configs and switch between them in tests.
+ skip_cleanup_if_failed: true # Do not perform the cleanup if the tests failed. If this is used, manual cleanup might be required when re-running
+ ssl_key: '/path/to/client-key.pem' # path to the SSL key (MySQL specific, see https://php.net/manual/de/ref.pdo-mysql.php#pdo.constants.mysql-attr-key)
+ ssl_cert: '/path/to/client-cert.pem' # path to the SSL certificate (MySQL specific, see https://php.net/manual/de/ref.pdo-mysql.php#pdo.constants.mysql-attr-ssl-cert)
+ ssl_ca: '/path/to/ca-cert.pem' # path to the SSL certificate authority (MySQL specific, see https://php.net/manual/de/ref.pdo-mysql.php#pdo.constants.mysql-attr-ssl-ca)
+ ssl_verify_server_cert: false # disables certificate CN verification (MySQL specific, see https://php.net/manual/de/ref.pdo-mysql.php)
+ ssl_cipher: 'AES256-SHA' # list of one or more permissible ciphers to use for SSL encryption (MySQL specific, see https://php.net/manual/de/ref.pdo-mysql.php#pdo.constants.mysql-attr-cipher)
+ initial_queries: # list of queries to be executed right after connection to the database has been initiated, i.e. creating the database if it does not exist or preparing the database collation
+ - 'CREATE DATABASE IF NOT EXISTS temp_db;'
+ - 'USE temp_db;'
+ - 'SET NAMES utf8;'
+
+{% endhighlight %}
### Example with multi-dumps
- modules:
- enabled:
- - Db:
- dsn: 'mysql:host=localhost;dbname=testdb'
- user: 'root'
- password: ''
- dump:
- - 'tests/_data/dump.sql'
- - 'tests/_data/dump-2.sql'
+{% highlight yaml %}
+
+modules:
+ enabled:
+ - Db:
+ dsn: 'mysql:host=localhost;dbname=testdb'
+ user: 'root'
+ password: ''
+ dump:
+ - 'tests/Support/Data/dump.sql'
+ - 'tests/Support/Data/dump-2.sql'
+
+{% endhighlight %}
### Example with multi-databases
+{% highlight yaml %}
- modules:
- enabled:
- - Db:
- dsn: 'mysql:host=localhost;dbname=testdb'
- user: 'root'
- password: ''
- databases:
+modules:
+ enabled:
+ - Db:
+ dsn: 'mysql:host=localhost;dbname=testdb'
+ user: 'root'
+ password: ''
+ databases:
db2:
- dsn: 'mysql:host=localhost;dbname=testdb2'
- user: 'userdb2'
- password: ''
+ dsn: 'mysql:host=localhost;dbname=testdb2'
+ user: 'userdb2'
+ password: ''
+
+{% endhighlight %}
-### Example with Sqlite
+### Example with SQLite
+{% highlight yaml %}
+
+modules:
+ enabled:
+ - Db:
+ dsn: 'sqlite:relative/path/to/sqlite-database.db'
+ user: ''
+ password: ''
- modules:
- enabled:
- - Db:
- dsn: 'sqlite:relative/path/to/sqlite-database.db'
- user: ''
- password: ''
+{% endhighlight %}
### SQL data dump
@@ -134,31 +129,32 @@ For MySQL:
{% highlight yaml %}
modules:
- enabled:
- - Db:
- dsn: 'mysql:host=localhost;dbname=testdb'
- user: 'root'
- password: ''
- dump: 'tests/_data/dump.sql'
- populate: true # run populator before all tests
- cleanup: true # run populator before each test
- populator: 'mysql -u $user -h $host $dbname < $dump'
+ enabled:
+ - Db:
+ dsn: 'mysql:host=localhost;dbname=testdb'
+ user: 'root'
+ password: ''
+ dump: 'tests/Support/Data/dump.sql'
+ populate: true # run populator before all tests
+ cleanup: true # run populator before each test
+ populator: 'mysql -u $user -h $host $dbname < $dump'
{% endhighlight %}
-For PostgreSQL (using pg_restore)
+For PostgreSQL (using `pg_restore`)
{% highlight yaml %}
+
modules:
- enabled:
- - Db:
- dsn: 'pgsql:host=localhost;dbname=testdb'
- user: 'root'
- password: ''
- dump: 'tests/_data/db_backup.dump'
- populate: true # run populator before all tests
- cleanup: true # run populator before each test
- populator: 'pg_restore -u $user -h $host -D $dbname < $dump'
+ enabled:
+ - Db:
+ dsn: 'pgsql:host=localhost;dbname=testdb'
+ user: 'root'
+ password: ''
+ dump: 'tests/Support/Data/db_backup.dump'
+ populate: true # run populator before all tests
+ cleanup: true # run populator before each test
+ populator: 'pg_restore -u $user -h $host -D $dbname < $dump'
{% endhighlight %}
@@ -334,7 +330,7 @@ Provide table name, desired column and criteria.
{% highlight php %}
grabColumnFromDatabase('users', 'email', array('name' => 'RebOOter'));
+$mails = $I->grabColumnFromDatabase('users', 'email', ['name' => 'RebOOter']);
{% endhighlight %}
@@ -353,7 +349,7 @@ Provide table name and criteria.
{% highlight php %}
grabEntriesFromDatabase('users', array('name' => 'Davert'));
+$mail = $I->grabEntriesFromDatabase('users', ['name' => 'Davert']);
{% endhighlight %}
Comparison expressions can be used as well:
@@ -384,7 +380,7 @@ Provide table name, desired column and criteria.
{% highlight php %}
grabEntryFromDatabase('users', array('name' => 'Davert'));
+$mail = $I->grabEntryFromDatabase('users', ['name' => 'Davert']);
{% endhighlight %}
Comparison expressions can be used as well:
@@ -414,7 +410,7 @@ Provide table name, desired column and criteria.
{% highlight php %}
grabFromDatabase('users', 'email', array('name' => 'Davert'));
+$mail = $I->grabFromDatabase('users', 'email', ['name' => 'Davert']);
{% endhighlight %}
Comparison expressions can be used as well:
@@ -451,7 +447,7 @@ unless you've configured "skip_cleanup_if_failed", and the test fails.
{% highlight php %}
haveInDatabase('users', array('name' => 'miles', 'email' => 'miles@davis.com'));
+$I->haveInDatabase('users', ['name' => 'miles', 'email' => 'miles@davis.com']);
{% endhighlight %}
@@ -559,7 +555,7 @@ Update an SQL record into a database.
{% highlight php %}
updateInDatabase('users', array('isAdmin' => true), array('email' => 'miles@davis.com'));
+$I->updateInDatabase('users', ['isAdmin' => true], ['email' => 'miles@davis.com']);
{% endhighlight %}
diff --git a/docs/modules/Doctrine.md b/docs/modules/Doctrine.md
index 8a72d069a..9c2a46e1a 100644
--- a/docs/modules/Doctrine.md
+++ b/docs/modules/Doctrine.md
@@ -19,10 +19,15 @@ composer require --dev codeception/module-doctrine
+Upgrading from Module "Doctrine2":
+* In your `composer.json`: Replace `"codeception/module-doctrine2"` with `"codeception/module-doctrine"`
+* In your `Acceptance.suite.yml`, `Functional.suite.yml`, and `Unit.suite.yml`: Replace `- Doctrine2:` with `- Doctrine:`
+* In any file in `Support/Helper/`: Change `$this->getModule('Doctrine2')` to `$this->getModule('Doctrine')`
+
Access the database using [Doctrine ORM](https://docs.doctrine-project.org/projects/doctrine-orm/en/latest/).
When used with Symfony or Zend Framework 2, Doctrine's Entity Manager is automatically retrieved from Service Locator.
-Set up your `functional.suite.yml` like this:
+Set up your `Functional.suite.yml` like this:
{% highlight yaml %}
@@ -354,7 +359,7 @@ Note that `$em->persist()`, `$em->refresh()`, and `$em->flush()` are called ever
* `throws ModuleRequireException`
* `return void`
-Loads fixtures. Fixture can be specified as a fully qualified class name,
+Loads fixtures. The fixture class can be specified as a fully qualified class name,
an instance, or an array of class names/instances.
{% highlight php %}
diff --git a/docs/modules/Laminas.md b/docs/modules/Laminas.md
index 9da86c782..2dbbfcb12 100644
--- a/docs/modules/Laminas.md
+++ b/docs/modules/Laminas.md
@@ -400,7 +400,7 @@ You can set additional cookie params like `domain`, `path` as array passed in la
* `param string` $uri
* `return void`
-Checks that the current URL doesn't equal the given string.
+Checks that the current URL (path) doesn't equal the given string.
Unlike `dontSeeInCurrentUrl`, this only matches the full URL.
@@ -418,13 +418,13 @@ $I->dontSeeCurrentUrlEquals('/');
* `param string` $uri
* `return void`
-Checks that current url doesn't match the given regular expression.
+Checks that current URL (path) doesn't match the given regular expression.
{% highlight php %}
dontSeeCurrentUrlMatches('~^/users/(\d+)~');
+$I->dontSeeCurrentUrlMatches('~^/users/\d+$~');
{% endhighlight %}
@@ -455,7 +455,7 @@ $I->dontSeeElement('input', ['value' => '123456']);
* `param string` $uri
* `return void`
-Checks that the current URI doesn't contain the given string.
+Checks that the current URI (path) doesn't contain the given string.
{% highlight php %}
@@ -962,14 +962,12 @@ $I->seeCurrentRouteIs('posts.show', ['id' => 8]));
* `param string` $uri
* `return void`
-Checks that the current URL is equal to the given string.
-
-Unlike `seeInCurrentUrl`, this only matches the full URL.
+Checks that the current URL (path) is equal to the given string.
{% highlight php %}
seeCurrentUrlEquals('/');
{% endhighlight %}
@@ -980,13 +978,12 @@ $I->seeCurrentUrlEquals('/');
* `param string` $uri
* `return void`
-Checks that the current URL matches the given regular expression.
+Checks that the current URL (path) matches the given regular expression.
{% highlight php %}
seeCurrentUrlMatches('~^/users/(\d+)~');
+$I->seeCurrentUrlMatches('~^/users/\d+$~');
{% endhighlight %}
@@ -1118,9 +1115,9 @@ $form = [
'checkbox1' => true,
// ...
];
-$I->submitForm('//form[@id=my-form]', string $form, 'submitButton');
+$I->submitForm('//form[@id=my-form]', $form, 'submitButton');
// $I->amOnPage('/path/to/form-page') may be needed
-$I->seeInFormFields('//form[@id=my-form]', string $form);
+$I->seeInFormFields('//form[@id=my-form]', $form);
{% endhighlight %}
diff --git a/docs/modules/Laravel.md b/docs/modules/Laravel.md
index 7628ef7f6..91f91e54e 100644
--- a/docs/modules/Laravel.md
+++ b/docs/modules/Laravel.md
@@ -660,7 +660,7 @@ You can set additional cookie params like `domain`, `path` as array passed in la
* `param string` $uri
* `return void`
-Checks that the current URL doesn't equal the given string.
+Checks that the current URL (path) doesn't equal the given string.
Unlike `dontSeeInCurrentUrl`, this only matches the full URL.
@@ -678,13 +678,13 @@ $I->dontSeeCurrentUrlEquals('/');
* `param string` $uri
* `return void`
-Checks that current url doesn't match the given regular expression.
+Checks that current URL (path) doesn't match the given regular expression.
{% highlight php %}
dontSeeCurrentUrlMatches('~^/users/(\d+)~');
+$I->dontSeeCurrentUrlMatches('~^/users/\d+$~');
{% endhighlight %}
@@ -746,7 +746,7 @@ $I->dontSeeFormErrors();
* `param string` $uri
* `return void`
-Checks that the current URI doesn't contain the given string.
+Checks that the current URI (path) doesn't contain the given string.
{% highlight php %}
@@ -1679,14 +1679,12 @@ $I->seeCurrentRouteIs('posts.index');
* `param string` $uri
* `return void`
-Checks that the current URL is equal to the given string.
-
-Unlike `seeInCurrentUrl`, this only matches the full URL.
+Checks that the current URL (path) is equal to the given string.
{% highlight php %}
seeCurrentUrlEquals('/');
{% endhighlight %}
@@ -1697,13 +1695,12 @@ $I->seeCurrentUrlEquals('/');
* `param string` $uri
* `return void`
-Checks that the current URL matches the given regular expression.
+Checks that the current URL (path) matches the given regular expression.
{% highlight php %}
seeCurrentUrlMatches('~^/users/(\d+)~');
+$I->seeCurrentUrlMatches('~^/users/\d+$~');
{% endhighlight %}
@@ -1926,9 +1923,9 @@ $form = [
'checkbox1' => true,
// ...
];
-$I->submitForm('//form[@id=my-form]', string $form, 'submitButton');
+$I->submitForm('//form[@id=my-form]', $form, 'submitButton');
// $I->amOnPage('/path/to/form-page') may be needed
-$I->seeInFormFields('//form[@id=my-form]', string $form);
+$I->seeInFormFields('//form[@id=my-form]', $form);
{% endhighlight %}
diff --git a/docs/modules/Lumen.md b/docs/modules/Lumen.md
index 158bedeaa..89315a443 100644
--- a/docs/modules/Lumen.md
+++ b/docs/modules/Lumen.md
@@ -409,7 +409,7 @@ You can set additional cookie params like `domain`, `path` as array passed in la
* `param string` $uri
* `return void`
-Checks that the current URL doesn't equal the given string.
+Checks that the current URL (path) doesn't equal the given string.
Unlike `dontSeeInCurrentUrl`, this only matches the full URL.
@@ -427,13 +427,13 @@ $I->dontSeeCurrentUrlEquals('/');
* `param string` $uri
* `return void`
-Checks that current url doesn't match the given regular expression.
+Checks that current URL (path) doesn't match the given regular expression.
{% highlight php %}
dontSeeCurrentUrlMatches('~^/users/(\d+)~');
+$I->dontSeeCurrentUrlMatches('~^/users/\d+$~');
{% endhighlight %}
@@ -464,7 +464,7 @@ $I->dontSeeElement('input', ['value' => '123456']);
* `param string` $uri
* `return void`
-Checks that the current URI doesn't contain the given string.
+Checks that the current URI (path) doesn't contain the given string.
{% highlight php %}
@@ -1221,14 +1221,12 @@ $I->seeCookie('PHPSESSID');
* `param string` $uri
* `return void`
-Checks that the current URL is equal to the given string.
-
-Unlike `seeInCurrentUrl`, this only matches the full URL.
+Checks that the current URL (path) is equal to the given string.
{% highlight php %}
seeCurrentUrlEquals('/');
{% endhighlight %}
@@ -1239,13 +1237,12 @@ $I->seeCurrentUrlEquals('/');
* `param string` $uri
* `return void`
-Checks that the current URL matches the given regular expression.
+Checks that the current URL (path) matches the given regular expression.
{% highlight php %}
seeCurrentUrlMatches('~^/users/(\d+)~');
+$I->seeCurrentUrlMatches('~^/users/\d+$~');
{% endhighlight %}
@@ -1377,9 +1374,9 @@ $form = [
'checkbox1' => true,
// ...
];
-$I->submitForm('//form[@id=my-form]', string $form, 'submitButton');
+$I->submitForm('//form[@id=my-form]', $form, 'submitButton');
// $I->amOnPage('/path/to/form-page') may be needed
-$I->seeInFormFields('//form[@id=my-form]', string $form);
+$I->seeInFormFields('//form[@id=my-form]', $form);
{% endhighlight %}
diff --git a/docs/modules/Mezzio.md b/docs/modules/Mezzio.md
index a6d8f6e64..9bb626c5d 100644
--- a/docs/modules/Mezzio.md
+++ b/docs/modules/Mezzio.md
@@ -346,7 +346,7 @@ You can set additional cookie params like `domain`, `path` as array passed in la
* `param string` $uri
* `return void`
-Checks that the current URL doesn't equal the given string.
+Checks that the current URL (path) doesn't equal the given string.
Unlike `dontSeeInCurrentUrl`, this only matches the full URL.
@@ -364,13 +364,13 @@ $I->dontSeeCurrentUrlEquals('/');
* `param string` $uri
* `return void`
-Checks that current url doesn't match the given regular expression.
+Checks that current URL (path) doesn't match the given regular expression.
{% highlight php %}
dontSeeCurrentUrlMatches('~^/users/(\d+)~');
+$I->dontSeeCurrentUrlMatches('~^/users/\d+$~');
{% endhighlight %}
@@ -401,7 +401,7 @@ $I->dontSeeElement('input', ['value' => '123456']);
* `param string` $uri
* `return void`
-Checks that the current URI doesn't contain the given string.
+Checks that the current URI (path) doesn't contain the given string.
{% highlight php %}
@@ -874,14 +874,12 @@ $I->seeCookie('PHPSESSID');
* `param string` $uri
* `return void`
-Checks that the current URL is equal to the given string.
-
-Unlike `seeInCurrentUrl`, this only matches the full URL.
+Checks that the current URL (path) is equal to the given string.
{% highlight php %}
seeCurrentUrlEquals('/');
{% endhighlight %}
@@ -892,13 +890,12 @@ $I->seeCurrentUrlEquals('/');
* `param string` $uri
* `return void`
-Checks that the current URL matches the given regular expression.
+Checks that the current URL (path) matches the given regular expression.
{% highlight php %}
seeCurrentUrlMatches('~^/users/(\d+)~');
+$I->seeCurrentUrlMatches('~^/users/\d+$~');
{% endhighlight %}
@@ -1030,9 +1027,9 @@ $form = [
'checkbox1' => true,
// ...
];
-$I->submitForm('//form[@id=my-form]', string $form, 'submitButton');
+$I->submitForm('//form[@id=my-form]', $form, 'submitButton');
// $I->amOnPage('/path/to/form-page') may be needed
-$I->seeInFormFields('//form[@id=my-form]', string $form);
+$I->seeInFormFields('//form[@id=my-form]', $form);
{% endhighlight %}
diff --git a/docs/modules/PhpBrowser.md b/docs/modules/PhpBrowser.md
index f72e65c6f..e7733db84 100644
--- a/docs/modules/PhpBrowser.md
+++ b/docs/modules/PhpBrowser.md
@@ -26,13 +26,6 @@ Use to perform web acceptance tests with non-javascript browser.
If test fails stores last shown page in 'output' dir.
-### Status
-
-* Maintainer: **davert**
-* Stability: **stable**
-* Contact: codeception@codeception.com
-
-
### Configuration
* url *required* - start url of your app
@@ -46,28 +39,31 @@ If test fails stores last shown page in 'output' dir.
* .. those and other [Guzzle Request options](https://docs.guzzlephp.org/en/latest/request-options.html)
-#### Example (`acceptance.suite.yml`)
-
- modules:
- enabled:
- - PhpBrowser:
- url: 'http://localhost'
- auth: ['admin', '123345']
- curl:
- CURLOPT_RETURNTRANSFER: true
- cookies:
- cookie-1:
- Name: userName
- Value: john.doe
- cookie-2:
- Name: authToken
- Value: 1abcd2345
- Domain: subdomain.domain.com
- Path: /admin/
- Expires: 1292177455
- Secure: true
- HttpOnly: false
+#### Example (`Acceptance.suite.yml`)
+{% highlight yaml %}
+
+modules:
+ enabled:
+ - PhpBrowser:
+ url: 'http://localhost' # Internationalized domain names (IDN) need to be passed in punycode
+ auth: ['admin', '123345']
+ curl:
+ CURLOPT_RETURNTRANSFER: true
+ cookies:
+ cookie-1:
+ Name: userName
+ Value: john.doe
+ cookie-2:
+ Name: authToken
+ Value: 1abcd2345
+ Domain: subdomain.domain.com
+ Path: /admin/
+ Expires: 1292177455
+ Secure: true
+ HttpOnly: false
+
+{% endhighlight %}
All SSL certification checks are disabled by default.
Use Guzzle request options to configure certifications and others.
@@ -220,8 +216,8 @@ $this->getModule('PhpBrowser')->_savePageSource(codecept_output_dir().'page.html
#### amHttpAuthenticated
-* `param ` $username
-* `param ` $password
+* `param string` $username
+* `param string` $password
* `return void`
Authenticates user for HTTP_AUTH
@@ -247,7 +243,7 @@ $I->amOnPage('/register');
#### amOnSubdomain
-* `param ` $subdomain
+* `param string` $subdomain
* `return void`
Changes the subdomain for the 'url' configuration parameter.
@@ -270,7 +266,7 @@ $I->amOnPage('/');
#### amOnUrl
-* `param ` $url
+* `param string` $url
* `return void`
Open web page at the given absolute URL and sets its hostname as the base host.
@@ -426,7 +422,7 @@ You can set additional cookie params like `domain`, `path` as array passed in la
* `param string` $uri
* `return void`
-Checks that the current URL doesn't equal the given string.
+Checks that the current URL (path) doesn't equal the given string.
Unlike `dontSeeInCurrentUrl`, this only matches the full URL.
@@ -444,13 +440,13 @@ $I->dontSeeCurrentUrlEquals('/');
* `param string` $uri
* `return void`
-Checks that current url doesn't match the given regular expression.
+Checks that current URL (path) doesn't match the given regular expression.
{% highlight php %}
dontSeeCurrentUrlMatches('~^/users/(\d+)~');
+$I->dontSeeCurrentUrlMatches('~^/users/\d+$~');
{% endhighlight %}
@@ -481,7 +477,7 @@ $I->dontSeeElement('input', ['value' => '123456']);
* `param string` $uri
* `return void`
-Checks that the current URI doesn't contain the given string.
+Checks that the current URI (path) doesn't contain the given string.
{% highlight php %}
@@ -978,14 +974,12 @@ $I->seeCookie('PHPSESSID');
* `param string` $uri
* `return void`
-Checks that the current URL is equal to the given string.
-
-Unlike `seeInCurrentUrl`, this only matches the full URL.
+Checks that the current URL (path) is equal to the given string.
{% highlight php %}
seeCurrentUrlEquals('/');
{% endhighlight %}
@@ -996,13 +990,12 @@ $I->seeCurrentUrlEquals('/');
* `param string` $uri
* `return void`
-Checks that the current URL matches the given regular expression.
+Checks that the current URL (path) matches the given regular expression.
{% highlight php %}
seeCurrentUrlMatches('~^/users/(\d+)~');
+$I->seeCurrentUrlMatches('~^/users/\d+$~');
{% endhighlight %}
@@ -1134,9 +1127,9 @@ $form = [
'checkbox1' => true,
// ...
];
-$I->submitForm('//form[@id=my-form]', string $form, 'submitButton');
+$I->submitForm('//form[@id=my-form]', $form, 'submitButton');
// $I->amOnPage('/path/to/form-page') may be needed
-$I->seeInFormFields('//form[@id=my-form]', string $form);
+$I->seeInFormFields('//form[@id=my-form]', $form);
{% endhighlight %}
diff --git a/docs/modules/Symfony.md b/docs/modules/Symfony.md
index 86c8f8d8f..78666b6fe 100644
--- a/docs/modules/Symfony.md
+++ b/docs/modules/Symfony.md
@@ -41,7 +41,7 @@ and [HttpKernel Component](https://symfony.com/doc/current/components/http_kerne
* `kernel_class`: 'App\Kernel' - Kernel class name
* `em_service`: 'doctrine.orm.entity_manager' - Use the stated EntityManager to pair with Doctrine Module.
* `debug`: true - Turn on/off [debug mode](https://codeception.com/docs/Debugging)
-* `cache_router`: 'false' - Enable router caching between tests in order to [increase performance](http://lakion.com/blog/how-did-we-speed-up-sylius-behat-suite-with-blackfire)
+* `cache_router`: 'false' - Enable router caching between tests in order to [increase performance](http://lakion.com/blog/how-did-we-speed-up-sylius-behat-suite-with-blackfire) (can have an impact on ajax requests sending via '$I->sendAjaxPostRequest()')
* `rebootable_client`: 'true' - Reboot client's kernel before each request
* `guard`: 'false' - Enable custom authentication system with guard (only for Symfony 5.4)
* `bootstrap`: 'false' - Enable the test environment setup with the tests/bootstrap.php file if it exists or with Symfony DotEnv otherwise. If false, it does nothing.
@@ -92,7 +92,6 @@ modules:
If you're using Symfony with Eloquent ORM (instead of Doctrine), you can load the [`ORM` part of Laravel module](https://codeception.com/docs/modules/Laravel#Parts)
in addition to Symfony module.
-
### Actions
#### _findElements
@@ -322,6 +321,97 @@ $I->amOnRoute('posts.show', ['id' => 34]);
{% endhighlight %}
+#### assertBrowserCookieValueSame
+
+* `param string` $name
+* `param string` $expectedValue
+* `param bool` $raw
+* `param string` $path
+* `param ?string` $domain
+* `param string` $message
+* `return void`
+
+Asserts that the given cookie in the test client is set to the expected value.
+
+{% highlight php %}
+
+assertBrowserCookieValueSame('cookie_name', 'expected_value');
+
+{% endhighlight %}
+
+
+#### assertBrowserHasCookie
+
+* `param string` $name
+* `param string` $path
+* `param ?string` $domain
+* `param string` $message
+* `return void`
+
+Asserts that the test client has the specified cookie set.
+
+This indicates that the cookie was set by any response during the test.
+
+{% highlight yaml %}
+assertBrowserHasCookie('cookie_name');
+
+{% endhighlight %}
+
+
+#### assertBrowserNotHasCookie
+
+* `param string` $name
+* `param string` $path
+* `param ?string` $domain
+* `param string` $message
+* `return void`
+
+Asserts that the test client does not have the specified cookie set.
+
+This indicates that the cookie was not set by any response during the test.
+
+{% highlight php %}
+
+assertBrowserNotHasCookie('cookie_name');
+
+{% endhighlight %}
+
+
+#### assertCheckboxChecked
+
+* `param string` $fieldName
+* `param string` $message
+* `return void`
+
+Asserts that the checkbox with the given name is checked.
+
+{% highlight php %}
+
+assertCheckboxChecked('agree_terms');
+
+{% endhighlight %}
+
+
+#### assertCheckboxNotChecked
+
+* `param string` $fieldName
+* `param string` $message
+* `return void`
+
+Asserts that the checkbox with the given name is not checked.
+
+{% highlight php %}
+
+assertCheckboxNotChecked('subscribe');
+
+{% endhighlight %}
+
+
#### assertEmailAddressContains
* `param string` $headerName
@@ -360,6 +450,23 @@ $I->assertEmailAttachmentCount(1);
{% endhighlight %}
+#### assertEmailCount
+
+* `param int` $count
+* `param ?string` $transport
+* `param string` $message
+* `return void`
+
+Asserts that the expected number of emails was sent.
+
+{% highlight php %}
+
+assertEmailCount(2, 'smtp');
+
+{% endhighlight %}
+
+
#### assertEmailHasHeader
* `param string` $headerName
@@ -385,125 +492,827 @@ $I->assertEmailHasHeader('Bcc');
* `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`.
+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 %}
+
+assertEmailHeaderNotSame('To', 'john_doe@gmail.com');
+
+{% endhighlight %}
+
+
+#### 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 %}
+
+assertEmailHeaderSame('To', 'jane_doe@gmail.com');
+
+{% endhighlight %}
+
+
+#### 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 %}
+
+assertEmailHtmlBodyContains('Successful registration');
+
+{% endhighlight %}
+
+
+#### 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 %}
+
+assertEmailHtmlBodyNotContains('userpassword');
+
+{% endhighlight %}
+
+
+#### assertEmailIsNotQueued
+
+* `param \Symfony\Component\Mailer\Event\MessageEvent` $event
+* `param string` $message
+* `return void`
+
+Asserts that the given mailer event is not queued.
+
+Use `getMailerEvent(int $index = 0, ?string $transport = null)` to retrieve a mailer event by index.
+
+{% highlight php %}
+
+getMailerEvent();
+$I->assertEmailIsNotQueued($event);
+
+{% endhighlight %}
+
+
+#### assertEmailIsQueued
+
+* `param \Symfony\Component\Mailer\Event\MessageEvent` $event
+* `param string` $message
+* `return void`
+
+Asserts that the given mailer event is queued.
+
+Use `getMailerEvent(int $index = 0, ?string $transport = null)` to retrieve a mailer event by index.
+
+{% highlight php %}
+
+getMailerEvent();
+$I->assertEmailIsQueued($event);
+
+{% endhighlight %}
+
+
+#### 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 %}
+
+assertEmailNotHasHeader('Bcc');
+
+{% endhighlight %}
+
+
+#### 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 %}
+
+assertEmailTextBodyContains('Example text body');
+
+{% endhighlight %}
+
+
+#### 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 %}
+
+assertEmailTextBodyNotContains('My secret text body');
+
+{% endhighlight %}
+
+
+#### assertFormValue
+
+* `param string` $formSelector
+* `param string` $fieldName
+* `param string` $value
+* `param string` $message
+* `return void`
+
+Asserts that value of the field of the first form matching the given selector does equal the expected value.
+
+{% highlight php %}
+
+assertFormValue('#loginForm', 'username', 'john_doe');
+
+{% endhighlight %}
+
+
+#### assertHttpClientRequest
+
+* `param string` $expectedUrl
+* `param string` $expectedMethod
+* `param string|array|null` $expectedBody
+* `param array` $expectedHeaders
+* `param string` $httpClientId
+* `return void`
+
+Asserts that the given URL has been called using, if specified, the given method, body and/or headers.
+
+By default, it will inspect the default Symfony HttpClient; you may check a different one by passing its
+service-id in $httpClientId.
+It succeeds even if the request was executed multiple times.
+
+{% highlight php %}
+
+assertHttpClientRequest(
+ 'https://example.com/api',
+ 'POST',
+ '{"data": "value"}',
+ ['Authorization' => 'Bearer token']
+);
+
+{% endhighlight %}
+
+
+#### assertHttpClientRequestCount
+
+* `param int` $count
+* `param string` $httpClientId
+* `return void`
+
+Asserts that exactly $count requests have been executed by the given HttpClient.
+
+By default, it will inspect the default Symfony HttpClient; you may check a different one by passing its
+service-id in $httpClientId.
+
+{% highlight php %}
+
+$I->assertHttpClientRequestCount(3);
+
+{% endhighlight %}
+
+
+#### assertInputValueNotSame
+
+* `param string` $fieldName
+* `param string` $expectedValue
+* `param string` $message
+* `return void`
+
+Asserts that the value of the form input with the given name does not equal the expected value.
+
+{% highlight php %}
+
+assertInputValueNotSame('username', 'admin');
+
+{% endhighlight %}
+
+
+#### assertInputValueSame
+
+* `param string` $fieldName
+* `param string` $expectedValue
+* `param string` $message
+* `return void`
+
+Asserts that the value of the form input with the given name equals the expected value.
+
+{% highlight php %}
+
+assertInputValueSame('username', 'johndoe');
+
+{% endhighlight %}
+
+
+#### assertNoFormValue
+
+* `param string` $formSelector
+* `param string` $fieldName
+* `param string` $message
+* `return void`
+
+Asserts that the field of the first form matching the given selector does not have a value.
+
+{% highlight php %}
+
+assertNoFormValue('#registrationForm', 'middle_name');
+
+{% endhighlight %}
+
+
+#### assertNotHttpClientRequest
+
+* `param string` $unexpectedUrl
+* `param string` $unexpectedMethod
+* `param string` $httpClientId
+* `return void`
+
+Asserts that the given URL *has not* been requested with the supplied HTTP method.
+
+By default, it will inspect the default Symfony HttpClient; you may check a different one by passing its
+service-id in $httpClientId.
+{% highlight php %}
+
+$I->assertNotHttpClientRequest('https://example.com/unexpected', 'GET');
+
+{% endhighlight %}
+
+
+#### assertNotificationCount
+
+* `param int` $count
+* `param ?string` $transportName
+* `param string` $message
+* `return void`
+
+Asserts that the expected number of notifications was sent.
+
+{% highlight php %}
+
+assertNotificationCount(2, 'smtp');
+
+{% endhighlight %}
+
+
+#### assertNotificationIsNotQueued
+
+* `param \Symfony\Component\Notifier\Event\MessageEvent` $event
+* `param string` $message
+* `return void`
+
+Asserts that the given notifier event is not queued.
+
+Use `getNotifierEvent(int $index = 0, ?string $transportName = null)` to retrieve a notifier event by index.
+
+{% highlight php %}
+
+getNotifierEvent();
+$I->asserNotificationIsNotQueued($event);
+
+{% endhighlight %}
+
+
+#### assertNotificationIsQueued
+
+* `param \Symfony\Component\Notifier\Event\MessageEvent` $event
+* `param string` $message
+* `return void`
+
+Asserts that the given notifier event is queued.
+
+Use `getNotifierEvent(int $index = 0, ?string $transportName = null)` to retrieve a notifier event by index.
+
+{% highlight php %}
+
+getNotifierEvent();
+$I->assertNotificationlIsQueued($event);
+
+{% endhighlight %}
+
+
+#### assertNotificationSubjectContains
+
+* `param \Symfony\Component\Notifier\Message\MessageInterface` $notification
+* `param string` $text
+* `param string` $message
+* `return void`
+
+Asserts that the given notification contains given subject.
+
+Use `getNotifierMessage(int $index = 0, ?string $transportName = null)` to retrieve a notification by index.
+
+{% highlight php %}
+
+getNotifierMessage();
+$I->assertNotificationSubjectContains($notification, 'Subject');
+
+{% endhighlight %}
+
+
+#### assertNotificationSubjectNotContains
+
+* `param \Symfony\Component\Notifier\Message\MessageInterface` $notification
+* `param string` $text
+* `param string` $message
+* `return void`
+
+Asserts that the given notification does not contain given subject.
+
+Use `getNotifierMessage(int $index = 0, ?string $transportName = null)` to retrieve a notification by index.
+
+{% highlight php %}
+
+getNotifierMessage();
+$I->assertNotificationSubjectNotContains($notification, 'Subject');
+
+{% endhighlight %}
+
+
+#### assertNotificationTransportIsEqual
+
+* `param \Symfony\Component\Notifier\Message\MessageInterface` $notification
+* `param ?string` $transportName
+* `param string` $message
+* `return void`
+
+Asserts that the given notification uses given transport.
+
+Use `getNotifierMessage(int $index = 0, ?string $transportName = null)` to retrieve a notification by index.
+
+{% highlight php %}
+
+getNotifierMessage();
+$I->assertNotificationTransportIsEqual($notification, 'chat');
+
+{% endhighlight %}
+
+
+#### assertNotificationTransportIsNotEqual
+
+* `param \Symfony\Component\Notifier\Message\MessageInterface` $notification
+* `param ?string` $transportName
+* `param string` $message
+* `return void`
+
+Asserts that the given notification does not use given transport.
+
+Use `getNotifierMessage(int $index = 0, ?string $transportName = null)` to retrieve a notification by index.
+
+{% highlight php %}
+
+getNotifierMessage();
+$I->assertNotificationTransportIsNotEqual($notification, 'transport');
+
+{% endhighlight %}
+
+
+#### assertPageTitleContains
+
+* `param string` $expectedTitle
+* `param string` $message
+* `return void`
+
+Asserts that the `` element contains the given title.
+
+{% highlight php %}
+
+assertPageTitleContains('Welcome');
+
+{% endhighlight %}
+
+
+#### assertPageTitleSame
+
+* `param string` $expectedTitle
+* `param string` $message
+* `return void`
+
+Asserts that the `` element equals the given title.
+
+{% highlight php %}
+
+assertPageTitleSame('Home Page');
+
+{% endhighlight %}
+
+
+#### assertQueuedEmailCount
+
+* `param int` $count
+* `param ?string` $transport
+* `param string` $message
+* `return void`
+
+Asserts that the expected number of emails was queued (e.g. using the Messenger component).
+
+{% highlight php %}
+
+assertQueuedEmailCount(1, 'smtp');
+
+{% endhighlight %}
+
+
+#### assertQueuedNotificationCount
+
+* `param int` $count
+* `param ?string` $transportName
+* `param string` $message
+* `return void`
+
+Asserts that the expected number of notifications was queued (e.g. using the Notifier component).
+
+{% highlight php %}
+
+assertQueuedNotificationCount(1, 'smtp');
+
+{% endhighlight %}
+
+
+#### assertRequestAttributeValueSame
+
+* `param string` $name
+* `param string` $expectedValue
+* `param string` $message
+* `return void`
+
+Asserts that the specified request attribute matches the expected value.
+
+{% highlight php %}
+
+assertRequestAttributeValueSame('attribute_name', 'expected_value');
+
+{% endhighlight %}
+
+
+#### assertResponseCookieValueSame
+
+* `param string` $name
+* `param string` $expectedValue
+* `param string` $path
+* `param ?string` $domain
+* `param string` $message
+* `return void`
+
+Asserts that the specified response cookie is present and matches the expected value.
+
+{% highlight php %}
+
+assertResponseCookieValueSame('cookie_name', 'expected_value');
+
+{% endhighlight %}
+
+
+#### assertResponseFormatSame
+
+* `param ?string` $expectedFormat
+* `param string` $message
+* `return void`
+
+Asserts that the response format matches the expected format. This checks the format returned by the `Response::getFormat()` method.
+
+{% highlight php %}
+
+assertResponseFormatSame('json');
+
+{% endhighlight %}
+
+
+#### assertResponseHasCookie
+
+* `param string` $name
+* `param string` $path
+* `param ?string` $domain
+* `param string` $message
+* `return void`
+
+Asserts that the specified cookie is present in the response. Optionally, it can check for a specific cookie path or domain.
+
+{% highlight php %}
+
+assertResponseHasCookie('cookie_name');
+
+{% endhighlight %}
+
+
+#### assertResponseHasHeader
+
+* `param string` $headerName
+* `param string` $message
+* `return void`
+
+Asserts that the specified header is available in the response.
+
+For example, use `assertResponseHasHeader('content-type');`.
+
+{% highlight php %}
+
+assertResponseHasHeader('content-type');
+
+{% endhighlight %}
+
+
+#### assertResponseHeaderNotSame
+
+* `param string` $headerName
+* `param string` $expectedValue
+* `param string` $message
+* `return void`
+
+Asserts that the specified header does not contain the expected value in the response.
+
+For example, use `assertResponseHeaderNotSame('content-type', 'application/octet-stream');`.
+
+{% highlight php %}
+
+assertResponseHeaderNotSame('content-type', 'application/json');
+
+{% endhighlight %}
+
+
+#### assertResponseHeaderSame
+
+* `param string` $headerName
+* `param string` $expectedValue
+* `param string` $message
+* `return void`
+
+Asserts that the specified header contains the expected value in the response.
+
+For example, use `assertResponseHeaderSame('content-type', 'application/octet-stream');`.
+
+{% highlight php %}
+
+assertResponseHeaderSame('content-type', 'application/json');
+
+{% endhighlight %}
+
+
+#### assertResponseIsSuccessful
+
+* `param string` $message
+* `param bool` $verbose
+* `return void`
+
+Asserts that the response was successful (HTTP status code is in the 2xx range).
+
+{% highlight php %}
+
+assertResponseIsSuccessful();
+
+{% endhighlight %}
+
+
+#### assertResponseIsUnprocessable
+
+* `param string` $message
+* `param bool` $verbose
+* `return void`
+
+Asserts that the response is unprocessable (HTTP status code is 422).
+
+{% highlight php %}
+
+assertResponseIsUnprocessable();
+
+{% endhighlight %}
+
+
+#### assertResponseNotHasCookie
+
+* `param string` $name
+* `param string` $path
+* `param ?string` $domain
+* `param string` $message
+* `return void`
+
+Asserts that the specified cookie is not present in the response. Optionally, it can check for a specific cookie path or domain.
+
+{% highlight php %}
+
+assertResponseNotHasCookie('cookie_name');
+
+{% endhighlight %}
+
+
+#### assertResponseNotHasHeader
+
+* `param string` $headerName
+* `param string` $message
+* `return void`
+
+Asserts that the specified header is not available in the response.
+
+{% highlight php %}
+
+assertResponseNotHasHeader('content-type');
+
+{% endhighlight %}
+
+
+#### assertResponseRedirects
+
+* `param ?string` $expectedLocation
+* `param ?int` $expectedCode
+* `param string` $message
+* `param bool` $verbose
+* `return void`
+
+Asserts that the response is a redirect. Optionally, you can check the target location and status code.
+
+The expected location can be either an absolute or a relative path.
+
+{% highlight php %}
+
+assertResponseRedirects('/login', 302);
+
+{% endhighlight %}
+
-If the Email object is not specified, the last email sent is used instead.
+#### assertResponseStatusCodeSame
+
+* `param int` $expectedCode
+* `param string` $message
+* `param bool` $verbose
+* `return void`
+
+Asserts that the response status code matches the expected code.
{% highlight php %}
assertEmailHeaderNotSame('To', 'john_doe@gmail.com');
+$I->assertResponseStatusCodeSame(200);
{% endhighlight %}
-#### assertEmailHeaderSame
+#### assertRouteSame
-* `param string` $headerName
-* `param string` $expectedValue
-* `param ?\Symfony\Component\Mime\Email` $email
+* `param string` $expectedRoute
+* `param array` $parameters
+* `param string` $message
* `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.
+Asserts the request matches the given route and optionally route parameters.
{% highlight php %}
assertEmailHeaderSame('To', 'jane_doe@gmail.com');
+$I->assertRouteSame('profile', ['id' => 123]);
{% endhighlight %}
-#### assertEmailHtmlBodyContains
+#### assertSelectorExists
-* `param string` $text
-* `param ?\Symfony\Component\Mime\Email` $email
+* `param string` $selector
+* `param string` $message
* `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.
+Asserts that the given selector matches at least one element in the response.
{% highlight php %}
assertEmailHtmlBodyContains('Successful registration');
+$I->assertSelectorExists('.main-content');
{% endhighlight %}
-#### assertEmailHtmlBodyNotContains
+#### assertSelectorNotExists
-* `param string` $text
-* `param ?\Symfony\Component\Mime\Email` $email
+* `param string` $selector
+* `param string` $message
* `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.
+Asserts that the given selector does not match at least one element in the response.
{% highlight php %}
assertEmailHtmlBodyNotContains('userpassword');
+$I->assertSelectorNotExists('.error');
{% endhighlight %}
-#### assertEmailNotHasHeader
+#### assertSelectorTextContains
-* `param string` $headerName
-* `param ?\Symfony\Component\Mime\Email` $email
+* `param string` $selector
+* `param string` $text
+* `param string` $message
* `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.
+Asserts that the first element matching the given selector contains the expected text.
{% highlight php %}
assertEmailNotHasHeader('Bcc');
+$I->assertSelectorTextContains('h1', 'Dashboard');
{% endhighlight %}
-#### assertEmailTextBodyContains
+#### assertSelectorTextNotContains
+* `param string` $selector
* `param string` $text
-* `param ?\Symfony\Component\Mime\Email` $email
+* `param string` $message
* `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.
+Asserts that the first element matching the given selector does not contain the expected text.
{% highlight php %}
assertEmailTextBodyContains('Example text body');
+$I->assertSelectorTextNotContains('p', 'error');
{% endhighlight %}
-#### assertEmailTextBodyNotContains
+#### assertSelectorTextSame
+* `param string` $selector
* `param string` $text
-* `param ?\Symfony\Component\Mime\Email` $email
+* `param string` $message
* `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.
+Asserts that the text of the first element matching the given selector equals the expected text.
{% highlight php %}
assertEmailTextBodyNotContains('My secret text body');
+$I->assertSelectorTextSame('h1', 'Dashboard');
{% endhighlight %}
@@ -664,7 +1473,7 @@ You can set additional cookie params like `domain`, `path` as array passed in la
* `param string` $uri
* `return void`
-Checks that the current URL doesn't equal the given string.
+Checks that the current URL (path) doesn't equal the given string.
Unlike `dontSeeInCurrentUrl`, this only matches the full URL.
@@ -682,13 +1491,29 @@ $I->dontSeeCurrentUrlEquals('/');
* `param string` $uri
* `return void`
-Checks that current url doesn't match the given regular expression.
+Checks that current URL (path) doesn't match the given regular expression.
{% highlight php %}
dontSeeCurrentUrlMatches('~^/users/(\d+)~');
+$I->dontSeeCurrentUrlMatches('~^/users/\d+$~');
+
+{% endhighlight %}
+
+
+#### dontSeeDeprecations
+
+* `param string` $message Optional custom failure message.
+* `return void`
+
+Asserts that there are no deprecation messages in Symfony's log.
+
+{% highlight php %}
+
+amOnPage('/home');
+$I->dontSeeDeprecations();
{% endhighlight %}
@@ -721,42 +1546,47 @@ $I->dontSeeElement('input', ['value' => '123456']);
Checks that no email was sent.
The check is based on `\Symfony\Component\Mailer\EventListener\MessageLoggerListener`, which means:
-If your app performs an HTTP redirect, you need to suppress it using [stopFollowingRedirects()](https://codeception.com/docs/modules/Symfony#stopFollowingRedirects) first; otherwise this check will *always* pass.
+If your app performs an HTTP redirect, you need to suppress it using [stopFollowingRedirects()](#stopFollowingRedirects) first; otherwise this check will *always* pass.
+
+{% highlight php %}
+
+dontSeeEmailIsSent();
+
+{% endhighlight %}
#### dontSeeEvent
-* `param string|string[]|null` $expected
+* `param class-string|list|null` $expected Fully-qualified event class(es) that must **not** appear.
* `return void`
-Verifies that there were no events during the test.
-
-Both regular and orphan events are checked.
+Verifies that **no** events (regular **or** orphan) were dispatched during the test.
{% highlight php %}
- dontSeeEvent();
- $I->dontSeeEvent('App\MyEvent');
- $I->dontSeeEvent(['App\MyEvent', 'App\MyOtherEvent']);
-
+dontSeeEvent();
+$I->dontSeeEvent('App\MyEvent');
+$I->dontSeeEvent(['App\MyEvent', 'App\MyOtherEvent']);
+
{% endhighlight %}
#### dontSeeEventListenerIsCalled
-* `param class-string|class-string[]` $expected
-* `param string|string[]` $events
+* `param class-string|object|list` $expected Listeners (class-strings or object instances).
+* `param string|list` $events Event name(s) (empty = any).
* `return void`
-Verifies that one or more event listeners were not called during the test.
+Verifies that one or more **listeners** were **not** called during the test.
{% highlight php %}
dontSeeEventListenerIsCalled('App\MyEventListener');
$I->dontSeeEventListenerIsCalled(['App\MyEventListener', 'App\MyOtherEventListener']);
-$I->dontSeeEventListenerIsCalled('App\MyEventListener', 'my.event);
+$I->dontSeeEventListenerIsCalled('App\MyEventListener', 'my.event');
$I->dontSeeEventListenerIsCalled('App\MyEventListener', ['my.event', 'my.other.event']);
{% endhighlight %}
@@ -765,7 +1595,7 @@ $I->dontSeeEventListenerIsCalled('App\MyEventListener', ['my.event', 'my.other.e
#### dontSeeEventTriggered
@deprecated
-* `param object|string|string[]` $expected
+* `param class-string|object|list` $expected
* `return void`
Verifies that one or more event listeners were not called during the test.
@@ -780,6 +1610,20 @@ $I->dontSeeEventTriggered(['App\MyEvent', 'App\MyOtherEvent']);
{% endhighlight %}
+#### dontSeeFallbackTranslations
+
+* `return void`
+
+Asserts that no fallback translations were found.
+
+{% highlight php %}
+
+dontSeeFallbackTranslations();
+
+{% endhighlight %}
+
+
#### dontSeeFormErrors
* `return void`
@@ -799,7 +1643,7 @@ $I->dontSeeFormErrors();
* `param string` $uri
* `return void`
-Checks that the current URI doesn't contain the given string.
+Checks that the current URI (path) doesn't contain the given string.
{% highlight php %}
@@ -939,6 +1783,37 @@ $I->dontSeeLink('Checkout now', '/store/cart.php');
{% endhighlight %}
+#### dontSeeMissingTranslations
+
+* `return void`
+
+Asserts that no missing translations were found.
+
+{% highlight php %}
+
+dontSeeMissingTranslations();
+
+{% endhighlight %}
+
+
+#### dontSeeNotificationIsSent
+
+* `return void`
+
+Checks that no notification was sent.
+
+The check is based on `\Symfony\Component\Notifier\EventListener\NotificationLoggerListener`, which means:
+If your app performs an HTTP redirect, you need to suppress it using [stopFollowingRedirects()](#stopFollowingRedirects) first; otherwise this check will *always* pass.
+
+{% highlight php %}
+
+dontSeeNotificationIsSent();
+
+{% endhighlight %}
+
+
#### dontSeeOptionIsSelected
* `param ` $selector
@@ -957,14 +1832,14 @@ $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa');
#### dontSeeOrphanEvent
-* `param string|string[]` $expected
+* `param class-string|list|null` $expected Event class(es) that must **not** appear as orphan.
* `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
-[`dispatch()`](https://symfony.com/doc/current/components/event_dispatcher.html#dispatch-the-event) method
-of the EventDispatcher but was not handled by any listener after it was dispatched.
+{@link https://symfony.com/doc/current/components/event_dispatcher.html#dispatch-the-event dispatch()}
+method of the EventDispatcher but was not handled by any listener after it was dispatched.
{% highlight php %}
@@ -1025,7 +1900,7 @@ $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK);
#### dontSeeViolatedConstraint
-* `param mixed` $subject
+* `param object` $subject
* `param ?string` $propertyPath
* `param ?string` $constraint
* `return void`
@@ -1075,6 +1950,66 @@ $I->followRedirect();
{% endhighlight %}
+#### getMailerEvent
+
+* `param int` $index
+* `param ?string` $transport
+* `return ?\Symfony\Component\Mailer\Event\MessageEvent`
+
+Returns the mailer event at the specified index.
+
+{% highlight php %}
+
+getMailerEvent();
+
+{% endhighlight %}
+
+
+#### getNotifierEvent
+
+* `param int` $index
+* `param ?string` $transportName
+* `return ?\Symfony\Component\Notifier\Event\MessageEvent`
+
+Returns the notifier event at the specified index.
+
+{% highlight php %}
+
+getNotifierEvent();
+
+{% endhighlight %}
+
+
+#### getNotifierEvents
+
+* `param ?string` $transportName
+* `return MessageEvent[]`
+
+
+#### getNotifierMessage
+
+* `param int` $index
+* `param ?string` $transportName
+* `return ?\Symfony\Component\Notifier\Message\MessageInterface`
+
+Returns the notifier message at the specified index.
+
+{% highlight php %}
+
+getNotifierMessage();
+
+{% endhighlight %}
+
+
+#### getNotifierMessages
+
+* `param ?string` $transportName
+* `return MessageInterface[]`
+
+
#### goToLogoutPath
* `return void`
@@ -1116,6 +2051,20 @@ You can set additional cookie params like `domain`, `path` in array passed as la
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)`.
+#### grabDefinedTranslationsCount
+
+* `return int` The count of defined translations.
+
+Grabs the count of defined translations.
+
+{% highlight php %}
+
+grabDefinedTranslations();
+
+{% endhighlight %}
+
+
#### grabFromCurrentUrl
* `param ?string` $uri
@@ -1141,7 +2090,7 @@ $uri = $I->grabFromCurrentUrl();
Returns the last sent email.
The function is based on `\Symfony\Component\Mailer\EventListener\MessageLoggerListener`, which means:
-If your app performs an HTTP redirect after sending the email, you need to suppress it using [stopFollowingRedirects()](https://codeception.com/docs/modules/Symfony#stopFollowingRedirects) first.
+If your app performs an HTTP redirect after sending the email, you need to suppress it using [stopFollowingRedirects()](#stopFollowingRedirects) first.
See also: [grabSentEmails()](https://codeception.com/docs/modules/Symfony#grabSentEmails)
{% highlight php %}
@@ -1154,6 +2103,25 @@ $I->assertSame('john_doe@example.com', $address->getAddress());
{% endhighlight %}
+#### grabLastSentNotification
+
+* `return ?\Symfony\Component\Notifier\Message\MessageInterface`
+
+Returns the last sent notification.
+
+The check is based on `\Symfony\Component\Notifier\EventListener\NotificationLoggerListener`, which means:
+If your app performs an HTTP redirect after sending the notification, you need to suppress it using [stopFollowingRedirects()](#stopFollowingRedirects) first.
+See also: [grabSentNotifications()](https://codeception.com/docs/modules/Symfony#grabSentNotifications)
+
+{% highlight php %}
+
+grabLastSentNotification();
+$I->assertSame('Subject', $message->getSubject());
+
+{% endhighlight %}
+
+
#### grabMultiple
* `param ` $cssOrXpath
@@ -1185,17 +2153,17 @@ $aLinks = $I->grabMultiple('a', 'href');
#### grabNumRecords
-* `param string` $entityClass The entity class
-* `param array` $criteria Optional query criteria
+* `param class-string