-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #188 from MoritzKrafeld/ntr/add-enterprise-to-sw6-…
…plugin-namespace NTR - add enterprise to sw6 plugin namespace
- Loading branch information
Showing
2 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
tests/Unit/Extensions/Shopware/Plugin/Services/PluginFactoryTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
declare(strict_types=1); | ||
/** | ||
* (c) shopware AG <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Shopware\Plugin\Services\PluginFactory; | ||
|
||
class PluginFactoryTest extends TestCase | ||
{ | ||
/** | ||
* @dataProvider sw6PluginDataProvider | ||
*/ | ||
public function testGetPluginIsSw6Plugin(string $name, string $sshUrl, string $httpUrl, string $repoName, ?string $repoType = null): void | ||
{ | ||
$plugin = PluginFactory::getPlugin($name, $sshUrl, $httpUrl, $repoName, $repoType); | ||
|
||
static::assertTrue($plugin->isShopware6); | ||
} | ||
|
||
/** | ||
* @dataProvider notSw6PluginDataProvider | ||
*/ | ||
public function testGetPluginIsNotSw6Plugin(string $name, string $sshUrl, string $httpUrl, string $repoName, ?string $repoType = null): void | ||
{ | ||
$plugin = PluginFactory::getPlugin($name, $sshUrl, $httpUrl, $repoName, $repoType); | ||
|
||
static::assertFalse($plugin->isShopware6); | ||
} | ||
|
||
public function sw6PluginDataProvider(): Generator | ||
{ | ||
foreach (PluginFactory::SW6_PLUGIN_PATHS as $path) { | ||
yield 'Plugin is SW6 - ' . $path => [ | ||
'name' => 'frontend_myPluginName', | ||
'sshUrl' => '[email protected]:' . $path . '/myPlugin.git', | ||
'httpUrl' => 'https://mygitlabserver.com/shopware/6/enterprise/myPlugin.git', | ||
'repoName' => 'myPlugin', | ||
'repoType' => null, | ||
]; | ||
} | ||
} | ||
|
||
public function notSw6PluginDataProvider(): Generator | ||
{ | ||
yield 'Plugin is not SW6 - custom namespace' => [ | ||
'name' => 'frontend_myPluginName', | ||
'sshUrl' => '[email protected]:my/custom/namespace/myPlugin.git', | ||
'httpUrl' => 'https://mygitlabserver.com/my/custom/namespace/myPlugin.git', | ||
'repoName' => 'myPlugin', | ||
'repoType' => null, | ||
]; | ||
} | ||
} |