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

refactor:remove config.yaml #6247

Merged
merged 2 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/Eccube/Service/PluginService.php
Original file line number Diff line number Diff line change
Expand Up @@ -444,18 +444,18 @@
}

if (!is_array($meta)) {
throw new PluginException('config.yml not found or syntax error');
throw new PluginException('composer.json not found or syntax error');

Check warning on line 447 in src/Eccube/Service/PluginService.php

View check run for this annotation

Codecov / codecov/patch

src/Eccube/Service/PluginService.php#L447

Added line #L447 was not covered by tests
}
if (!isset($meta['code']) || !$this->checkSymbolName($meta['code'])) {
throw new PluginException('config.yml code empty or invalid_character(\W)');
throw new PluginException('composer.json code empty or invalid_character(\W)');

Check warning on line 450 in src/Eccube/Service/PluginService.php

View check run for this annotation

Codecov / codecov/patch

src/Eccube/Service/PluginService.php#L450

Added line #L450 was not covered by tests
}
if (!isset($meta['name'])) {
// nameは直接クラス名やPATHに使われるわけではないため文字のチェックはなしし
throw new PluginException('config.yml name empty');
// nameは直接クラス名やPATHに使われるわけではないため文字のチェックはなし
throw new PluginException('composer.json name empty');

Check warning on line 454 in src/Eccube/Service/PluginService.php

View check run for this annotation

Codecov / codecov/patch

src/Eccube/Service/PluginService.php#L454

Added line #L454 was not covered by tests
}
if (!isset($meta['version'])) {
// versionは直接クラス名やPATHに使われるわけではないため文字のチェックはなしし
throw new PluginException('config.yml version invalid_character(\W) ');
// versionは直接クラス名やPATHに使われるわけではないため文字のチェックはなし
throw new PluginException('composer.json version invalid_character(\W) ');

Check warning on line 458 in src/Eccube/Service/PluginService.php

View check run for this annotation

Codecov / codecov/patch

src/Eccube/Service/PluginService.php#L458

Added line #L458 was not covered by tests
}
}

Expand Down
18 changes: 9 additions & 9 deletions tests/Eccube/Tests/Service/PluginServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ protected function tearDown(): void
/*
正しいプラグインの条件
* tar/zipアーカイブである
* 展開した直下のディレクトリにconfig.ymlがあり、正しいymlファイルである
* config.ymlの必須要素が規定の文字数、文字種で定義されている
* event.ymlが存在する場合、正しいymlである
* 展開した直下のディレクトリにcomposer.jsonがあり、正しいファイルである
* composer.jsonの必須要素が規定の文字数、文字種で定義されている
* event.ymlが存在する場合、正しいである

*/

Expand Down Expand Up @@ -164,7 +164,7 @@ public function testInstallPluginEmptyError()
$this->service->install($tmpfile);
}

// config.ymlのフォーマット確認
// composer.jsonのフォーマット確認
public function testConfigYmlFormat()
{
$tmpname = 'dummy'.mt_rand();
Expand Down Expand Up @@ -250,7 +250,7 @@ public function testConfigYmlFormat()
}

/**
* config.ymlに異常な項目がある場合
* composer.jsonに異常な項目がある場合
*/
public function testnstallPluginMalformedConfigError()
{
Expand All @@ -264,7 +264,7 @@ public function testnstallPluginMalformedConfigError()
$config = [];
$config['code'] = $tmpname;
$config['version'] = $tmpname;
$tar->addFromString('config.yml', Yaml::dump($config));
$tar->addFromString('composer.json', Yaml::dump($config));

// インストールできないはず
$this->assertNull($this->service->install($tmpfile));
Expand Down Expand Up @@ -435,7 +435,7 @@ public function testGetDependentByCodeEccubePlugin()
$tmpfile = $tmpdir.'/plugin.tar';

$tar = new \PharData($tmpfile);
$tar->addFromString('config.yml', Yaml::dump($config));
$tar->addFromString('composer.json', Yaml::dump($config));
$jsonPHP = $this->createComposerJsonFile($config);
$text = json_encode($jsonPHP);
$tar->addFromString('composer.json', $text);
Expand Down Expand Up @@ -471,7 +471,7 @@ public function testGetDependentByCodeOtherPlugin()
$tmpfile = $tmpdir.'/plugin.tar';

$tar = new \PharData($tmpfile);
$tar->addFromString('config.yml', Yaml::dump($config));
$tar->addFromString('composer.json', Yaml::dump($config));
$jsonPHP = $this->createComposerJsonFile($config);
$text = json_encode($jsonPHP);
$tar->addFromString('composer.json', $text);
Expand Down Expand Up @@ -506,7 +506,7 @@ public function testGetDependentByCodeAllPlugin()
$tmpfile = $tmpdir.'/plugin.tar';

$tar = new \PharData($tmpfile);
$tar->addFromString('config.yml', Yaml::dump($config));
$tar->addFromString('composer.json', Yaml::dump($config));
$jsonPHP = $this->createComposerJsonFile($config);
$text = json_encode($jsonPHP);
$tar->addFromString('composer.json', $text);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function testInstallPluginWithBrokenManager()
$tmpfile = $tmpdir.'/plugin.tar';

$tar = new \PharData($tmpfile);
$tar->addFromString('config.yml', Yaml::dump($config));
$tar->addFromString('composer.json', Yaml::dump($config));
$dummyManager = <<<'EOD'
<?php
namespace Plugin\@@@@ ;
Expand Down
Loading