Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
elburro1887 opened this issue Jun 3, 2021 · 1 comment

Comments

@elburro1887
Copy link

elburro1887 commented Jun 3, 2021

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?

@elburro1887 elburro1887 changed the title LocalizedException: The configuration file has changed LocalizedException: The configuration file has changed when using TestCase\AbstractController Jun 3, 2021
@jissereitsma
Copy link
Contributor

This sounds pretty similar to the following topic: https://magento.stackexchange.com/questions/323506/getting-the-configuration-file-has-changed-run-the-appconfigimport-d This would suggest the integration test database is in an inconsistent state, perhaps because of other modules being present that break the setup.

Could you test for the regular Integration Tests setup (so, of the Magento core) to see if the problem occurs there as well? Perhaps the issue you are having is not related to the Reach Digital Test Framework (which would justify posting here) but related to the specific modules you have installed in the instance where you run the tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants