diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3f3a130..e4c479e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,14 +17,13 @@ on: jobs: run-on-linux: name: Run on Linux - runs-on: ${{ matrix.operating-system }} + runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: - operating-system: [ ubuntu-18.04 ] - php: [ '7.4', '8.0', '8.1' ] + eccube_version: [ '4.2', '4.3' ] + php: [ '7.4', '8.0', '8.1', '8.2', '8.3'] db: [ 'mysql', 'mysql8', 'pgsql' ] - eccube_version: [ '4.2' ] plugin_code: [ 'Maker42' ] include: - db: mysql @@ -39,6 +38,15 @@ jobs: database_url: postgres://postgres:password@127.0.0.1:5432/eccube_db database_server_version: 14 database_charset: utf8 + exclude: + - eccube_version: 4.2 + php: 8.2 + - eccube_version: 4.2 + php: 8.3 + - eccube_version: 4.3 + php: 7.4 + - eccube_version: 4.3 + php: 8.0 services: mysql: image: mysql:5.7 @@ -72,7 +80,6 @@ jobs: - 1080:1080 - 1025:1025 steps: - - run: sudo apt-get purge -y hhvm - name: Checkout uses: actions/checkout@v2 @@ -143,7 +150,7 @@ jobs: working-directory: 'ec-cube' run: | bin/console cache:clear --no-warmup - bin/phpunit -c app/Plugin/${PLUGIN_CODE}/phpunit.xml.dist app/Plugin/${PLUGIN_CODE}/Tests + ./vendor/bin/phpunit -c app/Plugin/${PLUGIN_CODE}/phpunit.xml.dist app/Plugin/${PLUGIN_CODE}/Tests - name: Disable Plugin working-directory: 'ec-cube' diff --git a/Controller/MakerController.php b/Controller/MakerController.php index 3d2c888..bc34813 100644 --- a/Controller/MakerController.php +++ b/Controller/MakerController.php @@ -145,7 +145,7 @@ public function delete(Request $request, Maker $Maker) } catch (\Exception $e) { log_info('メーカー削除エラー', ['Maker id' => $Maker->getId(), $e]); - $message = trans('admin.delete.failed.foreign_key', ['%name%' => $Maker->getName()]); + $message = trans('admin.common.delete_error_foreign_key', ['%name%' => $Maker->getName()]); $this->addError($message, 'admin'); } diff --git a/Tests/Web/Admin/MakerControllerTest.php b/Tests/Web/Admin/MakerControllerTest.php index 9254d07..e748db0 100644 --- a/Tests/Web/Admin/MakerControllerTest.php +++ b/Tests/Web/Admin/MakerControllerTest.php @@ -37,7 +37,7 @@ protected function setUp(): void parent::setUp(); $this->deleteAllRows(['plg_maker']); - $this->makerRepository = self::$container->get(MakerRepository::class); + $this->makerRepository = self::getContainer()->get(MakerRepository::class); } /** diff --git a/Tests/Web/Admin/ProductMakerTest.php b/Tests/Web/Admin/ProductMakerTest.php index 5827a8f..7877b7c 100644 --- a/Tests/Web/Admin/ProductMakerTest.php +++ b/Tests/Web/Admin/ProductMakerTest.php @@ -14,8 +14,10 @@ namespace Plugin\Maker42\Tests\Web\Admin; use Faker\Generator; +use Eccube\Common\Constant; use Plugin\Maker42\Tests\Web\MakerWebCommon; use Symfony\Component\HttpKernel\Client; +use Symfony\Component\DomCrawler\Crawler; use Eccube\Repository\ProductRepository; /** @@ -44,7 +46,7 @@ protected function setUp() :void parent::setUp(); $this->deleteAllRows(['plg_maker']); - $this->productRepository = self::$container->get(ProductRepository::class); + $this->productRepository = self::getContainer()->get(ProductRepository::class); } /** @@ -142,7 +144,12 @@ public function testProductNewWithAddMakerInvalid() ); // Check message - $this->assertStringContainsString('有効な値ではありません。', $crawler->filter('.form-error-message')->html()); + $errorMessages = $crawler->filter('.form-error-message')->each(function (Crawler $node): string { + return $node->text(); + }); + $versionParts = explode('-', Constant::VERSION); + $expectedMessage = version_compare(reset($versionParts), '4.3.0', '<') ? '有効な値ではありません。' : '選択した値は無効です。'; + $this->assertStringContainsString($expectedMessage, implode("\n", $errorMessages)); // Check database $Product = $this->productRepository->findOneBy([], ['id' => 'DESC']); @@ -220,7 +227,10 @@ public function testProductNewWithAddMakerAndMakerUrlInValid() ); // Check message - $this->assertStringContainsString('有効なURLではありません。', $crawler->filter('.form-error-message')->html()); + $errorMessages = $crawler->filter('.form-error-message')->each(function (Crawler $node): string { + return $node->text(); + }); + $this->assertStringContainsString('有効なURLではありません。', implode("\n", $errorMessages)); // Check database $Product = $this->productRepository->findOneBy([], ['id' => 'DESC']); @@ -407,7 +417,12 @@ public function testProductEditWithAddMakerInvalid() ); // Check message - $this->assertStringContainsString('有効な値ではありません。', $crawler->filter('.form-error-message')->html()); + $errorMessages = $crawler->filter('.form-error-message')->each(function (Crawler $node): string { + return $node->text(); + }); + $versionParts = explode('-', Constant::VERSION); + $expectedMessage = version_compare(reset($versionParts), '4.3.0', '<') ? '有効な値ではありません。' : '選択した値は無効です。'; + $this->assertStringContainsString($expectedMessage, implode("\n", $errorMessages)); // Check database $Product = $this->productRepository->findOneBy([], ['id' => 'DESC']); @@ -520,7 +535,10 @@ public function testProductEditWithAddMakerAndMakerUrlInValid() ); // Check message - $this->assertStringContainsString('有効なURLではありません。', $crawler->filter('.form-error-message')->html()); + $errorMessages = $crawler->filter('.form-error-message')->each(function (Crawler $node): string { + return $node->text(); + }); + $this->assertStringContainsString('有効なURLではありません。', implode("\n", $errorMessages)); // Check database $Product = $this->productRepository->findOneBy([], ['id' => 'DESC']); diff --git a/Tests/Web/ProductDetailTest.php b/Tests/Web/ProductDetailTest.php index 9d85c7f..771811e 100644 --- a/Tests/Web/ProductDetailTest.php +++ b/Tests/Web/ProductDetailTest.php @@ -50,7 +50,7 @@ protected function setUp(): void $this->Maker = $this->createMaker(); $this->Product = $this->createProductMaker($this->Maker); - $this->productRepository = self::$container->get(ProductRepository::class); + $this->productRepository = self::getContainer()->get(ProductRepository::class); } /** @@ -145,7 +145,7 @@ protected function createProductMaker(Maker $Maker, $Product = null) $client->followRedirect(); - $this->productRepository = self::$container->get(ProductRepository::class); + $this->productRepository = self::getContainer()->get(ProductRepository::class); $Product = $this->productRepository->find($productId); } diff --git a/composer.json b/composer.json index f9a98f4..5ae0727 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "ec-cube/maker42", - "version": "4.2.2", + "version": "4.3.0", "description": "メーカー管理プラグイン", "type": "eccube-plugin", "require": {