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' 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/PluginManager.php b/PluginManager.php index b438478..278280d 100644 --- a/PluginManager.php +++ b/PluginManager.php @@ -13,8 +13,9 @@ namespace Plugin\MailMagazine42; +use Eccube\Common\EccubeConfig; use Eccube\Plugin\AbstractPluginManager; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Psr\Container\ContainerInterface; use Symfony\Component\Filesystem\Filesystem; class PluginManager extends AbstractPluginManager @@ -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 cf3e2d0..a2ecdb7 100644 --- a/Service/MailMagazineService.php +++ b/Service/MailMagazineService.php @@ -18,7 +18,6 @@ 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 Doctrine\ORM\QueryBuilder; @@ -83,47 +82,42 @@ class MailMagazineService * * @var string */ - private $lastSendMailHtmlBody = ''; + private string $lastSendMailHtmlBody = ''; /** * @var string */ - private $mailMagazineDir; + private string $mailMagazineDir; /** * @var BaseInfo */ - public $BaseInfo; + public BaseInfo $BaseInfo; /** * @var EccubeConfig */ - protected $eccubeConfig; + protected EccubeConfig $eccubeConfig; /** * @var MailerInterface */ - protected $mailer; - - /** - * @var SessionInterface - */ - protected $session; + protected MailerInterface $mailer; /** * @var CustomerRepository */ - protected $customerRepository; + protected CustomerRepository $customerRepository; /** * @var MailMagazineSendHistoryRepository */ - protected $mailMagazineSendHistoryRepository; + protected MailMagazineSendHistoryRepository $mailMagazineSendHistoryRepository; /** * @var EntityManagerInterface */ - protected $entityManager; + protected EntityManagerInterface $entityManager; /** * MailMagazineService constructor. @@ -131,7 +125,6 @@ class MailMagazineService * @param MailerInterface $mailer * @param BaseInfoRepository $baseInfoRepository * @param EccubeConfig $eccubeConfig - * @param SessionInterface $session * @param CustomerRepository $customerRepository * @param MailMagazineSendHistoryRepository $mailMagazineSendHistoryRepository * @param EntityManagerInterface $entityManager @@ -143,7 +136,6 @@ public function __construct( MailerInterface $mailer, BaseInfoRepository $baseInfoRepository, EccubeConfig $eccubeConfig, - SessionInterface $session, CustomerRepository $customerRepository, MailMagazineSendHistoryRepository $mailMagazineSendHistoryRepository, EntityManagerInterface $entityManager @@ -151,7 +143,6 @@ public function __construct( $this->mailer = $mailer; $this->BaseInfo = $baseInfoRepository->get(); $this->eccubeConfig = $eccubeConfig; - $this->session = $session; $this->customerRepository = $customerRepository; $this->mailMagazineSendHistoryRepository = $mailMagazineSendHistoryRepository; $this->entityManager = $entityManager; 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); 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": {