You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the return GeneralConfig::create(); syntax in tests/_craft/config/general.php throws an error when running Codeception tests on a fresh Craft-CSM 4.2 installation.
Steps to reproduce
Get a fresh Craft-CMS 4.3 installation I downloaded the zip file from the Installation Instructions to get up and running inside a DDEV project.
Install Codeception ^4.1 with composer require codeception/codeception:^4.1 --dev Codeception ^3.1 is not compatible with PHP 8, and I did not manage to setup Craft-CMS tests with Codeception ^5.0.
Follow steps to Setup Tests for Craft-CMS from the documentation To run the example unit test (steps 4-5), I had to un composer require codeception/module-yii2:^1.1 --dev first
Expected behavior
The example test should run and pass.
Actual behavior
The Uncaught Error: Call to a member function getConfig() on null error is thrown.
After replacing the GeneralConfig::create(); syntax with the array syntax the tests/_craft/config/general.php, the test runs and passes:
<?php
use craft\helpers\App;
return [
// Set the default week start day for date pickers (0 = Sunday, 1 = Monday, etc.)
'defaultWeekStartDay' => 1,
// Prevent generated URLs from including "index.php"
'omitScriptNameInUrls' => true,
// Enable Dev Mode (see https://craftcms.com/guides/what-dev-mode-does)
'devMode' => App::env('DEV_MODE') ?? false,
// Allow administrative changes
'allowAdminChanges' => App::env('ALLOW_ADMIN_CHANGES') ?? false,
// Disallow robots
'disallowRobots' => App::env('DISALLOW_ROBOTS') ?? false,
];
Craft CMS version
4.2.7
PHP version
8.0.21
Operating system and version
Linux 5.10.124-linuxkit (DDEV v1.20.0)
Database type and version
MySQL 10.4.25 (MariaDB 10.4)
Image driver and version
Imagick 3.6.0 (ImageMagick 6.9.11-60)
Installed plugins and versions
codeception/codeception 4.2.2
codeception/module-yii2 1.1.5
codeception/module-asserts 1.3.1
codeception/module-phpbrowser 1.0.3
The text was updated successfully, but these errors were encountered:
yoannisj
changed the title
[4.x]: Uncaught Error: Call to a member function getConfig() on null running Codeception tests
[4.x]: Codeception throws Uncaught Error: Call to a member function getConfig() on nullOct 12, 2022
What happened?
Description
Using the
return GeneralConfig::create();
syntax intests/_craft/config/general.php
throws an error when running Codeception tests on a fresh Craft-CSM 4.2 installation.Steps to reproduce
I downloaded the zip file from the Installation Instructions to get up and running inside a DDEV project.
composer require codeception/codeception:^4.1 --dev
Codeception ^3.1 is not compatible with PHP 8, and I did not manage to setup Craft-CMS tests with Codeception ^5.0.
To run the example unit test (steps 4-5), I had to un
composer require codeception/module-yii2:^1.1 --dev
firstExpected behavior
The example test should run and pass.
Actual behavior
The
Uncaught Error: Call to a member function getConfig() on null
error is thrown.After replacing the
GeneralConfig::create();
syntax with the array syntax thetests/_craft/config/general.php
, the test runs and passes:Craft CMS version
4.2.7
PHP version
8.0.21
Operating system and version
Linux 5.10.124-linuxkit (DDEV v1.20.0)
Database type and version
MySQL 10.4.25 (MariaDB 10.4)
Image driver and version
Imagick 3.6.0 (ImageMagick 6.9.11-60)
Installed plugins and versions
The text was updated successfully, but these errors were encountered: