Skip to content

Commit

Permalink
Merge pull request #93 from chihiro-adachi/migration-4.3
Browse files Browse the repository at this point in the history
4.3対応
  • Loading branch information
chihiro-adachi authored Apr 9, 2024
2 parents aee21d7 + 34245ab commit 1b83299
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 14 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -39,6 +38,16 @@ jobs:
database_url: postgres://postgres:[email protected]: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
Expand Down Expand Up @@ -72,7 +81,6 @@ jobs:
- 1080:1080
- 1025:1025
steps:
- run: sudo apt-get purge -y hhvm
- name: Checkout
uses: actions/checkout@v2

Expand Down Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions PluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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);
Expand Down
15 changes: 12 additions & 3 deletions Tests/Web/ReviewAdminControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -263,14 +264,22 @@ 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',
$this->generateUrl('product_review_admin_product_review_download')
);

$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);
}
}

/**
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ec-cube/productreview42",
"version": "4.2.4",
"version": "4.3.0",
"description": "商品レビュー管理プラグイン",
"type": "eccube-plugin",
"require": {
Expand Down

0 comments on commit 1b83299

Please sign in to comment.