Skip to content

Commit

Permalink
Fix last commit error (#73)
Browse files Browse the repository at this point in the history
Fix last commit error:
```shell
Exception 'Error' with message 'Call to a member function getAndClearLog() on null' in /srv/www/app/vendor/codeception/module-yii2/src/Codeception/Module/Yii2.php:400

Stack trace:
#0 /srv/www/app/vendor/codeception/codeception/src/Codeception/Subscriber/Module.php(90): Codeception\Module\Yii2->_failed(Object(Codeception\Test\TestCaseWrapper), Object(PHPUnit\Framework\ExpectationFailedException))
#1 /srv/www/app/vendor/symfony/event-dispatcher/EventDispatcher.php(230): Codeception\Subscriber\Module->failed(Object(Codeception\Event\FailEvent), 'test.fail', Object(Symfony\Component\EventDispatcher\EventDispatcher))
...
```
  • Loading branch information
sunnyphp authored Aug 22, 2022
1 parent 8ec469b commit db981ab
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Codeception/Module/Yii2.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,7 @@ public function _after(TestInterface $test)

public function _failed(TestInterface $test, $fail)
{
$log = $this->yiiLogger->getAndClearLog();
if (! empty($log)) {
if ($this->yiiLogger && $log = $this->yiiLogger->getAndClearLog()) {
$test->getMetadata()->addReport('yii-log', $log);
}

Expand Down

0 comments on commit db981ab

Please sign in to comment.