Skip to content

Commit bcd5e85

Browse files
committed
Merge pull request #14 from k1LoW/update-schema-form_name-from_email
Update schema for TEST-GREEN
2 parents fa0c875 + f2f18af commit bcd5e85

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

config/Migrations/20160324054602_Initial.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ public function up()
1515
->addColumn('from_name', 'string', [
1616
'default' => null,
1717
'limit' => 255,
18-
'null' => false,
18+
'null' => true,
1919
])
2020
->addColumn('from_email', 'string', [
2121
'default' => null,
2222
'limit' => 255,
23-
'null' => false,
23+
'null' => true,
2424
])
2525
->addColumn('subject', 'string', [
2626
'default' => null,

config/Schema/schema.sql

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ DROP TABLE IF EXISTS `email_queue`;
22
CREATE TABLE IF NOT EXISTS `email_queue` (
33
`id` char(36) CHARACTER SET ascii NOT NULL,
44
`email` varchar(129) NOT NULL,
5-
`from_name` varchar(255) NOT NULL,
6-
`from_email` varchar(255) NOT NULL,
5+
`from_name` varchar(255),
6+
`from_email` varchar(255),
77
`subject` varchar(255) NOT NULL,
88
`config` varchar(30) NOT NULL,
99
`template` varchar(50) NOT NULL,

tests/Fixture/EmailQueueFixture.php

+14
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class EmailQueueFixture extends TestFixture
1919
public $fields = array(
2020
'id' => array('type' => 'uuid', 'null' => false),
2121
'email' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 100, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
22+
'from_name' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 100, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
23+
'from_email' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 100, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
2224
'subject' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 255, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
2325
'config' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 30, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
2426
'template' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 50, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
@@ -44,6 +46,8 @@ class EmailQueueFixture extends TestFixture
4446
array(
4547
'id' => 'email-1',
4648
'email' => '[email protected]',
49+
'from_name' => null,
50+
'from_email' => null,
4751
'subject' => 'Free dealz',
4852
'config' => 'default',
4953
'template' => 'default',
@@ -61,6 +65,8 @@ class EmailQueueFixture extends TestFixture
6165
array(
6266
'id' => 'email-2',
6367
'email' => '[email protected]',
68+
'from_name' => null,
69+
'from_email' => null,
6470
'subject' => 'Free dealz',
6571
'config' => 'default',
6672
'template' => 'default',
@@ -78,6 +84,8 @@ class EmailQueueFixture extends TestFixture
7884
array(
7985
'id' => 'email-3',
8086
'email' => '[email protected]',
87+
'from_name' => null,
88+
'from_email' => null,
8189
'subject' => 'Free dealz',
8290
'config' => 'default',
8391
'template' => 'default',
@@ -95,6 +103,8 @@ class EmailQueueFixture extends TestFixture
95103
array(
96104
'id' => 'email-4',
97105
'email' => '[email protected]',
106+
'from_name' => null,
107+
'from_email' => null,
98108
'subject' => 'Free dealz',
99109
'config' => 'default',
100110
'template' => 'default',
@@ -112,6 +122,8 @@ class EmailQueueFixture extends TestFixture
112122
array(
113123
'id' => 'email-5',
114124
'email' => '[email protected]',
125+
'from_name' => null,
126+
'from_email' => null,
115127
'subject' => 'Free dealz',
116128
'config' => 'default',
117129
'template' => 'default',
@@ -129,6 +141,8 @@ class EmailQueueFixture extends TestFixture
129141
array(
130142
'id' => 'email-6',
131143
'email' => '[email protected]',
144+
'from_name' => null,
145+
'from_email' => null,
132146
'subject' => 'Free dealz',
133147
'config' => 'default',
134148
'template' => 'default',

tests/TestCase/Model/Table/EmailQueueTest.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ public function testEnqueue()
5151
'template_vars' => array('a' => 'variable', 'some' => 'thing'),
5252
'sent' => false,
5353
'locked' => false,
54-
'send_tries' => '0',
54+
'send_tries' => 0,
5555
'config' => 'default',
5656
'headers' => array('X-FOO' => 'bar', 'X-BAZ' => 'thing'),
57+
'from_name' => null,
58+
'from_email' => null
5759
);
5860
$sendAt = new Time($result['send_at']);
5961
unset($result['id'], $result['created'], $result['modified'], $result['send_at']);

0 commit comments

Comments
 (0)