diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6780c11..243fd66 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.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: [ 'ProductReview42' ] include: - db: mysql @@ -39,6 +38,16 @@ 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 +81,6 @@ jobs: - 1080:1080 - 1025:1025 steps: - - run: sudo apt-get purge -y hhvm - name: Checkout uses: actions/checkout@v2 @@ -143,7 +151,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/.github/workflows/main.yml b/.github/workflows/main.yml index a19786e..1eeedcb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,7 +5,7 @@ on: jobs: deploy: name: Build - runs-on: ubuntu-18.04 + runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@v2 diff --git a/PluginManager.php b/PluginManager.php index be845ca..e46b0ef 100644 --- a/PluginManager.php +++ b/PluginManager.php @@ -24,7 +24,7 @@ use Eccube\Repository\PageRepository; use Plugin\ProductReview42\Entity\ProductReviewConfig; use Plugin\ProductReview42\Entity\ProductReviewStatus; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Psr\Container\ContainerInterface; use Symfony\Component\Filesystem\Filesystem; class PluginManager extends AbstractPluginManager @@ -204,7 +204,7 @@ protected function createPage(EntityManagerInterface $em, $name, $url, $filename protected function copyTwigFiles(ContainerInterface $container) { - $templatePath = $container->getParameter('eccube_theme_front_dir') + $templatePath = $container->get(EccubeConfig::class)->get('eccube_theme_front_dir') .'/ProductReview42/Resource/template/default'; $fs = new Filesystem(); if ($fs->exists($templatePath)) { @@ -336,7 +336,7 @@ protected function removePage(EntityManagerInterface $em, $url) protected function removeTwigFiles(ContainerInterface $container) { - $templatePath = $container->getParameter('eccube_theme_front_dir') + $templatePath = $container->get(EccubeConfig::class)->get('eccube_theme_front_dir') .'/ProductReview42'; $fs = new Filesystem(); $fs->remove($templatePath); diff --git a/Tests/Web/ReviewAdminControllerTest.php b/Tests/Web/ReviewAdminControllerTest.php index 57b7b11..5c7ebf0 100755 --- a/Tests/Web/ReviewAdminControllerTest.php +++ b/Tests/Web/ReviewAdminControllerTest.php @@ -13,6 +13,7 @@ namespace Plugin\ProductReview42\Tests\Web; +use Eccube\Common\Constant; use Eccube\Entity\Master\Sex; use Eccube\Entity\Product; use Eccube\Repository\Master\ProductStatusRepository; @@ -233,7 +234,7 @@ public function testReviewSearchWithPaging() $paging = $crawler->filter('ul.pagination .page-item')->last(); // Current active on page 2. - $this->assertStringContainsString('active', $paging->parents()->html()); + $this->assertStringContainsString('active', $paging->ancestors()->html()); $this->expected = 2; $this->actual = intval($paging->text()); $this->verify(); @@ -263,7 +264,9 @@ public function testDownloadCsv() $this->assertStringContainsString($review->getReviewerName(), $table->html()); - $this->expectOutputRegex("/{$review->getTitle()}/"); + if (version_compare(Constant::VERSION, '4.3', '<')) { + $this->expectOutputRegex("/{$review->getTitle()}/"); + } $this->client->request( 'POST', @@ -271,6 +274,12 @@ public function testDownloadCsv() ); $this->assertTrue($this->client->getResponse()->isSuccessful()); + + if (version_compare(Constant::VERSION, '4.3', '>=')) { + $content = $this->client->getInternalResponse()->getContent(); + $content = mb_convert_encoding($content, 'UTF-8', 'SJIS-win'); + $this->assertMatchesRegularExpression("/{$review->getTitle()}/", $content); + } } /** @@ -341,7 +350,7 @@ private function createProductReviewData($product = 1) $Review->setCustomer($Customer); $this->entityManager->persist($Review); - $this->entityManager->flush($Review); + $this->entityManager->flush(); return $Review; } diff --git a/composer.json b/composer.json index dc5bfb0..4264f9f 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "ec-cube/productreview42", - "version": "4.2.4", + "version": "4.3.0", "description": "商品レビュー管理プラグイン", "type": "eccube-plugin", "require": {