Skip to content

LocalizedException: The configuration file has changed when using TestCase\AbstractController #26

Description

@elburro1887

My test looks like this:

class ProductTest extends \Magento\TestFramework\TestCase\AbstractController
{
    
    public static function loadFixture()
    {
        include __DIR__ . '/../_files/categories.php';
    }

    /**
     * @magentoDbIsolation enabled
     * @magentoAppIsolation enabled
     * @magentoDataFixture loadFixture
     */
    public function testCategory()
    {
        $this->dispatch('catalog/category/view/id/3');
        $this->assertContains('Category 1', $this->getResponse()->getBody());
    }

}

Then when I run the integration test with the plugin, the call to $this->dispatch() leads to this error:

Magento\Framework\Exception\LocalizedException: The configuration file has changed. Run the "app:config:import" or the "setup:upgrade" command to synchronize the configuration.

magento/vendor/magento/module-deploy/Model/Plugin/ConfigChangeDetector.php:50
magento/vendor/magento/framework/Interception/Interceptor.php:121
magento/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php:69
magento/vendor/magento/framework/Interception/Interceptor.php:135
magento/vendor/magento/framework/Interception/Interceptor.php:153
magento/generated/code/Magento/Framework/App/FrontController/Interceptor.php:26
magento/vendor/magento/framework/App/Http.php:137
magento/generated/code/Magento/Framework/App/Http/Interceptor.php:24
magento/dev/tests/integration/framework/Magento/TestFramework/Application.php:449
magento/dev/tests/integration/framework/Magento/TestFramework/Helper/Bootstrap.php:117
magento/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php:116
magento/app/code/XYX/Module/Test/Integration/Controller/ProductTest.php:58

Maybe this is related to using/extending AbstractController?

EDIT:
So when I run a test that uses extend \PHPUnit\Framework\TestCase it works.

Does anyone know what I can do to be able to use Controller Test cases?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions