shopwareLabs / sw-cli-tools

The shopware CLI tools are your console helpers for all kind of shopware tasks
MIT License
84 stars 52 forks source link

Problem with legacy PluginCreator #93

Closed nlubisch closed 5 years ago

nlubisch commented 7 years ago

Scenario: Customer has Shopware 5.1, all plugins and tests are written under SW5.1. The Customer wishes an update to SW5.2.

Problem: The legacy PluginCreator copies the phpunit.xml.dist with bootstrap "../../../../../../tests/Shopware/TestHelper.php" But under SW5.2 the whole tests/Shopware dir gots deleted und the tests are not working.

Is there probably a way to provide both test-scenarios for legacy and new plugin structure?

Haehnchen commented 7 years ago

Our minimized solution

# bootstrap.php
(new \Shopware\Kernel('testing', true))->boot();
# phpunit.xml.dist
<phpunit bootstrap="tests/bootstrap.php">
<testsuite name="Foobar Test Suite">
    <directory>tests</directory>
</testsuite>
</phpunit>
# PluginTestCase .php
class PluginTestCase extends \PHPUnit_Framework_TestCase
{
    /**
    * Set up Test Case
    */
    protected function setUp()
    {
        parent::setUp();

        Shopware()->Loader()->registerNamespace(
            'Foobar',
            Shopware()->Plugins()->Frontend()->Foobar()->Path()
        );
    }
}
mitelg commented 5 years ago

@nlubisch does the solution of @Haehnchen help?

nlubisch commented 5 years ago

I'm not sure, what the result was. It's about 2 years ago :see_no_evil:

mitelg commented 5 years ago

ok, I will close this issue for now. If there is a problem, feel free to open an issue again. we try to solve them faster in the future :see_no_evil: