Skip to content

Commit eb944f4

Browse files
stripthislorenzo
authored andcommitted
Fix compatibility with cakephp 3.7 (#30)
* Fix compatibility with cakephp 3.7 * Fix schema regression * Add travis build
1 parent 59f463a commit eb944f4

20 files changed

+698
-324
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
vendor
22
.idea
3+
.DS_Store
4+
composer.lock

.travis.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
language: php
2+
3+
php:
4+
- 5.6
5+
- 7.0
6+
- 7.1
7+
- 7.2
8+
- 7.3
9+
10+
sudo: false
11+
12+
env:
13+
matrix:
14+
- DB=mysql db_dsn='mysql://[email protected]/cakephp_test'
15+
global:
16+
- DEFAULT=1
17+
18+
matrix:
19+
fast_finish: true
20+
include:
21+
- php: 7.3
22+
env: DEFAULT=0 COVERALLS=1 PHPCS=1 DB=mysql db_dsn='mysql://[email protected]/cakephp_test'
23+
24+
addons: *php7_addon
25+
before_script:
26+
- composer self-update
27+
- composer install --prefer-source --no-interaction
28+
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test;'; fi"
29+
- sh -c "if [ '$COVERALLS' = '1' ]; then mkdir -p build/logs; fi"
30+
- command -v phpenv > /dev/null && phpenv rehash || true
31+
32+
script:
33+
- sh -c "if [ '$COVERALLS' = '1' ]; then vendor/bin/phpunit --stderr --coverage-clover build/logs/clover.xml; fi"
34+
- sh -c "if [ '$COVERALLS' = '1' ]; then vendor/bin/php-coveralls -v; fi"
35+
- sh -c "if [ '$DEFAULT' = '1' ]; then vendor/bin/phpunit --stderr; fi"
36+
- sh -c "if [ '$PHPCS' = '1' ]; then vendor/bin/phpcs -n -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests; fi"
37+
38+
notifications:
39+
email: false

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2019 José Lorenzo Rodríguez
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

100644100755
Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ email templates and watching the result.
99

1010
## Requirements ##
1111

12-
* CakePHP 3.x
12+
* CakePHP 3.7
1313

1414
## Installation ##
1515

@@ -27,7 +27,6 @@ The plugin uses Debug email transport, so make sure your email config contain it
2727
]
2828
```
2929

30-
3130
### Enable plugin
3231

3332
```sh
@@ -87,3 +86,16 @@ read available options
8786

8887
You can configure this command to be run under a cron or any other tool
8988
you wish to use.
89+
90+
# Contributing
91+
92+
## Run the tests
93+
94+
```
95+
./vendor/bin/phpunit tests/
96+
```
97+
98+
## Check style
99+
```
100+
./vendor/bin/phpcs ./src ./tests/ --standard=vendor/cakephp/cakephp-codesniffer/CakePHP
101+
```

composer.json

