diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index ae5d08c23b6..5f0209d2f34 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -256,7 +256,7 @@ jobs: - name: Codeception env: GROUP: ${{ matrix.group }} - SYMFONY_DEPRECATIONS_HELPER: weak + SYMFONY_DEPRECATIONS_HELPER: 'max[direct]=0' continue-on-error: true run: | sed -i "s|%GITHUB_WORKSPACE%|${GITHUB_WORKSPACE}|g" codeception/_envs/github_action.yml diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 694a83b0f96..1d877a816f3 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -12,7 +12,7 @@ - + diff --git a/src/Eccube/Entity/Cart.php b/src/Eccube/Entity/Cart.php index a19ba10e541..185528bf6ff 100644 --- a/src/Eccube/Entity/Cart.php +++ b/src/Eccube/Entity/Cart.php @@ -59,8 +59,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 */ @@ -147,24 +145,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 00773b0f47f..068c3c3bfc4 100644 --- a/src/Eccube/Entity/Master/CustomerStatus.php +++ b/src/Eccube/Entity/Master/CustomerStatus.php @@ -28,20 +28,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 84a9dc460f9..02e66c55f45 100644 --- a/src/Eccube/Entity/Order.php +++ b/src/Eccube/Entity/Order.php @@ -337,18 +337,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 253c1852e4a..05a09de2172 100644 --- a/src/Eccube/Entity/OrderItem.php +++ b/src/Eccube/Entity/OrderItem.php @@ -418,28 +418,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 dfe16074748..01663929bab 100644 --- a/src/Eccube/Entity/Product.php +++ b/src/Eccube/Entity/Product.php @@ -150,16 +150,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 551ab43683c..9a20eacfb0f 100644 --- a/src/Eccube/Entity/ProductClass.php +++ b/src/Eccube/Entity/ProductClass.php @@ -51,16 +51,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/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/Util/CacheUtil.php b/src/Eccube/Util/CacheUtil.php index 92043539741..f78d4f1990f 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; @@ -140,69 +139,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('apc_clear_cache')) { - apc_clear_cache('user'); - apc_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 35d43f1662f..0fb03a03d22 100644 --- a/tests/Eccube/Tests/Entity/OrderTest.php +++ b/tests/Eccube/Tests/Entity/OrderTest.php @@ -29,7 +29,6 @@ use Eccube\Entity\TaxRule; use Eccube\Service\TaxRuleService; use Eccube\Tests\EccubeTestCase; -use Eccube\Tests\Fixture\Generator; use PHPUnit\Framework\Attributes\Group; /** @@ -127,28 +126,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 1fa39f031cb..f8c3601ee38 100644 --- a/tests/Eccube/Tests/Fixture/Generator.php +++ b/tests/Eccube/Tests/Fixture/Generator.php @@ -166,7 +166,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)); @@ -909,7 +909,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/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/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 0b869bb4322..ff508e57676 100644 --- a/tests/Eccube/Tests/Web/Admin/Order/EditControllerTest.php +++ b/tests/Eccube/Tests/Web/Admin/Order/EditControllerTest.php @@ -239,7 +239,7 @@ public function testOrderCustomerInfo() $this->assertInstanceOf(Order::class, $EditedOrder); // 顧客の購入回数と購入金額確認 - $totalPrice = $EditedOrder->getTotalPrice(); + $totalPrice = $EditedOrder->getPaymentTotal(); $this->expected = $totalPrice; $this->actual = $EditedOrder->getCustomer()->getBuyTotal(); @@ -267,7 +267,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/EntryControllerTest.php b/tests/Eccube/Tests/Web/EntryControllerTest.php index 4ce9d2ebc9d..903de111491 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();