diff --git a/.claude/skills/eccube-contributing/SKILL.md b/.claude/skills/eccube-contributing/SKILL.md index 9b80879fd44..0303f465f16 100644 --- a/.claude/skills/eccube-contributing/SKILL.md +++ b/.claude/skills/eccube-contributing/SKILL.md @@ -52,7 +52,7 @@ PR では以下が GitHub Actions で走る。**同じものを手元で先に | コードスタイル(`php-cs-fixer.yml`) | `php vendor/bin/php-cs-fixer fix --diff --dry-run --allow-risky=yes` | `vendor/bin/php-cs-fixer fix`(自動修正) | | 静的解析(`phpstan.yml`) | `vendor/bin/phpstan analyze src/ --error-format=github` | `vendor/bin/phpstan analyse src`(level 6) | | リファクタ規約(`rector.yml`) | `vendor/bin/rector process --dry-run --ansi --config=rector.php` | `vendor/bin/rector process`(差分適用) | -| ユニットテスト(`unit-test.yml`) | `vendor/bin/phpunit`(一部グループは分割実行) | 変更に関係するテストを `bin/phpunit ` | +| ユニットテスト(`unit-test.yml`) | `vendor/bin/phpunit`(一部グループは分割実行) | 変更に関係するテストを `vendor/bin/phpunit ` | - このほか **E2E(`e2e-test.yml`)・プラグインテスト(`plugin-test.yml`)・セキュリティスキャン(zaproxy/vaddy)** が走る。重いので CI に任せてよいが、落ちたら該当ジョブのログを読む。 - **rector は関門になりやすい**(PHP/Symfony/Doctrine の機械的な現代化を強制)。`--dry-run` で出た差分は基本そのまま適用する。 @@ -65,6 +65,7 @@ PR では以下が GitHub Actions で走る。**同じものを手元で先に - ❌ 機能追加なのにテスト無し / 既存テストを壊す → ✅ テストを伴わせ、関連テストを実行 - ❌ マイナー互換を壊す変更(既存シグネチャ・フック・CSV 仕様の変更)を含める → ✅ 互換チェックリストを確認し、壊す場合は別途相談 - ❌ PR テンプレートの節を空のまま提出 → ✅ 概要・方針・テスト範囲・互換性チェックを埋める +- ❌ `@deprecated` な public API・定数の削除を `src/` と PHPUnit の grep だけで「呼び出し元なし」と判定 → ✅ `e2e/`(Playwright の globalSetup が実行する `setup-fixtures.php`)と `codeception/`(VAddy スキャンが `codecept -g vaddy` を実行)も走査対象に含め、全ツリー `git grep` で 0 件を確認する ## 実行・確認方法 @@ -75,7 +76,7 @@ PR では以下が GitHub Actions で走る。**同じものを手元で先に vendor/bin/php-cs-fixer fix --dry-run --diff vendor/bin/phpstan analyse src vendor/bin/rector process --dry-run --config=rector.php -bin/phpunit <変更に関係するテスト> +vendor/bin/phpunit <変更に関係するテスト> ``` - CI が落ちたら、まず該当ジョブのログで「どのゲート・どのファイル・どのルール」かを特定し、ローカルで同じコマンドを再現して直す。 diff --git a/.claude/skills/eccube-phpunit/SKILL.md b/.claude/skills/eccube-phpunit/SKILL.md index ddfb6b1833c..ab08ff72748 100644 --- a/.claude/skills/eccube-phpunit/SKILL.md +++ b/.claude/skills/eccube-phpunit/SKILL.md @@ -6,7 +6,7 @@ description: EC-CUBE 4.4 の PHPUnit テストを実装・修正するときの # PHPUnit テスト規約(EC-CUBE 4.4) **対象**: `tests/Eccube/Tests/**/*Test.php` -**前提**: PHPUnit 11(`symfony/phpunit-bridge` 経由)/ PHP 8.2+ / Symfony 7.4 +**前提**: PHPUnit 11(`vendor/bin/phpunit` を直接実行)/ PHP 8.2+ / Symfony 7.4 ## 基本ルール @@ -113,16 +113,19 @@ public static function provideStatuses(): array - ❌ 回帰テストを追加して、修正を外すと落ちることを確認せずに完了とする → ✅ 修正を 1 つずつ外してどのテストが落ちるか実測する(落ちないテストはゲートにならない)。 - ❌ PHP Warning が出ることを回帰の証拠にする → ✅ `phpunit.xml.dist` に `failOnWarning` が無いため Warning では落ちない。戻り値を assert で直接検証する。 - ❌ 型宣言の省略 → ✅ 引数・戻り値に型を付け、PHPStan level 6 を通す。 +- ❌ `setUp()` で未宣言のプロパティに代入(`$this->Member = ...`)→ ✅ プロパティを必ず宣言する。PHP 8.2 の動的プロパティ deprecation が `failOnDeprecation`(`phpunit.xml.dist`)で CI red になる。 +- ❌ テストのプロパティを非 nullable で宣言(`protected array $Items = [];`)→ ✅ `protected ?array $Items = null;` と nullable にする。`EccubeTestCase::cleanUpProperties()` が tearDown で全プロパティに `null` を代入するため、非 nullable だと `TypeError` で全テストが落ちる(初期値が必要なら `setUp()` で代入する)。 +- ❌ HTML パートを持たないメールに `assertEmailHtmlBodyNotContains()` → ✅ `assertNull($Message->getHtmlBody())`。前者は `str_contains(null, …)` の deprecation を出し、かつ「HTML パートが無いので必ず通る」空振りアサーションになる。 ## 実行方法 ```bash # 全テスト -bin/phpunit +vendor/bin/phpunit # 単一ファイル -bin/phpunit tests/Eccube/Tests/Web/ProductControllerTest.php +vendor/bin/phpunit tests/Eccube/Tests/Web/ProductControllerTest.php # フィルタ -bin/phpunit --filter testRouting +vendor/bin/phpunit --filter testRouting ``` diff --git a/AGENTS.md b/AGENTS.md index 588c7fc3fae..9e6bf2663b0 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -45,7 +45,8 @@ EC-CUBE は日本で広く使われる OSS の EC プラットフォームです - **テンプレート**: Twig 3.x - **データベース**: PostgreSQL 13–18 または MySQL 8.4 LTS - **フロントエンド**: Sass (SCSS) / webpack / Bootstrap 5.3 / jQuery 4.x -- **テスト**: PHPUnit 11(`symfony/phpunit-bridge` 経由)/ Playwright(E2E、`e2e/`) +- **テスト**: PHPUnit 11(`vendor/bin/phpunit` を直接実行)/ Playwright(E2E、`e2e/`) + - ※ `symfony/phpunit-bridge` は依存にあるが、その `DeprecationErrorHandler`(`SYMFONY_DEPRECATIONS_HELPER`)は **PHPUnit 10 以上では無効**(bridge の `bootstrap.php` が早期 return する)。非推奨の検出は PHPUnit 11 ネイティブの `failOnDeprecation` で行う(`phpunit.xml.dist`)。 - ※ `codeception/` は残置(レガシー)。CI の Codeception ジョブは無効化(`if: false`)されており、E2E は Playwright が正。 - **静的解析**: PHPStan(`phpstan.neon.dist` で level 6) - **コードスタイル**: PHP-CS-Fixer(PSR-12) @@ -108,9 +109,9 @@ bin/console eccube:install ### テスト ```bash -bin/phpunit # 全テスト -bin/phpunit tests/Eccube/Tests/Web/ShoppingControllerTest.php # 単一ファイル -bin/phpunit --filter testCompleteWithLogin # フィルタ +vendor/bin/phpunit # 全テスト +vendor/bin/phpunit tests/Eccube/Tests/Web/ShoppingControllerTest.php # 単一ファイル +vendor/bin/phpunit --filter testCompleteWithLogin # フィルタ ``` E2E(Playwright、`e2e/` 配下で実行): diff --git a/codeception/acceptance/_bootstrap.php b/codeception/acceptance/_bootstrap.php index 0da7856ee11..f00f8045e0c 100644 --- a/codeception/acceptance/_bootstrap.php +++ b/codeception/acceptance/_bootstrap.php @@ -156,9 +156,9 @@ function createCustomer($container, $email = null, $active = true) $Customer = $generator->createCustomer($email); if ($active) { - $Status = $entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::ACTIVE); + $Status = $entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::REGULAR); } else { - $Status = $entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::NONACTIVE); + $Status = $entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::PROVISIONAL); } $Customer->setStatus($Status); $entityManager->flush($Customer); diff --git a/e2e/global-setup.ts b/e2e/global-setup.ts index 71008cfb435..30357e7d0f5 100644 --- a/e2e/global-setup.ts +++ b/e2e/global-setup.ts @@ -26,7 +26,11 @@ export default function globalSetup() { ); console.log(output.toString()); } catch (error: any) { - console.error('Fixture setup failed:', error.stderr?.toString() || error.message); + // PHP CLI は Fatal error を stdout に書くため、stderr だけだと失敗理由が一切残らない + const detail = [error.stdout?.toString(), error.stderr?.toString()] + .filter((s?: string) => s && s.trim() !== '') + .join('\n'); + console.error('Fixture setup failed:', detail || error.message); // フィクスチャ失敗はテスト実行を止めない(基本データは eccube:fixtures:load で入っている) console.warn('Continuing without additional fixtures...'); } diff --git a/e2e/setup-fixtures.php b/e2e/setup-fixtures.php index 89f8b69bfcd..c4f31f080b5 100644 --- a/e2e/setup-fixtures.php +++ b/e2e/setup-fixtures.php @@ -50,13 +50,13 @@ for ($i = 0; $i < $needed; $i++) { $email = microtime(true).'.'.$faker->safeEmail; $Customer = $generator->createCustomer($email); - $Status = $entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::ACTIVE); + $Status = $entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::REGULAR); $Customer->setStatus($Status); $entityManager->flush($Customer); } // 仮会員も1名作成 $nonActiveCustomer = $generator->createCustomer(microtime(true).'.'.$faker->safeEmail); - $nonActiveStatus = $entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::NONACTIVE); + $nonActiveStatus = $entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::PROVISIONAL); $nonActiveCustomer->setStatus($nonActiveStatus); $entityManager->flush($nonActiveCustomer); echo " Created ".($needed + 1)." customers\n"; @@ -140,7 +140,7 @@ $existing = $entityManager->getRepository(Customer::class)->findOneBy(['email' => $testEmail]); if (!$existing) { $testCustomer = $generator->createCustomer($testEmail); - $Status = $entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::ACTIVE); + $Status = $entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::REGULAR); $testCustomer->setStatus($Status); $entityManager->flush($testCustomer); echo " Created test customer: $testEmail\n"; @@ -220,7 +220,7 @@ $refundCustomer = $entityManager->getRepository(Customer::class)->findOneBy(['email' => $refundTestEmail]); if (!$refundCustomer) { $refundCustomer = $generator->createCustomer($refundTestEmail); - $Status = $entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::ACTIVE); + $Status = $entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::REGULAR); $refundCustomer->setStatus($Status); $entityManager->flush($refundCustomer); echo " Created refund test customer: $refundTestEmail\n"; diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 694a83b0f96..3d5b37e504d 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -6,13 +6,14 @@ backupGlobals="false" colors="true" bootstrap="tests/bootstrap.php" + failOnDeprecation="true" + displayDetailsOnTestsThatTriggerDeprecations="true" > - @@ -23,7 +24,15 @@ - + + src diff --git a/src/Eccube/Controller/Admin/Order/OrderController.php b/src/Eccube/Controller/Admin/Order/OrderController.php index 44e31a02ad5..95fe227f89c 100644 --- a/src/Eccube/Controller/Admin/Order/OrderController.php +++ b/src/Eccube/Controller/Admin/Order/OrderController.php @@ -186,7 +186,8 @@ public function index(Request $request, ?int $page_no = null): array $qb = $this->orderRepository->getQueryBuilderBySearchDataForAdmin($searchData); - $sortKey = $searchData['sortkey']; + // null を配列オフセットに使うのは PHP 8.5 で非推奨。null は '' として扱われるため挙動は変わらない + $sortKey = $searchData['sortkey'] ?? ''; $paginate_options = ['wrap-queries' => true]; if (empty($this->orderRepository::COLUMNS[$sortKey]) || $sortKey == 'order_status') { $paginate_options = []; diff --git a/src/Eccube/Controller/Admin/Order/RefundRequestController.php b/src/Eccube/Controller/Admin/Order/RefundRequestController.php index 500a721fb0f..2e75a2b4a77 100644 --- a/src/Eccube/Controller/Admin/Order/RefundRequestController.php +++ b/src/Eccube/Controller/Admin/Order/RefundRequestController.php @@ -237,7 +237,8 @@ public function export(Request $request): StreamedResponse trans('admin.order.refund_request.create_date'), trans('admin.order.refund_request.update_date'), ]; - fputcsv($out, $header); + // PHP 8.4 で $escape 省略が非推奨. 既存の出力を変えないようコア既定('\\')を明示する + fputcsv($out, $header, escape: '\\'); $sanitize = static function (mixed $value): string { $value = (string) ($value ?? ''); @@ -257,7 +258,7 @@ public function export(Request $request): StreamedResponse $sanitize($RefundRequest->getCreateDate()?->format('Y-m-d H:i:s')), $sanitize($RefundRequest->getUpdateDate()?->format('Y-m-d H:i:s')), ]; - fputcsv($out, $row); + fputcsv($out, $row, escape: '\\'); $this->entityManager->detach($RefundRequest); } diff --git a/src/Eccube/Controller/Admin/Product/ProductController.php b/src/Eccube/Controller/Admin/Product/ProductController.php index 401b7b5c3c9..2c9be180bc9 100644 --- a/src/Eccube/Controller/Admin/Product/ProductController.php +++ b/src/Eccube/Controller/Admin/Product/ProductController.php @@ -185,7 +185,8 @@ public function index(Request $request, $page_no = null): array $qb = $this->productRepository->getQueryBuilderBySearchDataForAdmin($searchData); - $sortKey = $searchData['sortkey']; + // null を配列オフセットに使うのは PHP 8.5 で非推奨。null は '' として扱われるため挙動は変わらない + $sortKey = $searchData['sortkey'] ?? ''; $paginate_options = ['wrap-queries' => true]; if (empty($this->productRepository::COLUMNS[$sortKey]) || $sortKey == 'code' || $sortKey == 'status') { $paginate_options = []; diff --git a/src/Eccube/Entity/Cart.php b/src/Eccube/Entity/Cart.php index d036c5e79c8..063f73b5c3c 100644 --- a/src/Eccube/Entity/Cart.php +++ b/src/Eccube/Entity/Cart.php @@ -58,8 +58,6 @@ class Cart extends AbstractEntity implements PurchaseInterface, ItemHolderInterf #[ORM\JoinColumn(name: 'customer_id', referencedColumnName: 'id')] private ?Customer $Customer = null; - private bool $lock = false; - /** * @var Collection */ @@ -140,24 +138,6 @@ public function setAgentOwned(bool $agentOwned): Cart return $this; } - /** - * @deprecated 使用しないので削除予定 - */ - public function getLock(): bool - { - return $this->lock; - } - - /** - * @deprecated 使用しないので削除予定 - */ - public function setLock(bool $lock): Cart - { - $this->lock = $lock; - - return $this; - } - public function getPreOrderId(): ?string { return $this->pre_order_id; diff --git a/src/Eccube/Entity/Master/CustomerStatus.php b/src/Eccube/Entity/Master/CustomerStatus.php index 86b1806d1cf..0cd79eb6761 100644 --- a/src/Eccube/Entity/Master/CustomerStatus.php +++ b/src/Eccube/Entity/Master/CustomerStatus.php @@ -27,20 +27,6 @@ #[ORM\Cache(usage: 'NONSTRICT_READ_WRITE')] class CustomerStatus extends AbstractMasterEntity { - /** - * 仮会員. - * - * @deprecated - */ - public const NONACTIVE = 1; - - /** - * 本会員. - * - * @deprecated - */ - public const ACTIVE = 2; - /** * 仮会員. */ diff --git a/src/Eccube/Entity/Order.php b/src/Eccube/Entity/Order.php index 5f0b3c90d56..61726cfbe1c 100644 --- a/src/Eccube/Entity/Order.php +++ b/src/Eccube/Entity/Order.php @@ -326,7 +326,9 @@ public function getMergedProductOrderItems(): array $orderItemArray = []; /** @var OrderItem $ProductOrderItem */ foreach ($ProductOrderItems as $ProductOrderItem) { - $productClassId = $ProductOrderItem->getProductClass()->getId(); + // 未永続の明細では ID が null になるため、配列キーとして使えるよう文字列化する + // (null をキーに使うのは PHP 8.5 で非推奨。null は '' として扱われるため挙動は変わらない) + $productClassId = (string) $ProductOrderItem->getProductClass()->getId(); if (array_key_exists($productClassId, $orderItemArray)) { // 同じ規格の商品がある場合は個数をまとめる $OrderItem = $orderItemArray[$productClassId]; @@ -343,18 +345,6 @@ public function getMergedProductOrderItems(): array return array_values($orderItemArray); } - /** - * 合計金額を計算 - * - * @deprecated - */ - public function getTotalPrice(): string - { - @trigger_error('The '.__METHOD__.' method is deprecated.', E_USER_DEPRECATED); - - return $this->getPaymentTotal(); - } - #[ORM\Column(name: 'id', type: Types::INTEGER, options: ['unsigned' => true])] #[ORM\Id] #[ORM\GeneratedValue(strategy: 'IDENTITY')] diff --git a/src/Eccube/Entity/OrderItem.php b/src/Eccube/Entity/OrderItem.php index 87969091c04..131337405cf 100644 --- a/src/Eccube/Entity/OrderItem.php +++ b/src/Eccube/Entity/OrderItem.php @@ -420,28 +420,6 @@ public function getTaxAdjust(): string return $this->tax_adjust; } - /** - * Set taxRuleId. - * - * @deprecated 税率設定は受注作成時に決定するため廃止予定 - */ - public function setTaxRuleId(?int $taxRuleId = null): OrderItem - { - $this->tax_rule_id = $taxRuleId; - - return $this; - } - - /** - * Get taxRuleId. - * - * @deprecated 税率設定は受注作成時に決定するため廃止予定 - */ - public function getTaxRuleId(): ?int - { - return $this->tax_rule_id; - } - /** * Get currencyCode. */ diff --git a/src/Eccube/Entity/Product.php b/src/Eccube/Entity/Product.php index 249b74485e5..7fa6c5ee8f5 100644 --- a/src/Eccube/Entity/Product.php +++ b/src/Eccube/Entity/Product.php @@ -149,16 +149,6 @@ public function _calc(): void } } - /** - * Is Enable - * - * @deprecated - */ - public function isEnable(): bool - { - return $this->getStatus()->getId() === ProductStatus::DISPLAY_SHOW ? true : false; - } - /** * Get ClassName1 */ diff --git a/src/Eccube/Entity/ProductClass.php b/src/Eccube/Entity/ProductClass.php index 9205b13748a..9ab5c3048b6 100644 --- a/src/Eccube/Entity/ProductClass.php +++ b/src/Eccube/Entity/ProductClass.php @@ -50,16 +50,6 @@ public function formattedProductName(): string return $productName; } - /** - * Is Enable - * - * @deprecated - */ - public function isEnable(): bool - { - return $this->getProduct()->isEnable(); - } - /** * Set price01 IncTax */ diff --git a/src/Eccube/Resource/functions/trans.php b/src/Eccube/Resource/functions/trans.php index ba0cbc300fc..d087b365bbf 100644 --- a/src/Eccube/Resource/functions/trans.php +++ b/src/Eccube/Resource/functions/trans.php @@ -24,14 +24,3 @@ function trans(string|int $id, array $parameters = [], ?string $domain = null, ? return $Translator->trans($id, $parameters, $domain, $locale); } - -/** - * @param mixed $number - 不要引数 - * @param array $parameters - * - * @deprecated transを使用してください。 - */ -function transChoice(string|int $id, mixed $number, array $parameters = [], ?string $domain = null, ?string $locale = null): string -{ - return trans($id, $parameters, $domain, $locale); -} diff --git a/src/Eccube/Service/CartService.php b/src/Eccube/Service/CartService.php index 80e3b54bd9c..07538a5d0f3 100644 --- a/src/Eccube/Service/CartService.php +++ b/src/Eccube/Service/CartService.php @@ -19,7 +19,6 @@ use Eccube\Entity\Cart; use Eccube\Entity\CartItem; use Eccube\Entity\Customer; -use Eccube\Entity\ItemHolderInterface; use Eccube\Entity\ProductClass; use Eccube\Repository\CartRepository; use Eccube\Repository\OrderRepository; @@ -39,11 +38,6 @@ class CartService */ protected ?array $carts = null; - /** - * @deprecated - */ - protected ItemHolderInterface $cart; - /** * CartService constructor. */ diff --git a/src/Eccube/Service/PluginApiService.php b/src/Eccube/Service/PluginApiService.php index c823ef1f409..181692f780c 100644 --- a/src/Eccube/Service/PluginApiService.php +++ b/src/Eccube/Service/PluginApiService.php @@ -273,7 +273,7 @@ public function requestApi(string $url, array $data = [], bool $post = false): s $info = curl_getinfo($curl); $message = curl_error($curl); $info['message'] = $message; - curl_close($curl); + // curl_close() は PHP 8.0 以降なにもせず、8.5 で非推奨になったため呼び出さない log_info('http get_info', $info); diff --git a/src/Eccube/Service/PluginService.php b/src/Eccube/Service/PluginService.php index ac02f07e9cc..01c566d1b39 100644 --- a/src/Eccube/Service/PluginService.php +++ b/src/Eccube/Service/PluginService.php @@ -366,12 +366,15 @@ public function createTempDir(): string } /** - * @param array $arr + * 未作成のディレクトリを表す null も受け取る(install()/update() は例外発生時点で + * 変数が未設定のまま渡すため)。 + * + * @param array $arr */ public function deleteDirs(array $arr): void { foreach ($arr as $dir) { - if (file_exists($dir)) { + if (null !== $dir && file_exists($dir)) { $fs = new Filesystem(); $fs->remove($dir); } diff --git a/src/Eccube/Service/PurchaseFlow/InvalidItemException.php b/src/Eccube/Service/PurchaseFlow/InvalidItemException.php index 6aae2649830..78485d71055 100644 --- a/src/Eccube/Service/PurchaseFlow/InvalidItemException.php +++ b/src/Eccube/Service/PurchaseFlow/InvalidItemException.php @@ -22,7 +22,7 @@ class InvalidItemException extends \Exception */ public function __construct(?string $message = null, private readonly ?array $messageArgs = [], private readonly bool $warning = false) { - parent::__construct($message); + parent::__construct($message ?? ''); } /** diff --git a/src/Eccube/Service/PurchaseFlow/Processor/TaxProcessor.php b/src/Eccube/Service/PurchaseFlow/Processor/TaxProcessor.php index ecc60f69d3e..447c8c41935 100644 --- a/src/Eccube/Service/PurchaseFlow/Processor/TaxProcessor.php +++ b/src/Eccube/Service/PurchaseFlow/Processor/TaxProcessor.php @@ -120,24 +120,4 @@ protected function getTaxType(OrderItemType|int $OrderItemType): TaxType return $this->entityManager->find(TaxType::class, $TaxType); } - - /** - * 税表示区分を取得する. - * - * - 商品: 税抜 - * - 送料: 税込 - * - 値引き: 税抜 - * - 手数料: 税込 - * - ポイント値引き: 税込 - * - * @param OrderItemType|int $OrderItemType 明細種別 - * - * @deprecated OrderHelper::getTaxDisplayTypeを使用してください - * - * @return TaxDisplayType 税表示区分 - */ - protected function getTaxDisplayType(OrderItemType|int $OrderItemType): TaxDisplayType - { - return $this->orderHelper->getTaxDisplayType($OrderItemType); - } } diff --git a/src/Eccube/Twig/Extension/SafeTextmailEscaperExtension.php b/src/Eccube/Twig/Extension/SafeTextmailEscaperExtension.php index 6c04ccd6791..543ae7bcdbd 100644 --- a/src/Eccube/Twig/Extension/SafeTextmailEscaperExtension.php +++ b/src/Eccube/Twig/Extension/SafeTextmailEscaperExtension.php @@ -23,8 +23,9 @@ public function __construct(Environment $twig) { /** @var EscaperRuntime $escaper */ $escaper = $twig->getRuntime(EscaperRuntime::class); + // Twig は null の変数もそのまま渡すため、引数は nullable で受ける $escaper->setEscaper( - 'safe_textmail', fn ($string, $charset) => str_replace(['<', '>'], ['<', '>'], $string) + 'safe_textmail', fn (?string $string, $charset) => str_replace(['<', '>'], ['<', '>'], $string ?? '') ); } } diff --git a/src/Eccube/Util/CacheUtil.php b/src/Eccube/Util/CacheUtil.php index 53965f2d554..fcb27666ecf 100644 --- a/src/Eccube/Util/CacheUtil.php +++ b/src/Eccube/Util/CacheUtil.php @@ -20,7 +20,6 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Filesystem\Filesystem; -use Symfony\Component\Finder\Finder; use Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer; use Symfony\Component\HttpKernel\Event\TerminateEvent; use Symfony\Component\HttpKernel\KernelEvents; @@ -139,68 +138,6 @@ public function clearTwigCache(): void $fs->remove($cacheDir); } - /** - * キャッシュを削除する. - * - * doctrine, profiler, twig によって生成されたキャッシュディレクトリを削除する. - * キャッシュは $app['config']['root_dir'].'/app/cache' に生成されます. - * - * @param Application|array{config: array{root_dir: string}} $app - * @param bool $isAll .gitkeep を残してすべてのファイル・ディレクトリを削除する場合 true, 各ディレクトリのみを削除する場合 false - * @param bool $isTwig Twigキャッシュファイルのみ削除する場合 true - * - * @return bool 削除に成功した場合 true - * - * @deprecated CacheUtil::clearCacheを利用すること - */ - public static function clear(Application|array $app, bool $isAll, bool $isTwig = false): bool - { - $cacheDir = $app['config']['root_dir'].'/app/cache'; - - $filesystem = new Filesystem(); - $finder = Finder::create()->notName('.gitkeep')->files(); - if ($isAll) { - $finder = $finder->in($cacheDir); - $filesystem->remove($finder); - } elseif ($isTwig) { - if (is_dir($cacheDir.'/twig')) { - $finder = $finder->in($cacheDir.'/twig'); - $filesystem->remove($finder); - } - } else { - if (is_dir($cacheDir.'/doctrine')) { - $finder = $finder->in($cacheDir.'/doctrine'); - $filesystem->remove($finder); - } - if (is_dir($cacheDir.'/profiler')) { - $finder = $finder->in($cacheDir.'/profiler'); - $filesystem->remove($finder); - } - if (is_dir($cacheDir.'/twig')) { - $finder = $finder->in($cacheDir.'/twig'); - $filesystem->remove($finder); - } - if (is_dir($cacheDir.'/translator')) { - $finder = $finder->in($cacheDir.'/translator'); - $filesystem->remove($finder); - } - } - - if (function_exists('opcache_reset')) { - opcache_reset(); - } - - if (function_exists('apcu_clear_cache')) { - apcu_clear_cache(); - } - - if (function_exists('wincache_ucache_clear')) { - wincache_ucache_clear(); - } - - return true; - } - /** * {@inheritdoc} */ diff --git a/tests/Eccube/Tests/Entity/OrderTest.php b/tests/Eccube/Tests/Entity/OrderTest.php index 1b50e49e5cc..8383bae4149 100644 --- a/tests/Eccube/Tests/Entity/OrderTest.php +++ b/tests/Eccube/Tests/Entity/OrderTest.php @@ -30,7 +30,6 @@ use Eccube\Entity\TaxRule; use Eccube\Service\TaxRuleService; use Eccube\Tests\EccubeTestCase; -use Eccube\Tests\Fixture\Generator; use PHPUnit\Framework\Attributes\Group; /** @@ -128,28 +127,6 @@ public function testGetSaleTypes() $this->verify(); } - #[Group(name: 'decimal')] - public function testGetTotalPrice() - { - $faker = $this->getFaker(); - /** @var Order $Order */ - $Order = static::getContainer()->get(Generator::class)->createOrder( - $this->Customer, - [], - null, - $faker->randomNumber(5), - $faker->randomNumber(5) - ); - // 元の計算式: $Order->getSubTotal() + $Order->getCharge() + $Order->getDeliveryFeeTotal() - $Order->getDiscount(); - $this->expected = bcadd( - bcadd(bcadd($Order->getSubTotal(), $Order->getCharge(), 2), $Order->getDeliveryFeeTotal(), 2), - bcsub('0', $Order->getDiscount(), 2), - 2 - ); - $this->actual = $Order->getTotalPrice(); - $this->verify(); - } - public function testGetMergedProductOrderItems() { $quantity = '5'; // 配送先あたりの商品の個数 diff --git a/tests/Eccube/Tests/Fixture/Generator.php b/tests/Eccube/Tests/Fixture/Generator.php index 0319ce55cac..bef39e5e11d 100644 --- a/tests/Eccube/Tests/Fixture/Generator.php +++ b/tests/Eccube/Tests/Fixture/Generator.php @@ -167,7 +167,7 @@ public function createCustomer(?string $email = null, bool $flush = true): Custo } while ($this->customerRepository->findBy(['email' => $email])); } $phoneNumber = str_replace('-', '', $faker->phoneNumber); - $Status = $this->entityManager->find(CustomerStatus::class, CustomerStatus::ACTIVE); + $Status = $this->entityManager->find(CustomerStatus::class, CustomerStatus::REGULAR); $Pref = $this->entityManager->find(Pref::class, $faker->numberBetween(1, 47)); $Sex = $this->entityManager->find(Sex::class, $faker->numberBetween(1, 2)); $Job = $this->entityManager->find(Job::class, $faker->numberBetween(1, 18)); @@ -893,7 +893,7 @@ public function createLoginHistory( * @param array $options { * * @var Sex|null $sex 全 Customer に設定する Sex - * @var CustomerStatus|null $status 全 Customer に設定する CustomerStatus (デフォルト: ACTIVE) + * @var CustomerStatus|null $status 全 Customer に設定する CustomerStatus (デフォルト: REGULAR) * @var callable|null $emailTemplate function(int $i): string でメールアドレスを生成 * } * @@ -910,7 +910,7 @@ public function createCustomers(int $count, array $options = []): array $Sex = $options['sex'] ?? null; /** @var CustomerStatus $Status */ $Status = $options['status'] - ?? $this->entityManager->find(CustomerStatus::class, CustomerStatus::ACTIVE); + ?? $this->entityManager->find(CustomerStatus::class, CustomerStatus::REGULAR); $emailTemplate = $options['emailTemplate'] ?? fn (int $i): string => sprintf('bulk-user-%d-%s@example.com', $i, $faker->uuid); diff --git a/tests/Eccube/Tests/Form/Type/Admin/MasterdataTypeTest.php b/tests/Eccube/Tests/Form/Type/Admin/MasterdataTypeTest.php index 507c99fc8cc..0d7fa5adf27 100644 --- a/tests/Eccube/Tests/Form/Type/Admin/MasterdataTypeTest.php +++ b/tests/Eccube/Tests/Form/Type/Admin/MasterdataTypeTest.php @@ -17,9 +17,12 @@ use Eccube\Form\Type\Admin\MasterdataType; use Eccube\Tests\Form\Type\AbstractTypeTestCase; +use Symfony\Component\Form\FormInterface; final class MasterdataTypeTest extends AbstractTypeTestCase { + protected ?FormInterface $form = null; + /** @var array デフォルト値(正常系)を設定 */ protected ?array $formData = null; diff --git a/tests/Eccube/Tests/Repository/CustomerRepositoryGetQueryBuilderBySearchDataTest.php b/tests/Eccube/Tests/Repository/CustomerRepositoryGetQueryBuilderBySearchDataTest.php index 0fd92714665..92fc38a9886 100644 --- a/tests/Eccube/Tests/Repository/CustomerRepositoryGetQueryBuilderBySearchDataTest.php +++ b/tests/Eccube/Tests/Repository/CustomerRepositoryGetQueryBuilderBySearchDataTest.php @@ -661,8 +661,8 @@ public static function dataFormDateTimeProvider(): \Iterator public function testStatus() { - $Active = $this->entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::ACTIVE); - $NonActive = $this->entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::NONACTIVE); + $Active = $this->entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::REGULAR); + $NonActive = $this->entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::PROVISIONAL); $this->Customer->setStatus($Active); $this->Customer1->setStatus($NonActive); $this->entityManager->flush(); @@ -679,7 +679,7 @@ public function testStatus() public function testStatusWithNonActive() { - $NonActive = $this->entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::NONACTIVE); + $NonActive = $this->entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::PROVISIONAL); $this->Customer->setStatus($NonActive); $this->Customer1->setStatus($NonActive); $this->entityManager->flush(); diff --git a/tests/Eccube/Tests/Repository/CustomerRepositoryTest.php b/tests/Eccube/Tests/Repository/CustomerRepositoryTest.php index b5f87ab5c6b..aa17da6b599 100644 --- a/tests/Eccube/Tests/Repository/CustomerRepositoryTest.php +++ b/tests/Eccube/Tests/Repository/CustomerRepositoryTest.php @@ -63,7 +63,7 @@ public function testNewCustomer() public function testGetProvisionalCustomerBySecretKey() { $this->expected = $this->Customer->getSecretKey(); - $Status = $this->entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::NONACTIVE); + $Status = $this->entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::PROVISIONAL); $this->Customer->setStatus($Status); $this->entityManager->flush(); diff --git a/tests/Eccube/Tests/Repository/LoginHistoryRepositoryGetQueryBuilderBySearchDataAdminTest.php b/tests/Eccube/Tests/Repository/LoginHistoryRepositoryGetQueryBuilderBySearchDataAdminTest.php index f3e6c3cee9b..17222c20239 100644 --- a/tests/Eccube/Tests/Repository/LoginHistoryRepositoryGetQueryBuilderBySearchDataAdminTest.php +++ b/tests/Eccube/Tests/Repository/LoginHistoryRepositoryGetQueryBuilderBySearchDataAdminTest.php @@ -17,6 +17,7 @@ use Eccube\Entity\LoginHistory; use Eccube\Entity\Master\LoginHistoryStatus; +use Eccube\Entity\Member; use Eccube\Repository\LoginHistoryRepository; use Eccube\Tests\EccubeTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -30,6 +31,14 @@ final class LoginHistoryRepositoryGetQueryBuilderBySearchDataAdminTest extends E protected ?array $searchData = null; + protected ?Member $Member1 = null; + + protected ?LoginHistory $LoginHistory1 = null; + + protected ?LoginHistory $LoginHistory2 = null; + + protected ?LoginHistory $LoginHistory3 = null; + private ?LoginHistoryRepository $loginHistoryRepository = null; /** diff --git a/tests/Eccube/Tests/Service/CsvExportServiceTest.php b/tests/Eccube/Tests/Service/CsvExportServiceTest.php index 9e857ffd0e7..f5c27801f9a 100644 --- a/tests/Eccube/Tests/Service/CsvExportServiceTest.php +++ b/tests/Eccube/Tests/Service/CsvExportServiceTest.php @@ -130,7 +130,8 @@ public function testExportData() $fp = fopen($this->url, 'r'); $File = []; if ($fp !== false) { - while (($data = fgetcsv($fp)) !== false) { + // $escape は PHP 8.4 で明示指定が必須(既定値が変わる予告)。現行の既定値を明示する + while (($data = fgetcsv($fp, escape: '\\')) !== false) { $File[] = $data; } fclose($fp); diff --git a/tests/Eccube/Tests/Service/MailServiceTest.php b/tests/Eccube/Tests/Service/MailServiceTest.php index 06f6a23530e..6ad66664da0 100644 --- a/tests/Eccube/Tests/Service/MailServiceTest.php +++ b/tests/Eccube/Tests/Service/MailServiceTest.php @@ -144,7 +144,7 @@ public function testSendCustomerWithdrawMail() $this->verify(); $this->assertEmailTextBodyContains($Message, '退会手続きが完了いたしました'); - $this->assertEmailHtmlBodyNotContains($Message, '退会手続きが完了いたしました', 'HTML part は存在しない'); + $this->assertNull($Message->getHtmlBody(), 'HTML part は存在しない'); } public function testSendContactMail() @@ -298,7 +298,7 @@ public function testSendPasswordResetNotificationMail() $Message = $this->getMailerMessage(0); $this->assertEmailTextBodyContains($Message, $url, 'URLは'.$url.'ではありません'); - $this->assertEmailHtmlBodyNotContains($Message, $url, 'HTML part は存在しない'); + $this->assertNull($Message->getHtmlBody(), 'HTML part は存在しない'); $this->expected = '['.$this->BaseInfo->getShopName().'] パスワード変更のご確認'; $this->actual = $Message->getSubject(); @@ -335,7 +335,7 @@ public function testSendPasswordResetCompleteMail() $this->verify(); $this->assertEmailTextBodyContains($Message, 'パスワードを変更いたしました。'); - $this->assertEmailHtmlBodyNotContains($Message, 'パスワードを変更いたしました。', 'HTML part は存在しない'); + $this->assertNull($Message->getHtmlBody(), 'HTML part は存在しない'); } public function testConvertRFCViolatingEmail() diff --git a/tests/Eccube/Tests/Service/PluginServiceTest.php b/tests/Eccube/Tests/Service/PluginServiceTest.php index a14e3c7bcc5..ac656114b66 100644 --- a/tests/Eccube/Tests/Service/PluginServiceTest.php +++ b/tests/Eccube/Tests/Service/PluginServiceTest.php @@ -661,6 +661,15 @@ class Block #[ORM\GeneratedValue(strategy: "IDENTITY")] private $id; + /** + * テスト側から代入するための ORM 非マッピングプロパティ. + * + * 宣言しないと PHP 8.2 の動的プロパティ生成 (deprecated) になる. + * + * @var bool|null + */ + public $sample; + /** * @return int */ diff --git a/tests/Eccube/Tests/Stream/Filter/SjisToUtf8EncodingFilterTest.php b/tests/Eccube/Tests/Stream/Filter/SjisToUtf8EncodingFilterTest.php index d84d6f39a15..a20f9400529 100644 --- a/tests/Eccube/Tests/Stream/Filter/SjisToUtf8EncodingFilterTest.php +++ b/tests/Eccube/Tests/Stream/Filter/SjisToUtf8EncodingFilterTest.php @@ -38,7 +38,7 @@ public function encodeSmallData(): void $utf8Value = 'あ,い,う'; $sjisValue = $this->getSjisValue($utf8Value); $resource = $this->createReadableResource($sjisValue); - $this->assertSame(['あ', 'い', 'う'], \fgetcsv($resource)); + $this->assertSame(['あ', 'い', 'う'], \fgetcsv($resource, escape: '\\')); } #[Test] @@ -51,7 +51,7 @@ public function encodeBigDataThatExceedsStreamChunkSize(): void // SJIS string will be separated into 5 chunks like following: // 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 // [k a k i k] [u k e k o] [, s a s i] [s u s e s] [o ] - $this->assertSame(['かきくけこ', 'さしすせそ'], \fgetcsv($resource)); + $this->assertSame(['かきくけこ', 'さしすせそ'], \fgetcsv($resource, escape: '\\')); } #[Test] @@ -61,7 +61,10 @@ public function fgetcsvDoesntOccur5cProblem(): void $sjisValue = $this->getSjisValue($utf8Value); $this->assertSame('22 95 5c 22 ', \chunk_split(\bin2hex($sjisValue), 2, ' ')); $resource = $this->createReadableResource($sjisValue); - $this->assertSame(['表'], \fgetcsv($resource)); + // $escape は現行の既定値 '\\' を明示する(PHP 8.4 で明示指定が必須)。 + // このテストは SJIS の 2 バイト目 0x5c を escape 文字として誤認しないことの確認なので、 + // 既定値を変えずに明示することが重要 + $this->assertSame(['表'], \fgetcsv($resource, escape: '\\')); } #[Test] @@ -76,7 +79,7 @@ public function bufferSizeShouldNotBeTooLarge(): void // 82 a0 / 20 82 / a0 20 / 82 a0 / 20 82 / a0 20 (chunked data) // / 82 / / / 82 / (buffered content) // 82 a0 / 20 / 82 a0 20 / 82 a0 / 20 / 82 a0 20 (encoding unit) - $this->assertSame([$utf8Value], \fgetcsv($resource)); + $this->assertSame([$utf8Value], \fgetcsv($resource, escape: '\\')); } private function getSjisValue(string $utf8Value): string diff --git a/tests/Eccube/Tests/Util/CacheUtilTest.php b/tests/Eccube/Tests/Util/CacheUtilTest.php deleted file mode 100644 index 2da355dc4e7..00000000000 --- a/tests/Eccube/Tests/Util/CacheUtilTest.php +++ /dev/null @@ -1,90 +0,0 @@ -root = vfsStream::setup('rootDir'); - $dirs = ['doctrine', 'profiler', 'twig']; - $this->app = [ - 'config' => [ - 'root_dir' => vfsStream::url('rootDir'), - ], - ]; - mkdir($this->app['config']['root_dir'].'/app/cache', 0777, true); - file_put_contents($this->app['config']['root_dir'].'/app/cache/.gitkeep', 'test'); - // ランダムなファイルを生成しておく - foreach ($dirs as $dir) { - mkdir($this->app['config']['root_dir'].'/app/cache/'.$dir, 0777, true); - $n = mt_rand(5, 10); - for ($i = 0; $i < $n; $i++) { - file_put_contents($this->app['config']['root_dir'].'/app/cache/'.$dir.'/'.$i, 'test'); - } - } - } - - public function testClearAll() - { - // .gitkeep を残してすべてを削除 - CacheUtil::clear($this->app, true); - - $finder = new Finder(); - $iterator = $finder - ->ignoreDotFiles(false) - ->in($this->app['config']['root_dir'].'/app/cache') - ->files(); - - foreach ($iterator as $fileinfo) { - $this->assertStringEndsWith('.gitkeep', $fileinfo->getPathname(), '.gitkeep しか存在しないはず'); - } - $this->assertTrue($this->root->hasChild('app/cache/.gitkeep'), '.gitkeep は存在するはず'); - } - - public function testClear() - { - file_put_contents($this->app['config']['root_dir'].'/app/cache/.dummykeep', 'test'); - // 'doctrine', 'profiler', 'twig' ディレクトリを削除 - CacheUtil::clear($this->app, false); - - $finder = new Finder(); - $iterator = $finder - ->ignoreDotFiles(false) - ->in($this->app['config']['root_dir'].'/app/cache') - ->files(); - - foreach ($iterator as $fileinfo) { - $this->assertStringEndsWith('keep', $fileinfo->getPathname(), 'keep しか存在しないはず'); - } - $this->assertTrue($this->root->hasChild('app/cache/.gitkeep'), '.gitkeep は存在するはず'); - $this->assertTrue($this->root->hasChild('app/cache/.dummykeep'), '.dummykeep は存在するはず'); - } -} diff --git a/tests/Eccube/Tests/Web/Admin/Order/EditControllerTest.php b/tests/Eccube/Tests/Web/Admin/Order/EditControllerTest.php index 19eb16511f5..de9a31e33c8 100644 --- a/tests/Eccube/Tests/Web/Admin/Order/EditControllerTest.php +++ b/tests/Eccube/Tests/Web/Admin/Order/EditControllerTest.php @@ -343,7 +343,7 @@ public function testOrderCustomerInfo() $this->assertInstanceOf(Order::class, $EditedOrder); // 顧客の購入回数と購入金額確認 - $totalPrice = $EditedOrder->getTotalPrice(); + $totalPrice = $EditedOrder->getPaymentTotal(); $this->expected = $totalPrice; $this->actual = $EditedOrder->getCustomer()->getBuyTotal(); @@ -371,7 +371,7 @@ public function testOrderCustomerInfo() $this->assertInstanceOf(Order::class, $EditedOrder); // 顧客の購入回数と購入金額確認 - $this->expected = bcadd($totalPrice, $EditedOrder->getTotalPrice(), 2); + $this->expected = bcadd($totalPrice, $EditedOrder->getPaymentTotal(), 2); // XXX SQLite の場合、小数点以下の '.00' が省略されるため、bcadd() で正規化して比較する $this->actual = bcadd((string) $EditedOrder->getCustomer()->getBuyTotal(), '0', 2); $this->verify(); diff --git a/tests/Eccube/Tests/Web/Admin/Order/MailControllerTest.php b/tests/Eccube/Tests/Web/Admin/Order/MailControllerTest.php index d70963a549f..8c3cfcbbfcb 100644 --- a/tests/Eccube/Tests/Web/Admin/Order/MailControllerTest.php +++ b/tests/Eccube/Tests/Web/Admin/Order/MailControllerTest.php @@ -19,6 +19,7 @@ use Eccube\Entity\Customer; use Eccube\Entity\MailHistory; use Eccube\Entity\MailTemplate; +use Eccube\Entity\Member; use Eccube\Entity\Order; use Eccube\Tests\Web\Admin\AbstractAdminWebTestCase; use Symfony\Bundle\FrameworkBundle\Test\MailerAssertionsTrait; @@ -33,6 +34,11 @@ final class MailControllerTest extends AbstractAdminWebTestCase protected ?Order $Order = null; + protected ?Member $Member = null; + + /** @var array|null */ + protected ?array $MailHistories = null; + protected function setUp(): void { parent::setUp(); @@ -47,6 +53,7 @@ protected function setUp(): void ->setCreator($this->Member); $this->entityManager->persist($MailTemplate); $this->entityManager->flush(); + $this->MailHistories = []; for ($i = 0; $i < 3; $i++) { $this->MailHistories[$i] = new MailHistory(); $this->MailHistories[$i] diff --git a/tests/Eccube/Tests/Web/Admin/Order/RefundRequestControllerTest.php b/tests/Eccube/Tests/Web/Admin/Order/RefundRequestControllerTest.php index 3b2ef649141..4114cf231ea 100644 --- a/tests/Eccube/Tests/Web/Admin/Order/RefundRequestControllerTest.php +++ b/tests/Eccube/Tests/Web/Admin/Order/RefundRequestControllerTest.php @@ -236,7 +236,7 @@ public function testExportCsvHeaderColumns(): void $lines = array_filter(explode("\n", $content), fn ($line) => $line !== ''); $this->assertGreaterThanOrEqual(1, count($lines)); - $header = str_getcsv($lines[0]); + $header = str_getcsv($lines[0], escape: '\\'); $this->assertCount(9, $header); } diff --git a/tests/Eccube/Tests/Web/EntryControllerTest.php b/tests/Eccube/Tests/Web/EntryControllerTest.php index 9a3c59fee35..2ac0c0f1193 100644 --- a/tests/Eccube/Tests/Web/EntryControllerTest.php +++ b/tests/Eccube/Tests/Web/EntryControllerTest.php @@ -212,7 +212,7 @@ public function testActivate() $BaseInfo = $this->entityManager->getRepository(BaseInfo::class)->get(); $Customer = $this->createCustomer(); $secret_key = $Customer->getSecretKey(); - $Status = $this->entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::NONACTIVE); + $Status = $this->entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::PROVISIONAL); $this->assertInstanceOf(CustomerStatus::class, $Status); $Customer->setStatus($Status); $this->entityManager->flush(); @@ -235,7 +235,7 @@ public function testActivateWithSanitize() $Customer = $this->createCustomer(); $Customer->setName01(''); $secret_key = $Customer->getSecretKey(); - $Status = $this->entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::NONACTIVE); + $Status = $this->entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::PROVISIONAL); $this->assertInstanceOf(CustomerStatus::class, $Status); $Customer->setStatus($Status); $this->entityManager->flush(); diff --git a/tests/Eccube/Tests/Web/Mypage/WithdrawControllerTest.php b/tests/Eccube/Tests/Web/Mypage/WithdrawControllerTest.php index c5d5b9d87ba..fb711b758c6 100644 --- a/tests/Eccube/Tests/Web/Mypage/WithdrawControllerTest.php +++ b/tests/Eccube/Tests/Web/Mypage/WithdrawControllerTest.php @@ -128,7 +128,7 @@ public function testIndexWithPostCompleteWithSanitize() $this->verify(); $this->assertEmailTextBodyContains($Message, '<Sanitize&>', 'テキストメールがサニタイズされている'); - $this->assertEmailHtmlBodyNotContains($Message, '<Sanitize&>', 'HTML part は存在しない'); + $this->assertNull($Message->getHtmlBody(), 'HTML part は存在しない'); } public function testComplete()