Codeception 2.4.1 breakage


(Scottix) #1

I found a bug in the new Codeception module 2.4.1

When running a series of tests it fails on the second one. Seems like Schema is using the Yii::$app when querying cache.

I was able to fix it by setting

‘enableSchemaCache’ => false,

in our test database settings.




Error: Call to a member function get() on null in /srv/www/xyzweb/src/private/protected/vendor/yiisoft/yii2/db/Schema.php:734

Stack trace:

#0 /srv/www/xyzweb/src/private/protected/vendor/yiisoft/yii2/db/Schema.php(194): yii\db\Schema->getTableMetadata('users', 'schema', false)

#1 /srv/www/xyzweb/src/private/protected/vendor/yiisoft/yii2/db/Connection.php(858): yii\db\Schema->getTableSchema('users', false)

#2 /srv/www/xyzweb/src/private/protected/vendor/yiisoft/yii2/db/pgsql/QueryBuilder.php(169): yii\db\Connection->getTableSchema('users')

#3 /srv/www/xyzweb/src/private/protected/vendor/yiisoft/yii2/db/Command.php(943): yii\db\pgsql\QueryBuilder->resetSequence('users', 1)

#4 /srv/www/xyzweb/src/private/protected/vendor/yiisoft/yii2/test/ActiveFixture.php(128): yii\db\Command->resetSequence('users', 1)

#5 /srv/www/xyzweb/src/private/protected/vendor/yiisoft/yii2/test/ActiveFixture.php(115): yii\test\ActiveFixture->resetTable()

#6 /srv/www/xyzweb/src/private/protected/vendor/yiisoft/yii2/test/FixtureTrait.php(121): yii\test\ActiveFixture->unload()

#7 /srv/www/xyzweb/src/private/protected/vendor/codeception/codeception/src/Codeception/Module/Yii2.php(310): Codeception\Lib\Connector\Yii2\FixturesStore->unloadFixtures()

#8 /srv/www/xyzweb/src/private/protected/vendor/codeception/codeception/src/Codeception/Subscriber/Module.php(66): Codeception\Module\Yii2->_after(Object(components\xyzManagerTest))

#9 /srv/www/xyzweb/src/private/protected/vendor/symfony/event-dispatcher/EventDispatcher.php(212): Codeception\Subscriber\Module->after(Object(Codeception\Event\TestEvent), 'test.after', Object(Symfony\Component\EventDispatcher\EventDispatcher))

#10 /srv/www/xyzweb/src/private/protected/vendor/symfony/event-dispatcher/EventDispatcher.php(44): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'test.after', Object(Codeception\Event\TestEvent))

#11 /srv/www/xyzweb/src/private/protected/vendor/codeception/phpunit-wrapper/src/Listener.php(133): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('test.after', Object(Codeception\Event\TestEvent))

#12 /srv/www/xyzweb/src/private/protected/vendor/codeception/phpunit-wrapper/src/Listener.php(119): Codeception\PHPUnit\Listener->fire('test.after', Object(Codeception\Event\TestEvent))

#13 /srv/www/xyzweb/src/private/protected/vendor/phpunit/phpunit/src/Framework/TestResult.php(408): Codeception\PHPUnit\Listener->endTest(Object(components\xyzManagerTest), 0.19835591316223)

#14 /srv/www/xyzweb/src/private/protected/vendor/phpunit/phpunit/src/Framework/TestResult.php(895): PHPUnit\Framework\TestResult->endTest(Object(components\xyzManagerTest), 0.19835591316223)

#15 /srv/www/xyzweb/src/private/protected/vendor/phpunit/phpunit/src/Framework/TestCase.php(894): PHPUnit\Framework\TestResult->run(Object(components\xyzManagerTest))

#16 /srv/www/xyzweb/src/private/protected/vendor/phpunit/phpunit/src/Framework/TestSuite.php(755): PHPUnit\Framework\TestCase->run(Object(PHPUnit\Framework\TestResult))

#17 /srv/www/xyzweb/src/private/protected/vendor/codeception/phpunit-wrapper/src/Runner.php(106): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))

#18 /srv/www/xyzweb/src/private/protected/vendor/codeception/codeception/src/Codeception/SuiteManager.php(157): Codeception\PHPUnit\Runner->doEnhancedRun(Object(Codeception\Suite), Object(PHPUnit\Framework\TestResult), Array)

#19 /srv/www/xyzweb/src/private/protected/vendor/codeception/codeception/src/Codeception/Codecept.php(189): Codeception\SuiteManager->run(Object(Codeception\PHPUnit\Runner), Object(PHPUnit\Framework\TestResult), Array)

#20 /srv/www/xyzweb/src/private/protected/vendor/codeception/codeception/src/Codeception/Codecept.php(158): Codeception\Codecept->runSuite(Array, 'unit', NULL)

#21 /srv/www/xyzweb/src/private/protected/vendor/codeception/codeception/src/Codeception/Command/Run.php(466): Codeception\Codecept->run('unit')

#22 /srv/www/xyzweb/src/private/protected/vendor/codeception/codeception/src/Codeception/Command/Run.php(361): Codeception\Command\Run->runSuites(Array, Array)

#23 /srv/www/xyzweb/src/private/protected/vendor/symfony/console/Command/Command.php(252): Codeception\Command\Run->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

#24 /srv/www/xyzweb/src/private/protected/vendor/symfony/console/Application.php(946): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

#25 /srv/www/xyzweb/src/private/protected/vendor/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(Codeception\Command\Run), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

#26 /srv/www/xyzweb/src/private/protected/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

#27 /srv/www/xyzweb/src/private/protected/vendor/codeception/codeception/src/Codeception/Application.php(108): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

#28 /srv/www/xyzweb/src/private/protected/vendor/codeception/codeception/codecept(42): Codeception\Application->run()




(Alexander Makarov) #2

Should be fixed in master of Codeception already…