Skip to content

Commit

Permalink
Merge pull request #146 from dotani1111/dev/feat_4.3
Browse files Browse the repository at this point in the history
4.3対応
  • Loading branch information
chihiro-adachi authored Apr 8, 2024
2 parents d65ca55 + ea6dc77 commit ba6a2b7
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 31 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -72,7 +80,6 @@ jobs:
- 1080:1080
- 1025:1025
steps:
- run: sudo apt-get purge -y hhvm
- name: Checkout
uses: actions/checkout@v2

Expand Down Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion Event/MailMagazineHistoryFilePaginationSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class MailMagazineHistoryFilePaginationSubscriber implements EventSubscriberInte
/**
* @var MailMagazineService
*/
protected $mailMagazineService;
protected MailMagazineService $mailMagazineService;

/**
* MailMagazineHistoryFilePaginationSubscriber constructor.
Expand Down
6 changes: 4 additions & 2 deletions PluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'));
}
}
25 changes: 8 additions & 17 deletions Service/MailMagazineService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -83,55 +82,49 @@ 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.
*
* @param MailerInterface $mailer
* @param BaseInfoRepository $baseInfoRepository
* @param EccubeConfig $eccubeConfig
* @param SessionInterface $session
* @param CustomerRepository $customerRepository
* @param MailMagazineSendHistoryRepository $mailMagazineSendHistoryRepository
* @param EntityManagerInterface $entityManager
Expand All @@ -143,15 +136,13 @@ public function __construct(
MailerInterface $mailer,
BaseInfoRepository $baseInfoRepository,
EccubeConfig $eccubeConfig,
SessionInterface $session,
CustomerRepository $customerRepository,
MailMagazineSendHistoryRepository $mailMagazineSendHistoryRepository,
EntityManagerInterface $entityManager
) {
$this->mailer = $mailer;
$this->BaseInfo = $baseInfoRepository->get();
$this->eccubeConfig = $eccubeConfig;
$this->session = $session;
$this->customerRepository = $customerRepository;
$this->mailMagazineSendHistoryRepository = $mailMagazineSendHistoryRepository;
$this->entityManager = $entityManager;
Expand Down
5 changes: 3 additions & 2 deletions Tests/Service/MailMagazineServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -32,15 +33,15 @@ 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 = [];
}

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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ec-cube/mailmagazine42",
"version": "4.2.3",
"version": "4.3.0",
"description": "メールマガジンプラグイン",
"type": "eccube-plugin",
"require": {
Expand Down

0 comments on commit ba6a2b7

Please sign in to comment.