From f0cbddd29488288b66bc38a086baacbfcd7f33ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=A0=20=E6=81=A9=E6=A8=B9?= Date: Tue, 5 Mar 2024 10:39:38 +0900 Subject: [PATCH 01/17] =?UTF-8?q?=E3=83=90=E3=83=AA=E3=83=87=E3=83=BC?= =?UTF-8?q?=E3=82=B7=E3=83=A7=E3=83=B3=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Store/OwnerStoreController.php | 45 +++++++++++++++---- .../Web/Admin/Store/PluginControllerTest.php | 39 ++++++++++++++++ 2 files changed, 76 insertions(+), 8 deletions(-) diff --git a/src/Eccube/Controller/Admin/Store/OwnerStoreController.php b/src/Eccube/Controller/Admin/Store/OwnerStoreController.php index 6b703140698..5a683773c96 100644 --- a/src/Eccube/Controller/Admin/Store/OwnerStoreController.php +++ b/src/Eccube/Controller/Admin/Store/OwnerStoreController.php @@ -32,6 +32,8 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Validator\Constraints as Assert; +use Symfony\Component\Validator\Validator\ValidatorInterface; /** * @Route("/%eccube_admin_route%/store/plugin/api") @@ -63,6 +65,11 @@ class OwnerStoreController extends AbstractController */ protected $pluginApiService; + /** + * @var ValidatorInterface + */ + protected $validator; + private static $vendorName = 'ec-cube'; /** @var BaseInfo */ @@ -81,6 +88,7 @@ class OwnerStoreController extends AbstractController * @param PluginApiService $pluginApiService * @param BaseInfoRepository $baseInfoRepository * @param CacheUtil $cacheUtil + * @param ValidatorInterface $validatorInterface * * @throws \Doctrine\ORM\NoResultException * @throws \Doctrine\ORM\NonUniqueResultException @@ -92,7 +100,8 @@ public function __construct( SystemService $systemService, PluginApiService $pluginApiService, BaseInfoRepository $baseInfoRepository, - CacheUtil $cacheUtil + CacheUtil $cacheUtil, + ValidatorInterface $validatorInterface ) { $this->pluginRepository = $pluginRepository; $this->pluginService = $pluginService; @@ -100,6 +109,7 @@ public function __construct( $this->pluginApiService = $pluginApiService; $this->BaseInfo = $baseInfoRepository->get(); $this->cacheUtil = $cacheUtil; + $this->validator = $validatorInterface; // TODO: Check the flow of the composer service below $this->composerService = $composerService; @@ -266,14 +276,33 @@ public function apiInstall(Request $request) $pluginCode = $request->get('pluginCode'); - $log = null; - try { - $log = $this->composerService->execRequire('ec-cube/'.$pluginCode); + $errors = $this->validator->validate( + $pluginCode, + [ + new Assert\NotBlank(), + new Assert\Regex( + [ + 'pattern' => '/^[a-zA-Z0-9_]+$/', + ] + ), + ] + ); - return $this->json(['success' => true, 'log' => $log]); - } catch (\Exception $e) { - $log = $e->getMessage(); - log_error($e); + $log = null; + if ($errors->count() != 0) { + $log = []; + foreach ($errors as $error) { + $log[] = $error->getMessage(); + } + } else { + try { + $log = $this->composerService->execRequire('ec-cube/'.$pluginCode); + + return $this->json(['success' => true, 'log' => $log]); + } catch (\Exception $e) { + $log = $e->getMessage(); + log_error($e); + } } return $this->json(['success' => false, 'log' => $log], 500); diff --git a/tests/Eccube/Tests/Web/Admin/Store/PluginControllerTest.php b/tests/Eccube/Tests/Web/Admin/Store/PluginControllerTest.php index d12df535949..a4b7e06fd0d 100644 --- a/tests/Eccube/Tests/Web/Admin/Store/PluginControllerTest.php +++ b/tests/Eccube/Tests/Web/Admin/Store/PluginControllerTest.php @@ -50,4 +50,43 @@ public function testSubmit() $this->actual = $this->container->get(BaseInfoRepository::class)->get()->getPhpPath(); $this->verify(); } + + /** + * 異常系を確認。正常系のインストールはE2Eテストの方で実施 + * + * @dataProvider OwnerStoreInstallParam + * + */ + public function testFailureInstall($param1, $param2, $message) + { + $form = [ + 'pluginCode' => $param1, + 'version' => $param2, + ]; + + $crawler = $this->client->request('POST', + $this->generateUrl('admin_store_plugin_api_install', $form), + [], + [], + [ + 'HTTP_X-Requested-With' => 'XMLHttpRequest', + 'CONTENT_TYPE' => 'application/json', + ] + ); + // ダウンロードできないことを確認 + $this->assertEquals(500, $this->client->getResponse()->getStatusCode()); + // ログを確認 + $this->assertContains($message, json_decode($this->client->getResponse()->getContent())->log); + } + + /** + * 異常系のテストケース + */ + public function OwnerStoreInstallParam() + { + return [ + ['api+symfony/yaml:5.3', '2.1.3', '有効な値ではありません。'], + ['', '2.1.3','入力されていません。'], + ]; + } } From 910debb5c15b96a5afe96316790940685f6e73ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=A0=20=E6=81=A9=E6=A8=B9?= Date: Tue, 5 Mar 2024 15:23:22 +0900 Subject: [PATCH 02/17] =?UTF-8?q?=E8=A1=8C=E3=81=8C=E7=A9=BA=E7=99=BD?= =?UTF-8?q?=E3=81=AE=E5=A0=B4=E5=90=88=E3=80=81Skip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/Eccube/Tests/Service/CsvImportServiceTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/Eccube/Tests/Service/CsvImportServiceTest.php b/tests/Eccube/Tests/Service/CsvImportServiceTest.php index 36b5e625437..3091b3d68fe 100644 --- a/tests/Eccube/Tests/Service/CsvImportServiceTest.php +++ b/tests/Eccube/Tests/Service/CsvImportServiceTest.php @@ -94,6 +94,9 @@ public function testReadCsvFileWithTrailingBlankLines() $CsvImportService->setColumnHeaders(['id', 'number', 'description']); foreach ($CsvImportService as $row) { + if (empty(array_filter($row))) { + continue; + } $this->assertNotNull($row['id']); $this->assertNotNull($row['number']); $this->assertNotNull($row['description']); From 0dac57aa406dc19aff3869cae0223f2efd162657 Mon Sep 17 00:00:00 2001 From: ji-eunsoo <132241702+ji-eunsoo@users.noreply.github.com> Date: Tue, 5 Mar 2024 15:43:56 +0900 Subject: [PATCH 03/17] Update CsvImportServiceTest.php --- tests/Eccube/Tests/Service/CsvImportServiceTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Eccube/Tests/Service/CsvImportServiceTest.php b/tests/Eccube/Tests/Service/CsvImportServiceTest.php index 3091b3d68fe..c137733b6d3 100644 --- a/tests/Eccube/Tests/Service/CsvImportServiceTest.php +++ b/tests/Eccube/Tests/Service/CsvImportServiceTest.php @@ -97,6 +97,7 @@ public function testReadCsvFileWithTrailingBlankLines() if (empty(array_filter($row))) { continue; } + $this->assertNotNull($row['id']); $this->assertNotNull($row['number']); $this->assertNotNull($row['description']); From 684b6c4030f26e15cd431925f40265fc1fc7ef6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=A0=20=E6=81=A9=E6=A8=B9?= Date: Tue, 5 Mar 2024 18:41:09 +0900 Subject: [PATCH 04/17] =?UTF-8?q?wait=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- codeception/acceptance/EF03OrderCest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/codeception/acceptance/EF03OrderCest.php b/codeception/acceptance/EF03OrderCest.php index 174c7bf3077..bf8337dab8f 100644 --- a/codeception/acceptance/EF03OrderCest.php +++ b/codeception/acceptance/EF03OrderCest.php @@ -123,9 +123,13 @@ public function order_カート数量減らす(\AcceptanceTester $I) ProductDetailPage::go($I, 2) ->カートに入れる(2) ->カートへ進む(); + + $I->wait(1); $cartPage = CartPage::go($I) ->商品数量減らす(1); + + $I->wait(1); // 確認 $I->assertEquals('1', $cartPage->商品数量(1)); From c797de600810791e17948182f3c0414b862e5850 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=A0=20=E6=81=A9=E6=A8=B9?= Date: Tue, 5 Mar 2024 19:07:46 +0900 Subject: [PATCH 05/17] =?UTF-8?q?wait=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- codeception/acceptance/EF02ProductCest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/codeception/acceptance/EF02ProductCest.php b/codeception/acceptance/EF02ProductCest.php index 24630532375..f4822b6d8a0 100644 --- a/codeception/acceptance/EF02ProductCest.php +++ b/codeception/acceptance/EF02ProductCest.php @@ -68,12 +68,16 @@ public function product_商品一覧ソート(\AcceptanceTester $I) } $I->assertTrue(($pPos < $fPos)); + $I->wait(1); + $listPage = new ProductListPage($I); // ソート条件の選択リストを変更する 価格順->新着順 $listPage ->表示件数設定(40) ->表示順設定('新着順'); + $I->wait(1); + // 変更されたソート条件に従い、商品がソートされる $products = $I->grabMultiple(['xpath' => "//*[@class='ec-shelfGrid__item']/a/p[1]"]); $pPos = 0; From 481da38b4514e6ecf7cf5b4e6df08859b76f6b45 Mon Sep 17 00:00:00 2001 From: ji-eunsoo <132241702+ji-eunsoo@users.noreply.github.com> Date: Wed, 6 Mar 2024 17:12:29 +0900 Subject: [PATCH 06/17] =?UTF-8?q?wait=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- codeception/acceptance/EF02ProductCest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/codeception/acceptance/EF02ProductCest.php b/codeception/acceptance/EF02ProductCest.php index f4822b6d8a0..8a8dbba41c8 100644 --- a/codeception/acceptance/EF02ProductCest.php +++ b/codeception/acceptance/EF02ProductCest.php @@ -58,6 +58,7 @@ public function product_商品一覧ソート(\AcceptanceTester $I) $products = $I->grabMultiple(['xpath' => "//*[@class='ec-shelfGrid__item']/a/p[2]"]); $pPos = 0; $fPos = 0; + $I->wait(1); foreach ($products as $key => $product) { if ($product == 'チェリーアイスサンド') { $pPos = $key; @@ -82,6 +83,9 @@ public function product_商品一覧ソート(\AcceptanceTester $I) $products = $I->grabMultiple(['xpath' => "//*[@class='ec-shelfGrid__item']/a/p[1]"]); $pPos = 0; $fPos = 0; + + $I->wait(1); + foreach ($products as $key => $product) { if ($product == 'チェリーアイスサンド') { $pPos = $key; From bed956cfb41bfbfd9416a688c47ac9c311042201 Mon Sep 17 00:00:00 2001 From: ji-eunsoo <132241702+ji-eunsoo@users.noreply.github.com> Date: Wed, 6 Mar 2024 17:30:01 +0900 Subject: [PATCH 07/17] =?UTF-8?q?wait=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- codeception/acceptance/EF02ProductCest.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/codeception/acceptance/EF02ProductCest.php b/codeception/acceptance/EF02ProductCest.php index 8a8dbba41c8..24630532375 100644 --- a/codeception/acceptance/EF02ProductCest.php +++ b/codeception/acceptance/EF02ProductCest.php @@ -58,7 +58,6 @@ public function product_商品一覧ソート(\AcceptanceTester $I) $products = $I->grabMultiple(['xpath' => "//*[@class='ec-shelfGrid__item']/a/p[2]"]); $pPos = 0; $fPos = 0; - $I->wait(1); foreach ($products as $key => $product) { if ($product == 'チェリーアイスサンド') { $pPos = $key; @@ -69,23 +68,16 @@ public function product_商品一覧ソート(\AcceptanceTester $I) } $I->assertTrue(($pPos < $fPos)); - $I->wait(1); - $listPage = new ProductListPage($I); // ソート条件の選択リストを変更する 価格順->新着順 $listPage ->表示件数設定(40) ->表示順設定('新着順'); - $I->wait(1); - // 変更されたソート条件に従い、商品がソートされる $products = $I->grabMultiple(['xpath' => "//*[@class='ec-shelfGrid__item']/a/p[1]"]); $pPos = 0; $fPos = 0; - - $I->wait(1); - foreach ($products as $key => $product) { if ($product == 'チェリーアイスサンド') { $pPos = $key; From 43d28b2544a270e379728f477006133ef35ba56b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=A0=20=E6=81=A9=E6=A8=B9?= Date: Thu, 7 Mar 2024 16:45:22 +0900 Subject: [PATCH 08/17] =?UTF-8?q?E2E=E3=83=86=E3=82=B9=E3=83=88=E3=81=8C?= =?UTF-8?q?=E5=9B=9E=E3=82=8B=E3=81=8B=E7=A2=BA=E8=AA=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/action.yml | 3 +++ codeception/_envs/github_action.yml | 1 + codeception/acceptance/EF02ProductCest.php | 9 +++++++++ 3 files changed, 13 insertions(+) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index d4f0d0d07f7..bbf98dfee8a 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -186,6 +186,9 @@ jobs: - name: setup-chromedriver uses: nanasess/setup-chromedriver@master + - name: Install fonts + run: sudo apt install fonts-ipafont fonts-ipaexfont + - name: Run chromedriver run: | export DISPLAY=:99 diff --git a/codeception/_envs/github_action.yml b/codeception/_envs/github_action.yml index 04907352348..a009f2de6ee 100644 --- a/codeception/_envs/github_action.yml +++ b/codeception/_envs/github_action.yml @@ -8,6 +8,7 @@ modules: chromeOptions: prefs: download.default_directory: '%GITHUB_WORKSPACE%/codeception/_support/_downloads' + wait: 30 MailCatcher: url: 'localhost' port: 1080 diff --git a/codeception/acceptance/EF02ProductCest.php b/codeception/acceptance/EF02ProductCest.php index 24630532375..c5ebe21ba3b 100644 --- a/codeception/acceptance/EF02ProductCest.php +++ b/codeception/acceptance/EF02ProductCest.php @@ -54,10 +54,15 @@ public function product_商品一覧ソート(\AcceptanceTester $I) // TOPページ>商品一覧(ヘッダーのいずれかのカテゴリを選択)へ遷移 $topPage->カテゴリ選択(['新入荷']); + $I->wait(10); + // 各商品のサムネイルが表示される デフォルトは価格順 $products = $I->grabMultiple(['xpath' => "//*[@class='ec-shelfGrid__item']/a/p[2]"]); $pPos = 0; $fPos = 0; + + $I->wait(10); + foreach ($products as $key => $product) { if ($product == 'チェリーアイスサンド') { $pPos = $key; @@ -74,10 +79,14 @@ public function product_商品一覧ソート(\AcceptanceTester $I) ->表示件数設定(40) ->表示順設定('新着順'); + $I->wait(10); // 変更されたソート条件に従い、商品がソートされる $products = $I->grabMultiple(['xpath' => "//*[@class='ec-shelfGrid__item']/a/p[1]"]); $pPos = 0; $fPos = 0; + + $I->wait(10); + foreach ($products as $key => $product) { if ($product == 'チェリーアイスサンド') { $pPos = $key; From 7fe8f22009c82e01864ae16012ad3f08f9ba7b7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=A0=20=E6=81=A9=E6=A8=B9?= Date: Fri, 8 Mar 2024 09:40:05 +0900 Subject: [PATCH 09/17] =?UTF-8?q?ubuntu=E3=83=90=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E3=83=A7=E3=83=B3=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/action.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index bbf98dfee8a..e00bb9863d5 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - operating-system: [ ubuntu-20.04 ] + operating-system: [ ubuntu-22.04 ] php: [ 7.4 ] db: [ mysql, pgsql, sqlite3 ] include: @@ -112,7 +112,7 @@ jobs: strategy: fail-fast: false matrix: - operating-system: [ ubuntu-20.04 ] + operating-system: [ ubuntu-22.04 ] php: [ 7.4 ] db: [ pgsql ] group: [ admin01, admin02, admin03, front, installer ] @@ -238,7 +238,7 @@ jobs: strategy: fail-fast: false matrix: - operating-system: [ ubuntu-20.04 ] + operating-system: [ ubuntu-22.04 ] php: [ 7.4 ] db: [ pgsql, mysql ] method: @@ -384,7 +384,7 @@ jobs: strategy: fail-fast: false matrix: - operating-system: [ ubuntu-20.04 ] + operating-system: [ ubuntu-22.04 ] php: [ 7.4 ] db: [ pgsql, mysql ] method: @@ -528,7 +528,7 @@ jobs: strategy: fail-fast: false matrix: - operating-system: [ ubuntu-20.04 ] + operating-system: [ ubuntu-22.04 ] php: [ 7.4 ] db: [ pgsql, mysql ] method: @@ -672,7 +672,7 @@ jobs: strategy: fail-fast: false matrix: - operating-system: [ ubuntu-20.04 ] + operating-system: [ ubuntu-22.04 ] php: [ 7.4 ] db: [ pgsql, mysql ] method: @@ -815,7 +815,7 @@ jobs: deploy: name: Deploy - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Checkout if: github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'prereleased' ) From 6f73121a79fa189cbfb489486b3e97171c153399 Mon Sep 17 00:00:00 2001 From: ji-eunsoo <132241702+ji-eunsoo@users.noreply.github.com> Date: Fri, 8 Mar 2024 11:52:26 +0900 Subject: [PATCH 10/17] =?UTF-8?q?wait=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- codeception/acceptance/EF02ProductCest.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/codeception/acceptance/EF02ProductCest.php b/codeception/acceptance/EF02ProductCest.php index c5ebe21ba3b..24630532375 100644 --- a/codeception/acceptance/EF02ProductCest.php +++ b/codeception/acceptance/EF02ProductCest.php @@ -54,15 +54,10 @@ public function product_商品一覧ソート(\AcceptanceTester $I) // TOPページ>商品一覧(ヘッダーのいずれかのカテゴリを選択)へ遷移 $topPage->カテゴリ選択(['新入荷']); - $I->wait(10); - // 各商品のサムネイルが表示される デフォルトは価格順 $products = $I->grabMultiple(['xpath' => "//*[@class='ec-shelfGrid__item']/a/p[2]"]); $pPos = 0; $fPos = 0; - - $I->wait(10); - foreach ($products as $key => $product) { if ($product == 'チェリーアイスサンド') { $pPos = $key; @@ -79,14 +74,10 @@ public function product_商品一覧ソート(\AcceptanceTester $I) ->表示件数設定(40) ->表示順設定('新着順'); - $I->wait(10); // 変更されたソート条件に従い、商品がソートされる $products = $I->grabMultiple(['xpath' => "//*[@class='ec-shelfGrid__item']/a/p[1]"]); $pPos = 0; $fPos = 0; - - $I->wait(10); - foreach ($products as $key => $product) { if ($product == 'チェリーアイスサンド') { $pPos = $key; From 64d0e62ddadedc28022c260e18fc685065f60ab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=A0=20=E6=81=A9=E6=A8=B9?= Date: Wed, 13 Mar 2024 15:45:47 +0900 Subject: [PATCH 11/17] =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88?= =?UTF-8?q?=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Eccube/Controller/Admin/Store/OwnerStoreController.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Eccube/Controller/Admin/Store/OwnerStoreController.php b/src/Eccube/Controller/Admin/Store/OwnerStoreController.php index 5a683773c96..9ab11bbec2e 100644 --- a/src/Eccube/Controller/Admin/Store/OwnerStoreController.php +++ b/src/Eccube/Controller/Admin/Store/OwnerStoreController.php @@ -288,7 +288,6 @@ public function apiInstall(Request $request) ] ); - $log = null; if ($errors->count() != 0) { $log = []; foreach ($errors as $error) { From e5b9be3e3a654b3428ea886db04c737d95f950bd Mon Sep 17 00:00:00 2001 From: ji-eunsoo <132241702+ji-eunsoo@users.noreply.github.com> Date: Thu, 14 Mar 2024 15:22:21 +0900 Subject: [PATCH 12/17] =?UTF-8?q?wait=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- codeception/_support/Page/Front/ProductListPage.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/codeception/_support/Page/Front/ProductListPage.php b/codeception/_support/Page/Front/ProductListPage.php index 233d76d6a78..f9a5820e766 100644 --- a/codeception/_support/Page/Front/ProductListPage.php +++ b/codeception/_support/Page/Front/ProductListPage.php @@ -31,6 +31,7 @@ public function __construct(\AcceptanceTester $I) public function 表示件数設定($num) { $this->tester->selectOption(['css' => "select[name = 'disp_number']"], "${num}件"); + $this->tester->waitForElement(['css' => "select[name='disp_number'] > option[value='${num}'][selected]"]); return $this; } @@ -38,6 +39,7 @@ public function 表示件数設定($num) public function 表示順設定($sort) { $this->tester->selectOption(['css' => "select[name = 'orderby']"], $sort); + $this->tester->waitForElement(['xpath' => "//select[@name='orderby']/option[text()='${sort}']"]); return $this; } From 71a4a72df8dad27efa404201e327d74e93591c11 Mon Sep 17 00:00:00 2001 From: ji-eunsoo <132241702+ji-eunsoo@users.noreply.github.com> Date: Thu, 14 Mar 2024 15:29:07 +0900 Subject: [PATCH 13/17] =?UTF-8?q?wait=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- codeception/_support/Page/Front/ProductListPage.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/codeception/_support/Page/Front/ProductListPage.php b/codeception/_support/Page/Front/ProductListPage.php index f9a5820e766..233d76d6a78 100644 --- a/codeception/_support/Page/Front/ProductListPage.php +++ b/codeception/_support/Page/Front/ProductListPage.php @@ -31,7 +31,6 @@ public function __construct(\AcceptanceTester $I) public function 表示件数設定($num) { $this->tester->selectOption(['css' => "select[name = 'disp_number']"], "${num}件"); - $this->tester->waitForElement(['css' => "select[name='disp_number'] > option[value='${num}'][selected]"]); return $this; } @@ -39,7 +38,6 @@ public function 表示件数設定($num) public function 表示順設定($sort) { $this->tester->selectOption(['css' => "select[name = 'orderby']"], $sort); - $this->tester->waitForElement(['xpath' => "//select[@name='orderby']/option[text()='${sort}']"]); return $this; } From f598cd6237335b0676fdead89d4d606697335bf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=A0=20=E6=81=A9=E6=A8=B9?= Date: Thu, 18 Apr 2024 13:27:46 +0900 Subject: [PATCH 14/17] =?UTF-8?q?=E3=82=A2=E3=83=83=E3=83=97=E3=83=87?= =?UTF-8?q?=E3=83=BC=E3=83=88=E3=81=AB=E5=85=A5=E5=8A=9B=E5=80=A4=E3=81=AE?= =?UTF-8?q?=E5=88=B6=E9=99=90=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Store/OwnerStoreController.php | 53 ++++++++++++++++--- .../Web/Admin/Store/PluginControllerTest.php | 44 +++++++++++++++ 2 files changed, 90 insertions(+), 7 deletions(-) diff --git a/src/Eccube/Controller/Admin/Store/OwnerStoreController.php b/src/Eccube/Controller/Admin/Store/OwnerStoreController.php index 9ab11bbec2e..b839321476a 100644 --- a/src/Eccube/Controller/Admin/Store/OwnerStoreController.php +++ b/src/Eccube/Controller/Admin/Store/OwnerStoreController.php @@ -378,14 +378,53 @@ public function apiUpgrade(Request $request) $pluginCode = $request->get('pluginCode'); $version = $request->get('version'); - $log = null; - try { - $log = $this->composerService->execRequire('ec-cube/'.$pluginCode.':'.$version); + $log = []; + + $errors = $this->validator->validate( + $pluginCode, + [ + new Assert\NotBlank(), + new Assert\Regex( + [ + 'pattern' => '/^[a-zA-Z0-9_]+$/', + ] + ), + ] + ); - return $this->json(['success' => true, 'log' => $log]); - } catch (\Exception $e) { - $log = $e->getMessage(); - log_error($e); + if ($errors->count() != 0) { + foreach ($errors as $error) { + $log[] = $pluginCode.':'.$error->getMessage(); + } + } + + $errors = $this->validator->validate( + $version, + [ + new Assert\NotBlank(), + new Assert\Regex( + [ + 'pattern' => '/^[0-9.]+$/', + ] + ), + ] + ); + + if ($errors->count() != 0) { + foreach ($errors as $error) { + $log[] = $version.':'.$error->getMessage(); + } + } + + if (empty($log)) { + try { + $log = $this->composerService->execRequire('ec-cube/'.$pluginCode.':'.$version); + + return $this->json(['success' => true, 'log' => $log]); + } catch (\Exception $e) { + $log = $e->getMessage(); + log_error($e); + } } return $this->json(['success' => false, 'log' => $log], 500); diff --git a/tests/Eccube/Tests/Web/Admin/Store/PluginControllerTest.php b/tests/Eccube/Tests/Web/Admin/Store/PluginControllerTest.php index a4b7e06fd0d..3fddd3d5321 100644 --- a/tests/Eccube/Tests/Web/Admin/Store/PluginControllerTest.php +++ b/tests/Eccube/Tests/Web/Admin/Store/PluginControllerTest.php @@ -79,6 +79,37 @@ public function testFailureInstall($param1, $param2, $message) $this->assertContains($message, json_decode($this->client->getResponse()->getContent())->log); } + /** + * 異常系を確認。正常系のアップデートはE2Eテストの方で実施 + * + * @dataProvider OwnerStoreUpgradeParam + * + */ + public function testFailureUpgrade($param1, $param2, $message) + { + $form = [ + 'pluginCode' => $param1, + 'version' => $param2, + ]; + + $crawler = $this->client->request('POST', + $this->generateUrl('admin_store_plugin_api_upgrade', $form), + [], + [], + [ + 'HTTP_X-Requested-With' => 'XMLHttpRequest', + 'CONTENT_TYPE' => 'application/json', + ] + ); + // ダウンロードできないことを確認 + $this->assertEquals(500, $this->client->getResponse()->getStatusCode()); + + // ログを確認 + $this->assertTrue(strpos(implode(',', json_decode($this->client->getResponse()->getContent())->log), $message) !== false); + + #$this->assertStringContainsString($message, implode(',', json_decode($this->client->getResponse()->getContent())->log)); + } + /** * 異常系のテストケース */ @@ -89,4 +120,17 @@ public function OwnerStoreInstallParam() ['', '2.1.3','入力されていません。'], ]; } + + /** + * 異常系のテストケース + */ + public function OwnerStoreUpgradeParam() + { + return [ + ['api+symfony/yaml:5.3', '2.1.3', '有効な値ではありません。'], + ['api', '2.1.3+symfony/yaml:5.3', '有効な値ではありません。'], + ['', '2.1.3','入力されていません。'], + ['api', '','入力されていません。'], + ]; + } } From adb1f632e6bd6b9bb394e87fc38895054cc38bb2 Mon Sep 17 00:00:00 2001 From: ji-eunsoo <132241702+ji-eunsoo@users.noreply.github.com> Date: Thu, 18 Apr 2024 15:03:13 +0900 Subject: [PATCH 15/17] =?UTF-8?q?=E4=B8=8D=E8=A6=81=E3=81=AA=E3=82=B3?= =?UTF-8?q?=E3=83=A1=E3=83=B3=E3=83=88=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/Eccube/Tests/Web/Admin/Store/PluginControllerTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/Eccube/Tests/Web/Admin/Store/PluginControllerTest.php b/tests/Eccube/Tests/Web/Admin/Store/PluginControllerTest.php index 3fddd3d5321..2ffca3625c3 100644 --- a/tests/Eccube/Tests/Web/Admin/Store/PluginControllerTest.php +++ b/tests/Eccube/Tests/Web/Admin/Store/PluginControllerTest.php @@ -106,8 +106,6 @@ public function testFailureUpgrade($param1, $param2, $message) // ログを確認 $this->assertTrue(strpos(implode(',', json_decode($this->client->getResponse()->getContent())->log), $message) !== false); - - #$this->assertStringContainsString($message, implode(',', json_decode($this->client->getResponse()->getContent())->log)); } /** From 891a3142865f518cede9154bf98c78426170df60 Mon Sep 17 00:00:00 2001 From: ji-eunsoo <132241702+ji-eunsoo@users.noreply.github.com> Date: Thu, 18 Apr 2024 15:11:59 +0900 Subject: [PATCH 16/17] =?UTF-8?q?=E5=A4=96=E9=83=A8=E3=81=AE=E5=85=A5?= =?UTF-8?q?=E5=8A=9B=E5=80=A4=E3=81=AE=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Eccube/Controller/Admin/Store/OwnerStoreController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Eccube/Controller/Admin/Store/OwnerStoreController.php b/src/Eccube/Controller/Admin/Store/OwnerStoreController.php index b839321476a..fbfaad578c5 100644 --- a/src/Eccube/Controller/Admin/Store/OwnerStoreController.php +++ b/src/Eccube/Controller/Admin/Store/OwnerStoreController.php @@ -394,7 +394,7 @@ public function apiUpgrade(Request $request) if ($errors->count() != 0) { foreach ($errors as $error) { - $log[] = $pluginCode.':'.$error->getMessage(); + $log[] = $error->getMessage(); } } @@ -412,7 +412,7 @@ public function apiUpgrade(Request $request) if ($errors->count() != 0) { foreach ($errors as $error) { - $log[] = $version.':'.$error->getMessage(); + $log[] = $error->getMessage(); } } From a1f68a9991406dfab8522a149e5feba878da01db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=A0=20=E6=81=A9=E6=A8=B9?= Date: Tue, 23 Jul 2024 13:47:04 +0900 Subject: [PATCH 17/17] =?UTF-8?q?=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7?= =?UTF-8?q?=E3=83=B3=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 2 +- package.json | 2 +- src/Eccube/Common/Constant.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index a585b51a048..e33d65a823a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "eccube", - "version": "4.0.6-p4", + "version": "4.0.6-p5", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 1af3bf261a8..6ad97f26d86 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eccube", - "version": "4.0.6-p4", + "version": "4.0.6-p5", "description": "EC-CUBE EC open platform.", "main": "index.js", "directories": { diff --git a/src/Eccube/Common/Constant.php b/src/Eccube/Common/Constant.php index c8cd428abf3..c9c8892a7aa 100644 --- a/src/Eccube/Common/Constant.php +++ b/src/Eccube/Common/Constant.php @@ -18,7 +18,7 @@ class Constant /** * EC-CUBE VERSION. */ - const VERSION = '4.0.6-p4'; + const VERSION = '4.0.6-p5'; /** * Enable value.