From 8af91a429b2ef25e511e06ff163db7e84f8a5dc7 Mon Sep 17 00:00:00 2001 From: NghiaLe Date: Fri, 10 Jun 2022 18:19:44 +0700 Subject: [PATCH 1/3] Fix upgrade plugin related product for ec-cube 4.2 --- Controller/Admin/RelatedProductController.php | 4 ++-- Entity/ProductTrait.php | 4 ++-- Entity/RelatedProduct.php | 4 ++-- Form/Extension/Admin/RelatedCollectionExtension.php | 8 ++++---- Form/Type/Admin/RelatedProductType.php | 4 ++-- PluginManager.php | 2 +- README.md | 2 +- RelatedProductEvent.php | 6 +++--- Repository/RelatedProductRepository.php | 6 +++--- Tests/Web/RelatedProductAdminControllerTest.php | 6 +++--- Tests/Web/RelatedProductControllerTest.php | 4 ++-- composer.json | 8 ++++---- 12 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Controller/Admin/RelatedProductController.php b/Controller/Admin/RelatedProductController.php index 01e6d4e..eb3e243 100644 --- a/Controller/Admin/RelatedProductController.php +++ b/Controller/Admin/RelatedProductController.php @@ -11,7 +11,7 @@ * file that was distributed with this source code. */ -namespace Plugin\RelatedProduct4\Controller\Admin; +namespace Plugin\RelatedProduct42\Controller\Admin; use Eccube\Controller\AbstractController; use Eccube\Repository\CategoryRepository; @@ -69,7 +69,7 @@ public function __construct( * @Route("/%eccube_admin_route%/related_product/search/product", name="admin_related_product_search") * @Route("/%eccube_admin_route%/related_product/search/product/page/{page_no}", name="admin_related_product_search_product_page", requirements={"page_no":"\d+"}) * - * @Template("@RelatedProduct4/admin/modal_result.twig") + * @Template("@RelatedProduct42/admin/modal_result.twig") */ public function searchProduct(Request $request, $page_no = null) { diff --git a/Entity/ProductTrait.php b/Entity/ProductTrait.php index 62c8127..9cc11b6 100644 --- a/Entity/ProductTrait.php +++ b/Entity/ProductTrait.php @@ -11,7 +11,7 @@ * file that was distributed with this source code. */ -namespace Plugin\RelatedProduct4\Entity; +namespace Plugin\RelatedProduct42\Entity; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; @@ -25,7 +25,7 @@ trait ProductTrait /** * @var RelatedProduct[]|Collection * - * @ORM\OneToMany(targetEntity="Plugin\RelatedProduct4\Entity\RelatedProduct", mappedBy="Product", cascade={"persist", "remove"}) + * @ORM\OneToMany(targetEntity="Plugin\RelatedProduct42\Entity\RelatedProduct", mappedBy="Product", cascade={"persist", "remove"}) * @ORM\OrderBy({ * "id"="ASC" * }) diff --git a/Entity/RelatedProduct.php b/Entity/RelatedProduct.php index 5074384..de8353c 100644 --- a/Entity/RelatedProduct.php +++ b/Entity/RelatedProduct.php @@ -11,7 +11,7 @@ * file that was distributed with this source code. */ -namespace Plugin\RelatedProduct4\Entity; +namespace Plugin\RelatedProduct42\Entity; use Eccube\Entity\AbstractEntity; use Eccube\Entity\Product; @@ -21,7 +21,7 @@ * Class RelatedProduct. * * @ORM\Table(name="plg_related_product") - * @ORM\Entity(repositoryClass="Plugin\RelatedProduct4\Repository\RelatedProductRepository") + * @ORM\Entity(repositoryClass="Plugin\RelatedProduct42\Repository\RelatedProductRepository") */ class RelatedProduct extends AbstractEntity { diff --git a/Form/Extension/Admin/RelatedCollectionExtension.php b/Form/Extension/Admin/RelatedCollectionExtension.php index 0858acc..5e0732f 100644 --- a/Form/Extension/Admin/RelatedCollectionExtension.php +++ b/Form/Extension/Admin/RelatedCollectionExtension.php @@ -11,14 +11,14 @@ * file that was distributed with this source code. */ -namespace Plugin\RelatedProduct4\Form\Extension\Admin; +namespace Plugin\RelatedProduct42\Form\Extension\Admin; use Doctrine\ORM\EntityManagerInterface; use Eccube\Common\EccubeConfig; use Eccube\Entity\Product; use Eccube\Form\Type\Admin\ProductType; -use Plugin\RelatedProduct4\Entity\RelatedProduct; -use Plugin\RelatedProduct4\Form\Type\Admin\RelatedProductType; +use Plugin\RelatedProduct42\Entity\RelatedProduct; +use Plugin\RelatedProduct42\Form\Type\Admin\RelatedProductType; use Symfony\Component\Form\AbstractTypeExtension; use Symfony\Component\Form\Extension\Core\Type\CollectionType; use Symfony\Component\Form\FormBuilderInterface; @@ -105,7 +105,7 @@ public function getExtendedType() * * @return string[] */ - public static function getExtendedTypes() + public static function getExtendedTypes(): iterable { yield ProductType::class; } diff --git a/Form/Type/Admin/RelatedProductType.php b/Form/Type/Admin/RelatedProductType.php index 098460c..a216636 100644 --- a/Form/Type/Admin/RelatedProductType.php +++ b/Form/Type/Admin/RelatedProductType.php @@ -11,13 +11,13 @@ * file that was distributed with this source code. */ -namespace Plugin\RelatedProduct4\Form\Type\Admin; +namespace Plugin\RelatedProduct42\Form\Type\Admin; use Doctrine\ORM\EntityManagerInterface; use Eccube\Common\EccubeConfig; use Eccube\Entity\Product; use Eccube\Form\DataTransformer\EntityToIdTransformer; -use Plugin\RelatedProduct4\Entity\RelatedProduct; +use Plugin\RelatedProduct42\Entity\RelatedProduct; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\TextareaType; diff --git a/PluginManager.php b/PluginManager.php index f87a460..87902f0 100644 --- a/PluginManager.php +++ b/PluginManager.php @@ -11,7 +11,7 @@ * file that was distributed with this source code. */ -namespace Plugin\RelatedProduct4; +namespace Plugin\RelatedProduct42; use Eccube\Plugin\AbstractPluginManager; diff --git a/README.md b/README.md index f6ce582..f5029e1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 関連商品プラグイン -[![CI for RelatedProduct4](https://github.com/EC-CUBE/related-product-plugin/actions/workflows/main.yml/badge.svg)](https://github.com/EC-CUBE/related-product-plugin/actions/workflows/main.yml) +[![CI for RelatedProduct42](https://github.com/EC-CUBE/related-product-plugin/actions/workflows/main.yml/badge.svg)](https://github.com/EC-CUBE/related-product-plugin/actions/workflows/main.yml) ## 概要 商品詳細ページに、関連する商品を表示できるようになるプラグイン。 diff --git a/RelatedProductEvent.php b/RelatedProductEvent.php index 58fe208..bfca2dd 100644 --- a/RelatedProductEvent.php +++ b/RelatedProductEvent.php @@ -11,7 +11,7 @@ * file that was distributed with this source code. */ -namespace Plugin\RelatedProduct4; +namespace Plugin\RelatedProduct42; use Eccube\Event\TemplateEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -33,7 +33,7 @@ public static function getSubscribedEvents() */ public function onRenderProductDetail(TemplateEvent $event) { - $event->addSnippet('@RelatedProduct4/front/related_product.twig'); + $event->addSnippet('@RelatedProduct42/front/related_product.twig'); } /** @@ -43,6 +43,6 @@ public function onRenderProductDetail(TemplateEvent $event) */ public function onRenderAdminProduct(TemplateEvent $event) { - $event->addSnippet('@RelatedProduct4/admin/related_product.twig'); + $event->addSnippet('@RelatedProduct42/admin/related_product.twig'); } } diff --git a/Repository/RelatedProductRepository.php b/Repository/RelatedProductRepository.php index 6d4314a..541f0a3 100644 --- a/Repository/RelatedProductRepository.php +++ b/Repository/RelatedProductRepository.php @@ -11,11 +11,11 @@ * file that was distributed with this source code. */ -namespace Plugin\RelatedProduct4\Repository; +namespace Plugin\RelatedProduct42\Repository; use Eccube\Repository\AbstractRepository; -use Plugin\RelatedProduct4\Entity\RelatedProduct; -use Doctrine\Common\Persistence\ManagerRegistry; +use Plugin\RelatedProduct42\Entity\RelatedProduct; +use Doctrine\Persistence\ManagerRegistry; /** * RelatedProductRepository. diff --git a/Tests/Web/RelatedProductAdminControllerTest.php b/Tests/Web/RelatedProductAdminControllerTest.php index 04a0a45..6dd2d5c 100644 --- a/Tests/Web/RelatedProductAdminControllerTest.php +++ b/Tests/Web/RelatedProductAdminControllerTest.php @@ -14,9 +14,9 @@ namespace Plugin\RelatedProduct\Tests\Web; use Eccube\Tests\Web\Admin\AbstractAdminWebTestCase; -use Plugin\RelatedProduct4\Entity\RelatedProduct; +use Plugin\RelatedProduct42\Entity\RelatedProduct; use Eccube\Repository\ProductRepository; -use Plugin\RelatedProduct4\Repository\RelatedProductRepository; +use Plugin\RelatedProduct42\Repository\RelatedProductRepository; use Eccube\Entity\Master\ProductStatus; use Eccube\Repository\Master\ProductStatusRepository; use Eccube\Common\Constant; @@ -56,7 +56,7 @@ class RelatedProductAdminControllerTest extends AbstractAdminWebTestCase /** * call parent setUp. */ - public function setUp() + public function setUp(): void { parent::setUp(); $this->deleteAllRows(['plg_related_product']); diff --git a/Tests/Web/RelatedProductControllerTest.php b/Tests/Web/RelatedProductControllerTest.php index d1a1a37..4fb031a 100644 --- a/Tests/Web/RelatedProductControllerTest.php +++ b/Tests/Web/RelatedProductControllerTest.php @@ -14,7 +14,7 @@ namespace Plugin\RelatedProduct\Tests\Web; use Eccube\Tests\Web\AbstractWebTestCase; -use Plugin\RelatedProduct4\Entity\RelatedProduct; +use Plugin\RelatedProduct42\Entity\RelatedProduct; use Eccube\Repository\ProductRepository; use Eccube\Entity\Product; @@ -36,7 +36,7 @@ class RelatedProductControllerTest extends AbstractWebTestCase /** * {@inheritdoc} */ - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/composer.json b/composer.json index 4fbae3c..24d7c55 100644 --- a/composer.json +++ b/composer.json @@ -1,12 +1,12 @@ { - "name": "ec-cube/relatedproduct4", - "version": "4.1.0", + "name": "ec-cube/relatedproduct42", + "version": "4.2.0", "description": "関連商品プラグイン", "type": "eccube-plugin", "require": { - "ec-cube/plugin-installer": "~0.0.6 || ^2.0" + "ec-cube/plugin-installer": "^2.0" }, "extra": { - "code": "RelatedProduct4" + "code": "RelatedProduct42" } } From c73d884d583a196e56115b2ddce60374655677dd Mon Sep 17 00:00:00 2001 From: Chihiro Adachi <8196725+chihiro-adachi@users.noreply.github.com> Date: Fri, 17 Jun 2022 13:10:00 +0900 Subject: [PATCH 2/3] =?UTF-8?q?Unit=20Test=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Web/RelatedProductAdminControllerTest.php | 26 +++++++++---------- Tests/Web/RelatedProductControllerTest.php | 2 +- phpunit.xml.dist | 3 ++- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Tests/Web/RelatedProductAdminControllerTest.php b/Tests/Web/RelatedProductAdminControllerTest.php index 6dd2d5c..4937ac4 100644 --- a/Tests/Web/RelatedProductAdminControllerTest.php +++ b/Tests/Web/RelatedProductAdminControllerTest.php @@ -76,7 +76,7 @@ public function testRoutingAdminProductRegistration() { $crawler = $this->client->request('GET', $this->generateUrl('admin_product_product_new')); - $this->assertContains('関連商品', $crawler->html()); + $this->assertStringContainsString('関連商品', $crawler->html()); } /** @@ -192,7 +192,7 @@ public function testCreateRelatedProductNoMaxLengthContent() ['admin_product' => $formData] ); - $this->assertContains('値が長すぎます。4000文字以内でなければなりません。', $crawler->html()); + $this->assertStringContainsString('値が長すぎます。4000文字以内でなければなりません。', $crawler->html()); } /** @@ -239,7 +239,7 @@ public function testAjaxSearchProductEmpty() ); $productList = $crawler->html(); - $this->assertContains($this->Product->getName(), $productList); + $this->assertStringContainsString($this->Product->getName(), $productList); } /** @@ -262,7 +262,7 @@ public function testAjaxSearchPublicProduct() ); $productList = $crawler->html(); - $this->assertContains($this->Product->getName(), $productList); + $this->assertStringContainsString($this->Product->getName(), $productList); } /** @@ -285,7 +285,7 @@ public function testAjaxSearchUnpublicProduct() ); $productList = $crawler->html(); - $this->assertContains($this->Product->getName(), $productList); + $this->assertStringContainsString($this->Product->getName(), $productList); } /** @@ -302,7 +302,7 @@ public function testAjaxSearchProductName() ); $productList = $crawler->html(); - $this->assertContains($this->Product->getName(), $productList); + $this->assertStringContainsString($this->Product->getName(), $productList); } /** @@ -319,7 +319,7 @@ public function testAjaxSearchProductValueCode() ); $productList = $crawler->html(); - $this->assertContains($this->Product->getName(), $productList); + $this->assertStringContainsString($this->Product->getName(), $productList); } /** @@ -336,7 +336,7 @@ public function testAjaxSearchProductValueId() ); $productList = $crawler->html(); - $this->assertContains($this->Product->getName(), $productList); + $this->assertStringContainsString($this->Product->getName(), $productList); } /** @@ -353,7 +353,7 @@ public function testAjaxSearchProductCategory() ); $productList = $crawler->html(); - $this->assertContains($this->Product->getName(), $productList); + $this->assertStringContainsString($this->Product->getName(), $productList); } /** @@ -399,10 +399,10 @@ public function createFormData($content = null, $childId = 1) 'free_area' => $faker->realText, 'Status' => 1, 'note' => $faker->realText, - 'tags' => null, - 'images' => null, - 'add_images' => null, - 'delete_images' => null, + 'tags' => [], + 'images' => [], + 'add_images' => [], + 'delete_images' => [], 'RelatedProducts' => [ 0 => ['ChildProduct' => $childId, 'content' => $content], ], diff --git a/Tests/Web/RelatedProductControllerTest.php b/Tests/Web/RelatedProductControllerTest.php index 4fb031a..7b3c73a 100644 --- a/Tests/Web/RelatedProductControllerTest.php +++ b/Tests/Web/RelatedProductControllerTest.php @@ -52,7 +52,7 @@ public function testShowRelatedProduct() $this->initRelatedProduct($this->Product->getId()); $crawler = $this->client->request('GET', $this->generateUrl('product_detail', ['id' => $this->Product->getId()])); - $this->assertContains('RelatedProduct-product_area', $crawler->html()); + $this->assertStringContainsString('RelatedProduct-product_area', $crawler->html()); } /** diff --git a/phpunit.xml.dist b/phpunit.xml.dist index c49eb2e..c77d321 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -13,6 +13,7 @@ + @@ -45,4 +46,4 @@ - \ No newline at end of file + From 1ef99110bc4cb7e70e28f831e2b78c6e301e0a17 Mon Sep 17 00:00:00 2001 From: Chihiro Adachi <8196725+chihiro-adachi@users.noreply.github.com> Date: Fri, 17 Jun 2022 13:10:11 +0900 Subject: [PATCH 3/3] =?UTF-8?q?CI=E3=81=AE=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 235 ++++++++++++++++++------------------- 1 file changed, 113 insertions(+), 122 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fde4a3e..8960c2c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: CI for RelatedProduct4 +name: CI for RelatedProduct42 on: push: branches: @@ -22,38 +22,42 @@ jobs: fail-fast: false matrix: operating-system: [ ubuntu-18.04 ] - php: [ '7.1', '7.2', '7.3', '7.4' ] - db: [ mysql, pgsql ] - eccube_version: [ '4.0.6-p1', '4.1' ] - plugin_code: [ 'RelatedProduct4' ] + php: [ '7.4', '8.0', '8.1' ] + db: [ 'mysql', 'mysql8', 'pgsql' ] + eccube_version: [ '4.2' ] + plugin_code: [ 'RelatedProduct42' ] include: - - eccube_version: '4.0.6-p1' - composer: 'v1' - - eccube_version: '4.1' - composer: 'v2' - db: mysql - dbport: '3306' - dbuser: 'root' - dbpass: 'root' - dbname: 'myapp_test' - dbversion: 5.7 + database_url: mysql://root:password@127.0.0.1:3306/eccube_db + database_server_version: 5.7 + database_charset: utf8mb4 + - db: mysql8 + database_url: mysql://root:password@127.0.0.1:3308/eccube_db + database_server_version: 8 + database_charset: utf8mb4 - db: pgsql - dbport: '5432' - dbuser: 'postgres' - dbpass: 'password' - dbname: 'myapp_test' - dbversion: 9.5 + database_url: postgres://postgres:password@127.0.0.1:5432/eccube_db + database_server_version: 14 + database_charset: utf8 services: mysql: image: mysql:5.7 env: - MYSQL_ROOT_PASSWORD: root + MYSQL_ROOT_PASSWORD: password MYSQL_DATABASE: ${{ matrix.dbname }} ports: - 3306:3306 options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + mysql8: + image: mysql:8 + env: + MYSQL_ROOT_PASSWORD: password + MYSQL_DATABASE: ${{ matrix.dbname }} + ports: + - 3308:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 postgres: - image: postgres:9.5 + image: postgres:14 env: POSTGRES_USER: postgres POSTGRES_PASSWORD: password @@ -68,110 +72,97 @@ jobs: - 1080:1080 - 1025:1025 steps: - - run: sudo apt-get purge -y hhvm - - name: Checkout - uses: actions/checkout@v2 - - - name: Setup PHP - uses: nanasess/setup-php@master - with: - php-version: ${{ matrix.php }} - - - name: Archive Plugin - env: - PLUGIN_CODE: ${{ matrix.plugin_code }} - run: | - tar cvzf ${GITHUB_WORKSPACE}/${PLUGIN_CODE}.tar.gz ./* - - name: Checkout EC-CUBE - uses: actions/checkout@v2 - with: - repository: 'EC-CUBE/ec-cube' - ref: ${{ matrix.eccube_version }} - path: 'ec-cube' - - - name: Get Composer Cache Directory - id: composer-cache - run: | - echo "::set-output name=dir::$(composer config cache-files-dir)" - - - uses: actions/cache@v1 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- - - - if: matrix.composer == 'v1' - run: sudo composer selfupdate --1 + - run: sudo apt-get purge -y hhvm + - name: Checkout + uses: actions/checkout@v2 - - name: Install to composer - working-directory: 'ec-cube' - run: composer install --no-interaction -o --apcu-autoloader + - name: Setup PHP + uses: nanasess/setup-php@master + with: + php-version: ${{ matrix.php }} - - if: matrix.composer == 'v1' - working-directory: 'ec-cube' - run: composer require kiy0taka/eccube4-test-fixer "dev-main@dev" - - - name: Setup EC-CUBE - env: - DB: ${{ matrix.db }} - USER: ${{ matrix.dbuser }} - DBUSER: ${{ matrix.dbuser }} - DBPASS: ${{ matrix.dbpass }} - DBNAME: ${{ matrix.dbname }} - DBPORT: ${{ matrix.dbport }} - DBSERVER: 127.0.0.1 - DBVERSION: ${{ matrix.dbversion }} - ROOT_URLPATH: /ec-cube/html - working-directory: 'ec-cube' - run: | - export PGPASSWORD=${DBPASS} - echo "APP_ENV=prod" > .env - echo "APP_DEBUG=0" >> .env - echo "DATABASE_URL=${DB}://${DBUSER}:${DBPASS}@${DBSERVER}/${DBNAME}" >> .env - echo "DATABASE_SERVER_VERSION=${DBVERSION}" >> .env - echo "MAILER_URL=smtp://127.0.0.1:1025" >> .env - echo "HTTP_SITEURL=https://localhost" >> .env - echo "USE_SELFSIGNED_SSL_CERTIFICATE=1" >> .env - cat .env - bin/console doctrine:schema:create - bin/console eccube:fixtures:load - - - name: Setup Plugin - env: - PLUGIN_CODE: ${{ matrix.plugin_code }} - working-directory: 'ec-cube' - run: | - bin/console eccube:plugin:install --code=${PLUGIN_CODE} --path=${GITHUB_WORKSPACE}/${PLUGIN_CODE}.tar.gz - bin/console eccube:plugin:enable --code=${PLUGIN_CODE} - rm codeception/_support/*Tester.php + - name: Archive Plugin + env: + PLUGIN_CODE: ${{ matrix.plugin_code }} + run: | + tar cvzf ${GITHUB_WORKSPACE}/${PLUGIN_CODE}.tar.gz ./* + - name: Checkout EC-CUBE + uses: actions/checkout@v2 + with: + repository: 'EC-CUBE/ec-cube' + ref: ${{ matrix.eccube_version }} + path: 'ec-cube' - - name: Run PHPUnit - if: matrix.composer == 'v2' - env: - PLUGIN_CODE: ${{ matrix.plugin_code }} - working-directory: 'ec-cube' - run: bin/phpunit -c app/Plugin/${PLUGIN_CODE}/phpunit.xml.dist app/Plugin/${PLUGIN_CODE}/Tests + - name: Get Composer Cache Directory + id: composer-cache + run: | + echo "::set-output name=dir::$(composer config cache-files-dir)" + - uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + - name: Install to composer + working-directory: 'ec-cube' + run: composer install --no-interaction -o --apcu-autoloader - - name: Run PHPUnit - if: matrix.composer == 'v1' - env: - PLUGIN_CODE: ${{ matrix.plugin_code }} - working-directory: 'ec-cube' - run: | - find app/Plugin/${PLUGIN_CODE}/Tests -name "*Test.php" | while read TESTCASE - do - ./vendor/bin/phpunit -c app/Plugin/${PLUGIN_CODE}/phpunit.xml.dist --include-path vendor/kiy0taka/eccube4-test-fixer/src --loader 'Eccube\PHPUnit\Loader\Eccube4CompatTestSuiteLoader' ${TESTCASE} - done + - name: Setup EC-CUBE + env: + APP_ENV: 'test' + APP_DEBUG: 0 + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + DATABASE_CHARSET: ${{ matrix.database_charset }} + working-directory: 'ec-cube' + run: | + bin/console doctrine:database:create + bin/console doctrine:schema:create + bin/console eccube:fixtures:load + - name: Setup Plugin + env: + APP_ENV: 'test' + APP_DEBUG: 0 + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + DATABASE_CHARSET: ${{ matrix.database_charset }} + PLUGIN_CODE: ${{ matrix.plugin_code }} + working-directory: 'ec-cube' + run: | + bin/console eccube:plugin:install --code=${PLUGIN_CODE} --path=${GITHUB_WORKSPACE}/${PLUGIN_CODE}.tar.gz + bin/console cache:clear --no-warmup + bin/console eccube:plugin:enable --code=${PLUGIN_CODE} + - name: Run PHPUnit + env: + APP_ENV: 'test' + APP_DEBUG: 0 + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + DATABASE_CHARSET: ${{ matrix.database_charset }} + PLUGIN_CODE: ${{ matrix.plugin_code }} + 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 - - name: Disable Plugin - working-directory: 'ec-cube' - env: - PLUGIN_CODE: ${{ matrix.plugin_code }} - run: bin/console eccube:plugin:disable --code=${PLUGIN_CODE} + - name: Disable Plugin + working-directory: 'ec-cube' + env: + APP_ENV: 'test' + APP_DEBUG: 0 + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + DATABASE_CHARSET: ${{ matrix.database_charset }} + PLUGIN_CODE: ${{ matrix.plugin_code }} + run: bin/console eccube:plugin:disable --code=${PLUGIN_CODE} - - name: Uninstall Plugin - env: - PLUGIN_CODE: ${{ matrix.plugin_code }} - working-directory: 'ec-cube' - run: bin/console eccube:plugin:uninstall --code=${PLUGIN_CODE} + - name: Uninstall Plugin + env: + APP_ENV: 'test' + APP_DEBUG: 0 + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + DATABASE_CHARSET: ${{ matrix.database_charset }} + PLUGIN_CODE: ${{ matrix.plugin_code }} + working-directory: 'ec-cube' + run: bin/console eccube:plugin:uninstall --code=${PLUGIN_CODE}