Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/Customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -548,5 +548,15 @@ It is possible to run specific suites from included applications:
* `codecept run Unit,*::Unit` ⬅ Runs included unit suites AND root unit suite
* `codecept run Functional,*::Unit` ⬅ Runs included unit suites and root functional suite

Depending if you run just a single file or the entire suite(s), Codeception will inject `App\Tests\Support\UnitTester` or your bundle's
`MyBundle\Tests\Support\UnitTester` into your `*Test.php` files. This might lead to an error message like:

> [TypeError] Cannot assign MyBundle\Tests\Support\UnitTester to property MyBundle\Tests\Unit\MyTest::$tester of type App\Tests\Support\UnitTester

The simplest way to deal with this is to just add both runners as a union type hint:
```php
<?php
protected \MyBundle\Tests\Support\UnitTester|\App\Tests\Support\UnitTester $tester;
```

<div class="alert alert-warning"><a href="https://github.com/Codeception/codeception.github.com/edit/master/docs/Customization.md"><strong>Improve</strong> this guide</a></div>