100644100755
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
}
1313
],
1414
"require": {
15-
"cakephp/cakephp": "~3.1"
15+
"cakephp/cakephp": "~3.6"
1616
},
1717
"require-dev": {
18-
"phpunit/phpunit": "*"
18+
"phpunit/phpunit": "^5.7|^6.0",
19+
"cakephp/cakephp-codesniffer": "^3.0",
20+
"php-coveralls/php-coveralls": "^2.1"
1921
},
2022
"autoload": {
2123
"psr-4": {

config/Migrations/20160324054602_Initial.php

100644100755
Lines changed: 154 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -3,100 +3,185 @@
33

44
class Initial extends AbstractMigration
55
{
6+
7+
/**
8+
* Up Method
9+
*
10+
* More information on this method is available here:
11+
* http://docs.phinx.org/en/latest/migrations.html#the-up-method
12+
*
13+
* @return void
14+
*/
615
public function up()
716
{
817
$table = $this->table('email_queue');
918
$table
10-
->addColumn('email', 'string', [
19+
->addColumn(
20+
'email',
21+
'string',
22+
[
1123
'default' => null,
12-
'limit' => 129,
13-
'null' => false,
14-
])
15-
->addColumn('from_name', 'string', [
24+
'limit' => 129,
25+
'null' => false,
26+
]
27+
)
28+
->addColumn(
29+
'from_name',
30+
'string',
31+
[
1632
'default' => null,
17-
'limit' => 255,
18-
'null' => true,
19-
])
20-
->addColumn('from_email', 'string', [
33+
'limit' => 255,
34+
'null' => true,
35+
]
36+
)
37+
->addColumn(
38+
'from_email',
39+
'string',
40+
[
2141
'default' => null,
22-
'limit' => 255,
23-
'null' => true,
24-
])
25-
->addColumn('subject', 'string', [
42+
'limit' => 255,
43+
'null' => true,
44+
]
45+
)
46+
->addColumn(
47+
'subject',
48+
'string',
49+
[
2650
'default' => null,
27-
'limit' => 255,
28-
'null' => false,
29-
])
30-
->addColumn('config', 'string', [
51+
'limit' => 255,
52+
'null' => false,
53+
]
54+
)
55+
->addColumn(
56+
'config',
57+
'string',
58+
[
3159
'default' => null,
32-
'limit' => 30,
33-
'null' => false,
34-
])
35-
->addColumn('template', 'string', [
60+
'limit' => 30,
61+
'null' => false,
62+
]
63+
)
64+
->addColumn(
65+
'template',
66+
'string',
67+
[
3668
'default' => null,
37-
'limit' => 50,
38-
'null' => false,
39-
])
40-
->addColumn('layout', 'string', [
69+
'limit' => 50,
70+
'null' => false,
71+
]
72+
)
73+
->addColumn(
74+
'layout',
75+
'string',
76+
[
4177
'default' => null,
42-
'limit' => 50,
43-
'null' => false,
44-
])
45-
->addColumn('theme', 'string', [
78+
'limit' => 50,
79+
'null' => false,
80+
]
81+
)
82+
->addColumn(
83+
'theme',
84+
'string',
85+
[
4686
'default' => null,
47-
'limit' => 50,
48-
'null' => false,
49-
])
50-
->addColumn('format', 'string', [
87+
'limit' => 50,
88+
'null' => false,
89+
]
90+
)
91+
->addColumn(
92+
'format',
93+
'string',
94+
[
5195
'default' => null,
52-
'limit' => 5,
53-
'null' => false,
54-
])
55-
->addColumn('template_vars', 'text', [
96+
'limit' => 5,
97+
'null' => false,
98+
]
99+
)
100+
->addColumn(
101+
'template_vars',
102+
'text',
103+
[
56104
'default' => null,
57-
'limit' => null,
58-
'null' => false,
59-
])
60-
->addColumn('headers', 'text', [
105+
'limit' => null,
106+
'null' => false,
107+
]
108+
)
109+
->addColumn(
110+
'headers',
111+
'text',
112+
[
61113
'default' => null,
62-
'limit' => null,
63-
'null' => true,
64-
])
65-
->addColumn('sent', 'boolean', [
114+
'limit' => null,
115+
'null' => true,
116+
]
117+
)
118+
->addColumn(
119+
'sent',
120+
'boolean',
121+
[
66122
'default' => 0,
67-
'limit' => null,
68-
'null' => false,
69-
])
70-
->addColumn('locked', 'boolean', [
123+
'limit' => null,
124+
'null' => false,
125+
]
126+
)
127+
->addColumn(
128+
'locked',
129+
'boolean',
130+
[
71131
'default' => 0,
72-
'limit' => null,
73-
'null' => false,
74-
])
75-
->addColumn('send_tries', 'integer', [
132+
'limit' => null,
133+
'null' => false,
134+
]
135+
)
136+
->addColumn(
137+
'send_tries',
138+
'integer',
139+
[
76140
'default' => 0,
77-
'limit' => 2,
78-
'null' => false,
79-
])
80-
->addColumn('send_at', 'datetime', [
141+
'limit' => 2,
142+
'null' => false,
143+
]
144+
)
145+
->addColumn(
146+
'send_at',
147+
'datetime',
148+
[
81149
'default' => null,
82-
'limit' => null,
83-
'null' => true,
84-
])
85-
->addColumn('created', 'datetime', [
150+
'limit' => null,
151+
'null' => true,
152+
]
153+
)
154+
->addColumn(
155+
'created',
156+
'datetime',
157+
[
86158
'default' => null,
87-
'limit' => null,
88-
'null' => false,
89-
])
90-
->addColumn('modified', 'datetime', [
159+
'limit' => null,
160+
'null' => false,
161+
]
162+
)
163+
->addColumn(
164+
'modified',
165+
'datetime',
166+
[
91167
'default' => null,
92-
'limit' => null,
93-
'null' => true,
94-
])
168+
'limit' => null,
169+
'null' => true,
170+
]
171+
)
95172
->create();
96173
}
97174

175+
/**
176+
* Down Method
177+
*
178+
* More information on this method is available here:
179+
* http://docs.phinx.org/en/latest/migrations.html#the-down-method
180+
*
181+
* @return void
182+
*/
98183
public function down()
99184
{
100-
$this->dropTable('email_queue');
185+
$this->table('email_queue')->drop()->save();
101186
}
102187
}

config/Migrations/20160810121455_AddAttachmentsToEmailQueue.php

100644100755
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,20 @@ class AddAttachmentsToEmailQueue extends AbstractMigration
88
*
99
* More information on this method is available here:
1010
* http://docs.phinx.org/en/latest/migrations.html#the-change-method
11+
*
1112
* @return void
1213
*/
1314
public function change()
1415
{
1516
$table = $this->table('email_queue');
16-
$table->addColumn('attachments', 'text', [
17+
$table->addColumn(
18+
'attachments',
19+
'text',
20+
[
1721
'default' => null,
1822
'null' => true,
19-
]);
23+
]
24+
);
2025
$table->update();
2126
}
2227
}

0 commit comments

Comments
 (0)