Skip to content

Commit

Permalink
Merge pull request #121 from FriendsOfShopware/fix-multiple-licenses
Browse files Browse the repository at this point in the history
Fix multiple licenses in plugin, fixes #118
  • Loading branch information
shyim authored Feb 27, 2021
2 parents 7271b5c + 2bbe03c commit cf67fdc
Show file tree
Hide file tree
Showing 7 changed files with 248 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function getCoreConstraint()

public function getLicense(): string
{
return strtolower($this->composerJson['license']);
return strtolower(is_array($this->composerJson['license']) ? $this->composerJson['license'][0] : $this->composerJson['license']);
}

public function getName(): string
Expand Down
8 changes: 8 additions & 0 deletions tests/Components/Generation/Shopware6/PluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,12 @@ public function testPlugin(): void
static::assertSame('<ul><li>First release in store</li></ul>', $plugin->getReader()->getNewestChangelogEnglish());
static::assertSame('<ul><li>Erster Release im Store</li></ul>', $plugin->getReader()->getNewestChangelogGerman());
}

public function testMultiLicense(): void
{
$rootDir = dirname(__DIR__, 3) . '/fixtures/plugins/ShopwarePlatformPluginComposerMultiLicense';
$plugin = new Plugin($rootDir, 'ShopwarePlatformPluginComposerMultiLicense');

static::assertSame('mit', $plugin->getReader()->getLicense());
}
}
198 changes: 198 additions & 0 deletions tests/fixtures/plugins/ShopwarePlatformPlugin/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 1.0.0

* Erster Release im Store
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 1.0.0

* First release in store
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "frosh/platform-performance",
"version": "1.0.0",
"type": "shopware-platform-plugin",
"keywords": ["shopware", "performance", "minify", "http2"],
"description": "Performance improvements for Shopware",
"license": ["MIT", "foo"],
"authors": [
{
"name": "Example Company",
"homepage": "https://my.example.com"
}
],
"autoload": {
"psr-4": {
"Frosh\\Performance\\": "src/"
}
},
"extra": {
"shopware-plugin-class": "Frosh\\Performance\\ShopwarePlatformPlugin",
"copyright": "FriendsOfShopware",
"label": {
"de-DE": "Label DE",
"en-GB": "Label EN"
},
"description": {
"de-DE": "Description DE",
"en-GB": "Description EN"
}
},
"require": {
"shopware/core": "*"
}
}

0 comments on commit cf67fdc

Please sign in to comment.