Skip to content

Commit db981ab

Browse files
authored
Fix last commit error (#73)
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)) ... ```
1 parent 8ec469b commit db981ab

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/Codeception/Module/Yii2.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,7 @@ public function _after(TestInterface $test)
397397

398398
public function _failed(TestInterface $test, $fail)
399399
{
400-
$log = $this->yiiLogger->getAndClearLog();
401-
if (! empty($log)) {
400+
if ($this->yiiLogger && $log = $this->yiiLogger->getAndClearLog()) {
402401
$test->getMetadata()->addReport('yii-log', $log);
403402
}
404403

0 commit comments

Comments
 (0)