FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Update Customization.md: Adding solution to inject `UnitTester` into bundle by ThomasLandauer · Pull Request #903 · Codeception/codeception.github.com · GitHub

Repository navigation

Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .md  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
10 changes: 10 additions & 0 deletions docs/Customization.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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>

Back | FazBrowse Home | New Git URL