From 40f4fae1b90b07929c85e3774cd54ccb8c523983 Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Tue, 13 Feb 2024 11:27:26 +0900 Subject: [PATCH 1/9] =?UTF-8?q?fix:ContainerInterface=E3=82=92Psr=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PluginManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PluginManager.php b/PluginManager.php index b438478..65b95e0 100644 --- a/PluginManager.php +++ b/PluginManager.php @@ -14,7 +14,7 @@ namespace Plugin\MailMagazine42; use Eccube\Plugin\AbstractPluginManager; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Psr\Container\ContainerInterface; use Symfony\Component\Filesystem\Filesystem; class PluginManager extends AbstractPluginManager From 5013bbe8cc4e84ac8dcd3f12938591845d4f25ed Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Tue, 13 Feb 2024 16:26:00 +0900 Subject: [PATCH 2/9] =?UTF-8?q?fix:Session=E3=81=AE=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Service/MailMagazineService.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Service/MailMagazineService.php b/Service/MailMagazineService.php index cf3e2d0..a3e9b05 100644 --- a/Service/MailMagazineService.php +++ b/Service/MailMagazineService.php @@ -21,6 +21,7 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface; use Eccube\Repository\CustomerRepository; use Doctrine\ORM\Query; +use Eccube\Session\Session; use Doctrine\ORM\QueryBuilder; use Plugin\MailMagazine42\Repository\MailMagazineSendHistoryRepository; use Doctrine\ORM\EntityManagerInterface; @@ -106,9 +107,9 @@ class MailMagazineService protected $mailer; /** - * @var SessionInterface + * @var Session */ - protected $session; + protected Session $session; /** * @var CustomerRepository @@ -131,7 +132,7 @@ class MailMagazineService * @param MailerInterface $mailer * @param BaseInfoRepository $baseInfoRepository * @param EccubeConfig $eccubeConfig - * @param SessionInterface $session + * @param Session $session * @param CustomerRepository $customerRepository * @param MailMagazineSendHistoryRepository $mailMagazineSendHistoryRepository * @param EntityManagerInterface $entityManager @@ -143,7 +144,7 @@ public function __construct( MailerInterface $mailer, BaseInfoRepository $baseInfoRepository, EccubeConfig $eccubeConfig, - SessionInterface $session, + Session $session, CustomerRepository $customerRepository, MailMagazineSendHistoryRepository $mailMagazineSendHistoryRepository, EntityManagerInterface $entityManager From bfa93f8b3ec48505174ab8e587b244137add33dc Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Wed, 14 Feb 2024 09:37:35 +0900 Subject: [PATCH 3/9] =?UTF-8?q?fix:=E3=82=BF=E3=82=A4=E3=83=97=E3=83=92?= =?UTF-8?q?=E3=83=B3=E3=83=86=E3=82=A3=E3=83=B3=E3=82=B0=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ilMagazineHistoryFilePaginationSubscriber.php | 2 +- Service/MailMagazineService.php | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Event/MailMagazineHistoryFilePaginationSubscriber.php b/Event/MailMagazineHistoryFilePaginationSubscriber.php index 2c87c23..3094b3e 100644 --- a/Event/MailMagazineHistoryFilePaginationSubscriber.php +++ b/Event/MailMagazineHistoryFilePaginationSubscriber.php @@ -22,7 +22,7 @@ class MailMagazineHistoryFilePaginationSubscriber implements EventSubscriberInte /** * @var MailMagazineService */ - protected $mailMagazineService; + protected MailMagazineService $mailMagazineService; /** * MailMagazineHistoryFilePaginationSubscriber constructor. diff --git a/Service/MailMagazineService.php b/Service/MailMagazineService.php index a3e9b05..db50569 100644 --- a/Service/MailMagazineService.php +++ b/Service/MailMagazineService.php @@ -84,27 +84,27 @@ class MailMagazineService * * @var string */ - private $lastSendMailHtmlBody = ''; + private string $lastSendMailHtmlBody = ''; /** * @var string */ - private $mailMagazineDir; + private mixed $mailMagazineDir; /** * @var BaseInfo */ - public $BaseInfo; + public BaseInfo $BaseInfo; /** * @var EccubeConfig */ - protected $eccubeConfig; + protected EccubeConfig $eccubeConfig; /** * @var MailerInterface */ - protected $mailer; + protected MailerInterface $mailer; /** * @var Session @@ -114,17 +114,17 @@ class MailMagazineService /** * @var CustomerRepository */ - protected $customerRepository; + protected CustomerRepository $customerRepository; /** * @var MailMagazineSendHistoryRepository */ - protected $mailMagazineSendHistoryRepository; + protected MailMagazineSendHistoryRepository $mailMagazineSendHistoryRepository; /** * @var EntityManagerInterface */ - protected $entityManager; + protected EntityManagerInterface $entityManager; /** * MailMagazineService constructor. From ac6a00be970259266d8e1fbc564436901b6a05f4 Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Thu, 15 Feb 2024 12:08:02 +0900 Subject: [PATCH 4/9] =?UTF-8?q?fix:container=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tests/Service/MailMagazineServiceTest.php | 5 +++-- .../Util/MailMagazineHistoryFilePaginationSubscriberTest.php | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Tests/Service/MailMagazineServiceTest.php b/Tests/Service/MailMagazineServiceTest.php index af9116b..9327da2 100644 --- a/Tests/Service/MailMagazineServiceTest.php +++ b/Tests/Service/MailMagazineServiceTest.php @@ -14,6 +14,7 @@ namespace Plugin\MailMagazine42\Tests\Service; use Plugin\MailMagazine42\Entity\MailMagazineSendHistory; +use Plugin\MailMagazine42\Service\MailMagazineService; use Plugin\MailMagazine42\Tests\AbstractMailMagazineTestCase; class MailMagazineServiceTest extends AbstractMailMagazineTestCase @@ -32,7 +33,7 @@ public function setUp(): void { $this->markTestSkipped('Skipped due to still not assign mock Swift_Mailler to service container'); parent::setUp(); - $this->mailMagazineService = self::$container->get(MailMagazineService::class); + $this->mailMagazineService = self::getContainer()->get(MailMagazineService::class); $this->client->enableProfiler(); // $this->mailer = $this->getMockBuilder('\Swift_Mailer')->disableOriginalConstructor()->getMock(); $this->sentAddresses = []; @@ -40,7 +41,7 @@ public function setUp(): void public function testGetHistoryFileName() { - $dir = self::$container->getParameter('kernel.project_dir').'/app/mail_magazine/'; + $dir = self::getContainer()->getParameter('kernel.project_dir').'/app/mail_magazine/'; self::assertEquals($dir.'mail_magazine_in_1.txt', $this->mailMagazineService->getHistoryFileName(1)); self::assertEquals($dir.'mail_magazine_in_2.txt', $this->mailMagazineService->getHistoryFileName(2)); self::assertEquals($dir.'mail_magazine_in_1.txt', $this->mailMagazineService->getHistoryFileName(1, true)); diff --git a/Tests/Util/MailMagazineHistoryFilePaginationSubscriberTest.php b/Tests/Util/MailMagazineHistoryFilePaginationSubscriberTest.php index 67f551e..0653286 100644 --- a/Tests/Util/MailMagazineHistoryFilePaginationSubscriberTest.php +++ b/Tests/Util/MailMagazineHistoryFilePaginationSubscriberTest.php @@ -33,7 +33,7 @@ public function setUp(): void if (!file_exists($this->rootDir)) { mkdir($this->rootDir); } - self::$container->get(MailMagazineService::class)->setMailMagazineDir($this->rootDir); + self::getContainer()->get(MailMagazineService::class)->setMailMagazineDir($this->rootDir); } public function tearDown(): void @@ -154,7 +154,7 @@ private function newPagination($file, $page, $limit, $total) $eventDispatcher = new EventDispatcher(); $eventDispatcher->addSubscriber(new PaginationSubscriber); $eventDispatcher->addSubscriber(new SortableSubscriber); - $eventDispatcher->addSubscriber(self::$container->get(MailMagazineHistoryFilePaginationSubscriber::class)); + $eventDispatcher->addSubscriber(self::getContainer()->get(MailMagazineHistoryFilePaginationSubscriber::class)); $paginator = new Paginator($eventDispatcher); From a0e089e232aa5ada9aaf5f56e3b2b307d7b77f4c Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Thu, 15 Feb 2024 12:12:50 +0900 Subject: [PATCH 5/9] =?UTF-8?q?fix:action=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a330bb2..14bb3bc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,14 +17,13 @@ on: jobs: run-on-linux: name: Run on Linux - runs-on: ${{ matrix.operating-system }} + runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: - operating-system: [ ubuntu-18.04 ] - php: [ '7.4', '8.0', '8.1' ] + eccube_version: [ '4.2', '4.3-symfony6' ] + php: [ '7.4', '8.0', '8.1', '8.2', '8.3' ] db: [ 'mysql', 'mysql8', 'pgsql' ] - eccube_version: [ '4.2' ] plugin_code: [ 'MailMagazine42' ] include: - db: mysql @@ -39,6 +38,15 @@ jobs: database_url: postgres://postgres:password@127.0.0.1:5432/eccube_db database_server_version: 14 database_charset: utf8 + exclude: + - eccube_version: 4.2 + php: 8.2 + - eccube_version: 4.2 + php: 8.3 + - eccube_version: 4.3-symfony6 + php: 7.4 + - eccube_version: 4.3-symfony6 + php: 8.0 services: mysql: image: mysql:5.7 @@ -72,7 +80,6 @@ jobs: - 1080:1080 - 1025:1025 steps: - - run: sudo apt-get purge -y hhvm - name: Checkout uses: actions/checkout@v2 @@ -143,7 +150,7 @@ jobs: working-directory: 'ec-cube' run: | bin/console cache:clear --no-warmup - bin/phpunit -c app/Plugin/${PLUGIN_CODE}/phpunit.xml.dist app/Plugin/${PLUGIN_CODE}/Tests + ./vendor/bin/phpunit -c app/Plugin/${PLUGIN_CODE}/phpunit.xml.dist app/Plugin/${PLUGIN_CODE}/Tests - name: Disable Plugin working-directory: 'ec-cube' From 5d03ecd3cffb4e527bea19f012138a7a4c9c0f12 Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Thu, 15 Feb 2024 12:14:00 +0900 Subject: [PATCH 6/9] =?UTF-8?q?fix:version=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 9aff7c6..d874b95 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "ec-cube/mailmagazine42", - "version": "4.2.3", + "version": "4.3.0", "description": "メールマガジンプラグイン", "type": "eccube-plugin", "require": { From 32a8e0f322275b1677e6035cdb6275a5f182a547 Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Thu, 15 Feb 2024 15:38:41 +0900 Subject: [PATCH 7/9] =?UTF-8?q?fix:action=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Service/MailMagazineService.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Service/MailMagazineService.php b/Service/MailMagazineService.php index db50569..4f6da05 100644 --- a/Service/MailMagazineService.php +++ b/Service/MailMagazineService.php @@ -21,7 +21,7 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface; use Eccube\Repository\CustomerRepository; use Doctrine\ORM\Query; -use Eccube\Session\Session; +use Symfony\Component\HttpFoundation\RequestStack; use Doctrine\ORM\QueryBuilder; use Plugin\MailMagazine42\Repository\MailMagazineSendHistoryRepository; use Doctrine\ORM\EntityManagerInterface; @@ -107,9 +107,9 @@ class MailMagazineService protected MailerInterface $mailer; /** - * @var Session + * @var SessionInterface */ - protected Session $session; + protected SessionInterface $session; /** * @var CustomerRepository @@ -132,7 +132,7 @@ class MailMagazineService * @param MailerInterface $mailer * @param BaseInfoRepository $baseInfoRepository * @param EccubeConfig $eccubeConfig - * @param Session $session + * @param RequestStack $requestStack * @param CustomerRepository $customerRepository * @param MailMagazineSendHistoryRepository $mailMagazineSendHistoryRepository * @param EntityManagerInterface $entityManager @@ -144,7 +144,7 @@ public function __construct( MailerInterface $mailer, BaseInfoRepository $baseInfoRepository, EccubeConfig $eccubeConfig, - Session $session, + RequestStack $requestStack, CustomerRepository $customerRepository, MailMagazineSendHistoryRepository $mailMagazineSendHistoryRepository, EntityManagerInterface $entityManager @@ -152,7 +152,7 @@ public function __construct( $this->mailer = $mailer; $this->BaseInfo = $baseInfoRepository->get(); $this->eccubeConfig = $eccubeConfig; - $this->session = $session; + $this->session = $requestStack->getSession(); $this->customerRepository = $customerRepository; $this->mailMagazineSendHistoryRepository = $mailMagazineSendHistoryRepository; $this->entityManager = $entityManager; From 8a4b0fb726ddcade5c7cd5845e605386f07c7c31 Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Thu, 15 Feb 2024 15:50:48 +0900 Subject: [PATCH 8/9] =?UTF-8?q?fix:action=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PluginManager.php | 4 +++- Service/MailMagazineService.php | 10 ---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/PluginManager.php b/PluginManager.php index 65b95e0..278280d 100644 --- a/PluginManager.php +++ b/PluginManager.php @@ -13,6 +13,7 @@ namespace Plugin\MailMagazine42; +use Eccube\Common\EccubeConfig; use Eccube\Plugin\AbstractPluginManager; use Psr\Container\ContainerInterface; use Symfony\Component\Filesystem\Filesystem; @@ -23,6 +24,7 @@ class PluginManager extends AbstractPluginManager public function uninstall(array $meta, ContainerInterface $container) { $file = new Filesystem(); - $file->remove($container->getParameter('mail_magazine_dir')); + + $file->remove($container->get(EccubeConfig::class)->get('mail_magazine_dir')); } } diff --git a/Service/MailMagazineService.php b/Service/MailMagazineService.php index 4f6da05..6c6f591 100644 --- a/Service/MailMagazineService.php +++ b/Service/MailMagazineService.php @@ -18,10 +18,8 @@ use Eccube\Repository\BaseInfoRepository; use Eccube\Entity\BaseInfo; use Eccube\Common\EccubeConfig; -use Symfony\Component\HttpFoundation\Session\SessionInterface; use Eccube\Repository\CustomerRepository; use Doctrine\ORM\Query; -use Symfony\Component\HttpFoundation\RequestStack; use Doctrine\ORM\QueryBuilder; use Plugin\MailMagazine42\Repository\MailMagazineSendHistoryRepository; use Doctrine\ORM\EntityManagerInterface; @@ -106,11 +104,6 @@ class MailMagazineService */ protected MailerInterface $mailer; - /** - * @var SessionInterface - */ - protected SessionInterface $session; - /** * @var CustomerRepository */ @@ -132,7 +125,6 @@ class MailMagazineService * @param MailerInterface $mailer * @param BaseInfoRepository $baseInfoRepository * @param EccubeConfig $eccubeConfig - * @param RequestStack $requestStack * @param CustomerRepository $customerRepository * @param MailMagazineSendHistoryRepository $mailMagazineSendHistoryRepository * @param EntityManagerInterface $entityManager @@ -144,7 +136,6 @@ public function __construct( MailerInterface $mailer, BaseInfoRepository $baseInfoRepository, EccubeConfig $eccubeConfig, - RequestStack $requestStack, CustomerRepository $customerRepository, MailMagazineSendHistoryRepository $mailMagazineSendHistoryRepository, EntityManagerInterface $entityManager @@ -152,7 +143,6 @@ public function __construct( $this->mailer = $mailer; $this->BaseInfo = $baseInfoRepository->get(); $this->eccubeConfig = $eccubeConfig; - $this->session = $requestStack->getSession(); $this->customerRepository = $customerRepository; $this->mailMagazineSendHistoryRepository = $mailMagazineSendHistoryRepository; $this->entityManager = $entityManager; From ea6dc77794231e1354f3bef321ea015f37de0217 Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Thu, 15 Feb 2024 16:00:04 +0900 Subject: [PATCH 9/9] =?UTF-8?q?fix:=E5=9E=8B=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Service/MailMagazineService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Service/MailMagazineService.php b/Service/MailMagazineService.php index 6c6f591..a2ecdb7 100644 --- a/Service/MailMagazineService.php +++ b/Service/MailMagazineService.php @@ -87,7 +87,7 @@ class MailMagazineService /** * @var string */ - private mixed $mailMagazineDir; + private string $mailMagazineDir; /** * @var BaseInfo