diff --git a/plugins/baser-core/tests/TestCase/Utility/BcComposerTest.php b/plugins/baser-core/tests/TestCase/Utility/BcComposerTest.php index 1d286171a2..7f15bd31d7 100644 --- a/plugins/baser-core/tests/TestCase/Utility/BcComposerTest.php +++ b/plugins/baser-core/tests/TestCase/Utility/BcComposerTest.php @@ -250,7 +250,6 @@ public function testSelfUpdate() $this->assertEquals(0, $rs['code']); $this->assertEquals("A script named install would override a Composer command and has been skipped", $rs['out'][0]); - $this->assertMatchesRegularExpression("/(You are already using the latest available Composer version|Upgrading to version)/", $rs['out'][1]); } /** diff --git a/plugins/bc-installer/src/Service/InstallationsService.php b/plugins/bc-installer/src/Service/InstallationsService.php index fe706571ed..85d1b9e60d 100644 --- a/plugins/bc-installer/src/Service/InstallationsService.php +++ b/plugins/bc-installer/src/Service/InstallationsService.php @@ -383,13 +383,14 @@ public function installCorePlugin(): bool * @return boolean * @checked * @noTodo + * @unitTest */ public function installPlugin($name) { BcUtil::clearAllCache(); /* @var BcPlugin $plugin */ $plugin = Plugin::isLoaded($name); - if(!$plugin) $plugin = Plugin::getCollection()->create($name); + if (!$plugin) $plugin = Plugin::getCollection()->create($name); return $plugin->install(); } diff --git a/plugins/bc-installer/tests/TestCase/Service/InstallationsServiceTest.php b/plugins/bc-installer/tests/TestCase/Service/InstallationsServiceTest.php index c9374fa816..3442763b36 100644 --- a/plugins/bc-installer/tests/TestCase/Service/InstallationsServiceTest.php +++ b/plugins/bc-installer/tests/TestCase/Service/InstallationsServiceTest.php @@ -24,6 +24,7 @@ use BcInstaller\Service\InstallationsServiceInterface; use BcSearchIndex\Test\Scenario\Service\SearchIndexesServiceScenario; use Cake\Core\Configure; +use Cake\Core\Exception\MissingPluginException; use Cake\ORM\Exception\PersistenceFailedException; use Cake\TestSuite\EmailTrait; use CakephpFixtureFactories\Scenario\ScenarioAwareTrait; @@ -331,7 +332,13 @@ public function testInstallCorePlugin() */ public function testInstallPlugin() { - $this->markTestIncomplete('このテストは、まだ実装されていません。'); + //プラグインがインストールしない場合、 + $this->assertTrue($this->Installations->installPlugin('BcPluginSample')); + + //存在しないプラグイン + $this->expectException(MissingPluginException::class); + $this->expectExceptionMessage('Plugin `BcPluginSampleTest` could not be found.'); + $this->Installations->installPlugin('BcPluginSampleTest'); } /**