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

Wrong test extension linked in consecutive tests #487

Open
andreaswolf opened this issue Aug 5, 2023 · 1 comment
Open

Wrong test extension linked in consecutive tests #487

andreaswolf opened this issue Aug 5, 2023 · 1 comment

Comments

@andreaswolf
Copy link

andreaswolf commented Aug 5, 2023

What are you trying to achieve?

I have the following setup:

  • two functional test cases
    • each has its own test extension in a subfolder Fixtures/test_extension with a matching ext_emconf.php and composer.json
    • the composer.json does not have a package name (if this is not supported anymore, I will add it)
  • the test extensions are symlinked via $testExtensionsToLoad

What do you get instead?

When executing the test cases individually, everything works. When executing both in one run (with an empty var/tests/ folder), the test extension from the first test case is symlinked to both test systems.

How to reproduce the issue?

See above.

I have an example in the branch "broken-extension-linking" of my EXT:migrations: https://github.com/andreaswolf/typo3-ext-migrations/tree/broken-extension-linking

Additional information you would like to provide?

I think the problem is using static info inside \TYPO3\TestingFramework\Composer\ComposerPackageManager.

Specify some data of the environment

  • TYPO3 testing framework version: 7.0.2+ (it works in 7.0.0 and 7.0.1, the commit that breaks it is af280b6.
  • TYPO3 version: 11.5
  • TYPO3 installation type: Composer
  • PHP version: 7.4, 8.0, 8.1
  • Web server used + version: n/a
  • Operating system: Ubuntu 22.04
@DanielSiepmann
Copy link
Contributor

We run into the same issue. They are not cleaned up between runs. The corresponding setting seems to be expected to be TestClass instead of test case specific.

Our workaround is to write and call this method after parent::setUp() (Mind the hardcoded path which needs adjustment):

    /**
     * The testing framework doesn't expect the list to change between tests in a single class.
     *
     * We therefore build our own setup to change extensions for each test.
     */
    private function setUpExtensionsToLoad(): void
    {
        $testExtensions = $this->testExtensionsToLoad;
        array_shift($testExtensions);

        foreach ($testExtensions as $testExtension) {
            $path = $this->getInstancePath() . '/typo3conf/ext/' . basename($testExtension);
            unlink($path);

            $source = __DIR__ . str_replace('typo3conf/ext/e2_core/Tests/Functional/Service', '', $testExtension);
            $success = @symlink($source, $path);
            if (!$success) {
                throw new Exception(
                    'Can not link the path ' . $source . ' to ' . $path,
                    1389969623
                );
            }
        }
    }

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