Skip to content

Commit 993c51e

Browse files
Merge pull request #108 from nanasess/improve/4.1
4.1 support
2 parents 112e4d0 + a879b3d commit 993c51e

16 files changed

Lines changed: 247 additions & 258 deletions

.github/workflows/main.yml

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
name: CI for MailMagazine4
2+
on:
3+
push:
4+
branches:
5+
- '*'
6+
tags:
7+
- '*'
8+
paths:
9+
- '**'
10+
- '!*.md'
11+
pull_request:
12+
branches:
13+
- '*'
14+
paths:
15+
- '**'
16+
- '!*.md'
17+
jobs:
18+
run-on-linux:
19+
name: Run on Linux
20+
runs-on: ${{ matrix.operating-system }}
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
operating-system: [ ubuntu-18.04 ]
25+
php: [ '7.1', '7.2', '7.3', '7.4' ]
26+
db: [ mysql, pgsql ]
27+
eccube_version: [ '4.0.6-p1', '4.1' ]
28+
plugin_code: [ 'MailMagazine4' ]
29+
include:
30+
- eccube_version: '4.0.6-p1'
31+
composer: 'v1'
32+
- eccube_version: '4.1'
33+
composer: 'v2'
34+
- db: mysql
35+
dbport: '3306'
36+
dbuser: 'root'
37+
dbpass: 'root'
38+
dbname: 'myapp_test'
39+
dbversion: 5.7
40+
- db: pgsql
41+
dbport: '5432'
42+
dbuser: 'postgres'
43+
dbpass: 'password'
44+
dbname: 'myapp_test'
45+
dbversion: 9.5
46+
services:
47+
mysql:
48+
image: mysql:5.7
49+
env:
50+
MYSQL_ROOT_PASSWORD: root
51+
MYSQL_DATABASE: ${{ matrix.dbname }}
52+
ports:
53+
- 3306:3306
54+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
55+
postgres:
56+
image: postgres:9.5
57+
env:
58+
POSTGRES_USER: postgres
59+
POSTGRES_PASSWORD: password
60+
POSTGRES_DB: ${{ matrix.dbname }}
61+
ports:
62+
- 5432:5432
63+
# needed because the postgres container does not provide a healthcheck
64+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
65+
mailcatcher:
66+
image: schickling/mailcatcher
67+
ports:
68+
- 1080:1080
69+
- 1025:1025
70+
steps:
71+
- run: sudo apt-get purge -y hhvm
72+
- name: Checkout
73+
uses: actions/checkout@v2
74+
75+
- name: Setup PHP
76+
uses: nanasess/setup-php@master
77+
with:
78+
php-version: ${{ matrix.php }}
79+
80+
- name: Archive Plugin
81+
env:
82+
PLUGIN_CODE: ${{ matrix.plugin_code }}
83+
run: |
84+
tar cvzf ${GITHUB_WORKSPACE}/${PLUGIN_CODE}.tar.gz ./*
85+
- name: Checkout EC-CUBE
86+
uses: actions/checkout@v2
87+
with:
88+
repository: 'EC-CUBE/ec-cube'
89+
ref: ${{ matrix.eccube_version }}
90+
path: 'ec-cube'
91+
92+
- name: Get Composer Cache Directory
93+
id: composer-cache
94+
run: |
95+
echo "::set-output name=dir::$(composer config cache-files-dir)"
96+
97+
- uses: actions/cache@v1
98+
with:
99+
path: ${{ steps.composer-cache.outputs.dir }}
100+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
101+
restore-keys: |
102+
${{ runner.os }}-composer-
103+
104+
- if: matrix.composer == 'v1'
105+
run: sudo composer selfupdate --1
106+
107+
- name: Install to composer
108+
working-directory: 'ec-cube'
109+
run: composer install --no-interaction -o --apcu-autoloader
110+
111+
- if: matrix.composer == 'v1'
112+
working-directory: 'ec-cube'
113+
run: composer require kiy0taka/eccube4-test-fixer "dev-main@dev"
114+
115+
- name: Setup EC-CUBE
116+
env:
117+
DB: ${{ matrix.db }}
118+
USER: ${{ matrix.dbuser }}
119+
DBUSER: ${{ matrix.dbuser }}
120+
DBPASS: ${{ matrix.dbpass }}
121+
DBNAME: ${{ matrix.dbname }}
122+
DBPORT: ${{ matrix.dbport }}
123+
DBSERVER: 127.0.0.1
124+
DBVERSION: ${{ matrix.dbversion }}
125+
ROOT_URLPATH: /ec-cube/html
126+
working-directory: 'ec-cube'
127+
run: |
128+
export PGPASSWORD=${DBPASS}
129+
echo "APP_ENV=prod" > .env
130+
echo "APP_DEBUG=0" >> .env
131+
echo "DATABASE_URL=${DB}://${DBUSER}:${DBPASS}@${DBSERVER}/${DBNAME}" >> .env
132+
echo "DATABASE_SERVER_VERSION=${DBVERSION}" >> .env
133+
echo "MAILER_URL=smtp://127.0.0.1:1025" >> .env
134+
echo "HTTP_SITEURL=https://localhost" >> .env
135+
echo "USE_SELFSIGNED_SSL_CERTIFICATE=1" >> .env
136+
cat .env
137+
bin/console doctrine:schema:create
138+
bin/console eccube:fixtures:load
139+
140+
- name: Setup Plugin
141+
env:
142+
PLUGIN_CODE: ${{ matrix.plugin_code }}
143+
working-directory: 'ec-cube'
144+
run: |
145+
bin/console eccube:plugin:install --code=${PLUGIN_CODE} --path=${GITHUB_WORKSPACE}/${PLUGIN_CODE}.tar.gz
146+
bin/console eccube:plugin:enable --code=${PLUGIN_CODE}
147+
rm codeception/_support/*Tester.php
148+
149+
- name: Run PHPUnit
150+
if: matrix.composer == 'v2'
151+
env:
152+
PLUGIN_CODE: ${{ matrix.plugin_code }}
153+
working-directory: 'ec-cube'
154+
run: bin/phpunit -c app/Plugin/${PLUGIN_CODE}/phpunit.xml.dist app/Plugin/${PLUGIN_CODE}/Tests
155+
156+
- name: Run PHPUnit
157+
if: matrix.composer == 'v1'
158+
env:
159+
PLUGIN_CODE: ${{ matrix.plugin_code }}
160+
working-directory: 'ec-cube'
161+
run: |
162+
find app/Plugin/${PLUGIN_CODE}/Tests -name "*Test.php" | while read TESTCASE
163+
do
164+
./vendor/bin/phpunit -c app/Plugin/${PLUGIN_CODE}/phpunit.xml.dist --include-path vendor/kiy0taka/eccube4-test-fixer/src --loader 'Eccube\PHPUnit\Loader\Eccube4CompatTestSuiteLoader' ${TESTCASE}
165+
done
166+
167+
- name: Disable Plugin
168+
working-directory: 'ec-cube'
169+
env:
170+
PLUGIN_CODE: ${{ matrix.plugin_code }}
171+
run: bin/console eccube:plugin:disable --code=${PLUGIN_CODE}
172+
173+
- name: Uninstall Plugin
174+
env:
175+
PLUGIN_CODE: ${{ matrix.plugin_code }}
176+
working-directory: 'ec-cube'
177+
run: bin/console eccube:plugin:uninstall --code=${PLUGIN_CODE}

.travis.yml

Lines changed: 0 additions & 134 deletions
This file was deleted.

Controller/MailMagazineController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
use Eccube\Repository\Master\PageMaxRepository;
2626
use Eccube\Util\FormUtil;
2727
use Eccube\Repository\CustomerRepository;
28-
use Knp\Component\Pager\Paginator;
28+
use Knp\Component\Pager\PaginatorInterface;
2929
use Plugin\MailMagazine4\Form\Type\MailMagazineType;
3030
use Doctrine\ORM\QueryBuilder;
3131
use Eccube\Common\Constant;
@@ -86,12 +86,12 @@ public function __construct(
8686
* @Template("@MailMagazine4/admin/index.twig")
8787
*
8888
* @param Request $request
89-
* @param Paginator $paginator
89+
* @param PaginatorInterface $paginator
9090
* @param integer $page_no
9191
*
9292
* @return \Symfony\Component\HttpFoundation\Response|array
9393
*/
94-
public function index(Request $request, Paginator $paginator, $page_no = null, \Swift_Mailer $mailer)
94+
public function index(Request $request, PaginatorInterface $paginator, $page_no = null, \Swift_Mailer $mailer)
9595
{
9696
$session = $request->getSession();
9797
$pageNo = $page_no;

Controller/MailMagazineHistoryController.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Eccube\Controller\AbstractController;
1717
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
1818
use Symfony\Component\Routing\Annotation\Route;
19-
use Knp\Component\Pager\Paginator;
19+
use Knp\Component\Pager\PaginatorInterface;
2020
use Plugin\MailMagazine4\Entity\MailMagazineSendHistory;
2121
use Plugin\MailMagazine4\Repository\MailMagazineSendHistoryRepository;
2222
use Plugin\MailMagazine4\Service\MailMagazineService;
@@ -70,12 +70,12 @@ public function __construct(
7070
* @Template("@MailMagazine4/admin/history_list.twig")
7171
*
7272
* @param Request $request
73-
* @param Paginator $paginator
73+
* @param PaginatorInterface $paginator
7474
* @param int $page_no
7575
*
7676
* @return array
7777
*/
78-
public function index(Request $request, Paginator $paginator, $page_no = 1)
78+
public function index(Request $request, PaginatorInterface $paginator, $page_no = 1)
7979
{
8080
$pageNo = $page_no;
8181
$pageMaxis = $this->pageMaxRepository->findAll();
@@ -276,12 +276,12 @@ public function retry(Request $request, MailMagazineSendHistory $mailMagazineSen
276276
*
277277
* @param Request $request
278278
* @param MailMagazineSendHistory $mailMagazineSendHistory
279-
* @param Paginator $paginator
279+
* @param PaginatorInterface $paginator
280280
* @param int $page_no
281281
*
282282
* @return mixed
283283
*/
284-
public function result(Request $request, MailMagazineSendHistory $mailMagazineSendHistory, Paginator $paginator, $page_no = 1)
284+
public function result(Request $request, MailMagazineSendHistory $mailMagazineSendHistory, PaginatorInterface $paginator, $page_no = 1)
285285
{
286286
$resultFile = $this->mailMagazineService->getHistoryFileName($mailMagazineSendHistory->getId(), false);
287287
$pageMaxis = $this->pageMaxRepository->findAll();

Form/Extension/CustomerMailMagazineTypeExtension.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,14 @@ public function getExtendedType()
6868
{
6969
return CustomerType::class;
7070
}
71+
72+
/**
73+
* {@inheritdoc}
74+
*
75+
* @return string[]
76+
*/
77+
public function getExtendedTypes()
78+
{
79+
yield CustomerType::class;
80+
}
7181
}

0 commit comments

Comments
 (0)