Completed
Push — master ( 8c8014...211020 )
by Jacob
03:25
created
tests/unit/Domain/Blog/Series/MysqlSeriesRepositoryTest.php 1 patch
Indentation   +352 added lines, -352 removed lines patch added patch discarded remove patch
@@ -9,14 +9,14 @@  discard block
 block discarded – undo
9 9
 class MysqlSeriesRepositoryTest extends PHPUnit_Framework_TestCase
10 10
 {
11 11
 
12
-    protected static $connection;
12
+	protected static $connection;
13 13
 
14
-    public static function setUpBeforeClass()
15
-    {
16
-        $extendedPdo = new ExtendedPdo('sqlite::memory:');
17
-        $extendedPdo->exec("ATTACH DATABASE `jpemeric_blog.db` AS `jpemeric_blog`");
14
+	public static function setUpBeforeClass()
15
+	{
16
+		$extendedPdo = new ExtendedPdo('sqlite::memory:');
17
+		$extendedPdo->exec("ATTACH DATABASE `jpemeric_blog.db` AS `jpemeric_blog`");
18 18
 
19
-        $extendedPdo->exec("
19
+		$extendedPdo->exec("
20 20
             CREATE TABLE IF NOT EXISTS `jpemeric_blog`.`post` (
21 21
                 `id` integer PRIMARY KEY AUTOINCREMENT,
22 22
                 `title` varchar(60) NOT NULL,
@@ -26,380 +26,380 @@  discard block
 block discarded – undo
26 26
                 `body` text,
27 27
                 `display` integer(1) NOT NULL
28 28
             )"
29
-        );
30
-        $extendedPdo->exec("
29
+		);
30
+		$extendedPdo->exec("
31 31
             CREATE TABLE IF NOT EXISTS `jpemeric_blog`.`series` (
32 32
                 `id` integer PRIMARY KEY AUTOINCREMENT,
33 33
                 `title` text NOT NULL,
34 34
                 `description` text NOT NULL
35 35
             )"
36
-        );
37
-        $extendedPdo->exec("
36
+		);
37
+		$extendedPdo->exec("
38 38
             CREATE TABLE IF NOT EXISTS `jpemeric_blog`.`series_post` (
39 39
                 `series` integer NOT NULL,
40 40
                 `post` integer NOT NULL,
41 41
                 `order` integer(1) NOT NULL
42 42
             )"
43
-        );
44
-
45
-        self::$connection = new ConnectionLocator(function () use ($extendedPdo) {
46
-            return $extendedPdo;
47
-        });
48
-    }
49
-
50
-    public function testIsInstanceOfSeriesRepository()
51
-    {
52
-        $repository = new MysqlSeriesRepository(self::$connection);
53
-
54
-        $this->assertInstanceOf(
55
-            'Jacobemerick\Web\Domain\Blog\Series\MysqlSeriesRepository',
56
-            $repository
57
-        );
58
-    }
59
-
60
-    public function testImplementsSeriesInterface()
61
-    {
62
-        $repository = new MysqlSeriesRepository(self::$connection);
63
-
64
-        $this->assertInstanceOf(
65
-            'Jacobemerick\Web\Domain\Blog\Series\SeriesRepositoryInterface',
66
-            $repository
67
-        );
68
-    }
69
-
70
-    public function testConstructSetsConnections()
71
-    {
72
-        $respository = new MysqlSeriesRepository(self::$connection);
73
-
74
-        $this->assertAttributeSame(
75
-            self::$connection,
76
-            'connections',
77
-            $respository
78
-        );
79
-    }
80
-
81
-    public function testGetSeriesForPost()
82
-    {
83
-        $testPostData = [
84
-            [
85
-                'id' => rand(1, 100),
86
-                'title' => 'test one',
87
-                'category' => 'test category',
88
-                'path' => 'test-one',
89
-                'display' => 1,
90
-            ],
91
-            [
92
-                'id' => rand(101, 200),
93
-                'title' => 'test two',
94
-                'category' => 'test category',
95
-                'path' => 'test-two',
96
-                'display' => 1,
97
-            ],
98
-        ];
99
-
100
-        $testSeriesData = [
101
-            [
102
-                'id' => rand(1, 100),
103
-                'title' => 'test one',
104
-                'description' => 'test description',
105
-            ],
106
-        ];
107
-
108
-        $testSeriesPostData = [];
109
-        foreach ($testPostData as $testPostDataRow) {
110
-            array_push($testSeriesPostData, [
111
-                'series' => reset($testSeriesData)['id'],
112
-                'post' => $testPostDataRow['id'],
113
-            ]);
114
-        }
115
-
116
-        array_walk($testPostData, [$this, 'insertPostData']);
117
-        array_walk($testSeriesData, [$this, 'insertSeriesData']);
118
-        array_walk($testSeriesPostData, [$this, 'insertSeriesPostData']);
119
-
120
-        $repository = new MysqlSeriesRepository(self::$connection);
121
-        $data = $repository->getSeriesForPost(reset($testPostData)['id']);
122
-
123
-        $this->assertNotFalse($data);
124
-        $this->assertInternalType('array', $data);
125
-        foreach ($testPostData as $key => $testPostRow) {
126
-            $this->assertInternalType('array', $data[$key]);
127
-            $this->assertArrayHasKey('series_title', $data[$key]);
128
-            $this->assertEquals(reset($testSeriesData)['title'], $data[$key]['series_title']);
129
-            $this->assertArrayHasKey('series_description', $data[$key]);
130
-            $this->assertEquals(reset($testSeriesData)['description'], $data[$key]['series_description']);
131
-            $this->assertArrayHasKey('post', $data[$key]);
132
-            $this->assertEquals($testPostRow['id'], $data[$key]['post']);
133
-            $this->assertArrayHasKey('title', $data[$key]);
134
-            $this->assertEquals($testPostRow['title'], $data[$key]['title']);
135
-            $this->assertArrayHasKey('category', $data[$key]);
136
-            $this->assertEquals($testPostRow['category'], $data[$key]['category']);
137
-            $this->assertArrayHasKey('path', $data[$key]);
138
-            $this->assertEquals($testPostRow['path'], $data[$key]['path']);
139
-        }
140
-    }
141
-
142
-    public function testGetSeriesForPostOrder()
143
-    {
144
-        $testPostData = [
145
-            [
146
-                'id' => rand(1, 100),
147
-                'display' => 1,
148
-            ],
149
-            [
150
-                'id' => rand(101, 200),
151
-                'display' => 1,
152
-            ],
153
-            [
154
-                'id' => rand(201, 300),
155
-                'display' => 1,
156
-            ],
157
-        ];
158
-
159
-        $testSeriesData = [
160
-            [
161
-                'id' => rand(1, 100),
162
-            ],
163
-        ];
164
-
165
-        $order = [1, 2, 3];
166
-        shuffle($order);
167
-        $testSeriesPostData = [];
168
-        foreach ($testPostData as $key => $testPostDataRow) {
169
-            array_push($testSeriesPostData, [
170
-                'series' => reset($testSeriesData)['id'],
171
-                'post' => $testPostDataRow['id'],
172
-                'order' => $order[$key],
173
-            ]);
174
-        }
175
-
176
-        array_walk($testPostData, [$this, 'insertPostData']);
177
-        array_walk($testSeriesData, [$this, 'insertSeriesData']);
178
-        array_walk($testSeriesPostData, [$this, 'insertSeriesPostData']);
179
-
180
-        $repository = new MysqlSeriesRepository(self::$connection);
181
-        $data = $repository->getSeriesForPost(reset($testPostData)['id']);
182
-
183
-        usort($testPostData, function ($rowA, $rowB) use ($testSeriesPostData) {
184
-            $seriesA = array_filter($testSeriesPostData, function ($row) use ($rowA) {
185
-                return ($rowA['id'] == $row['post']);
186
-            });
187
-            $seriesB = array_filter($testSeriesPostData, function ($row) use ($rowB) {
188
-                return ($rowB['id'] == $row['post']);
189
-            });
190
-
191
-            return (reset($seriesA)['order'] > reset($seriesB)['order']);
192
-        });
193
-
194
-        $this->assertNotFalse($data);
195
-        $this->assertInternalType('array', $data);
196
-        foreach ($testPostData as $key => $testPostRow) {
197
-            $this->assertInternalType('array', $data[$key]);
198
-            $this->assertArrayHasKey('post', $data[$key]);
199
-            $this->assertEquals($testPostRow['id'], $data[$key]['post']);
200
-        }
201
-    }
43
+		);
44
+
45
+		self::$connection = new ConnectionLocator(function () use ($extendedPdo) {
46
+			return $extendedPdo;
47
+		});
48
+	}
49
+
50
+	public function testIsInstanceOfSeriesRepository()
51
+	{
52
+		$repository = new MysqlSeriesRepository(self::$connection);
53
+
54
+		$this->assertInstanceOf(
55
+			'Jacobemerick\Web\Domain\Blog\Series\MysqlSeriesRepository',
56
+			$repository
57
+		);
58
+	}
59
+
60
+	public function testImplementsSeriesInterface()
61
+	{
62
+		$repository = new MysqlSeriesRepository(self::$connection);
63
+
64
+		$this->assertInstanceOf(
65
+			'Jacobemerick\Web\Domain\Blog\Series\SeriesRepositoryInterface',
66
+			$repository
67
+		);
68
+	}
69
+
70
+	public function testConstructSetsConnections()
71
+	{
72
+		$respository = new MysqlSeriesRepository(self::$connection);
73
+
74
+		$this->assertAttributeSame(
75
+			self::$connection,
76
+			'connections',
77
+			$respository
78
+		);
79
+	}
80
+
81
+	public function testGetSeriesForPost()
82
+	{
83
+		$testPostData = [
84
+			[
85
+				'id' => rand(1, 100),
86
+				'title' => 'test one',
87
+				'category' => 'test category',
88
+				'path' => 'test-one',
89
+				'display' => 1,
90
+			],
91
+			[
92
+				'id' => rand(101, 200),
93
+				'title' => 'test two',
94
+				'category' => 'test category',
95
+				'path' => 'test-two',
96
+				'display' => 1,
97
+			],
98
+		];
99
+
100
+		$testSeriesData = [
101
+			[
102
+				'id' => rand(1, 100),
103
+				'title' => 'test one',
104
+				'description' => 'test description',
105
+			],
106
+		];
107
+
108
+		$testSeriesPostData = [];
109
+		foreach ($testPostData as $testPostDataRow) {
110
+			array_push($testSeriesPostData, [
111
+				'series' => reset($testSeriesData)['id'],
112
+				'post' => $testPostDataRow['id'],
113
+			]);
114
+		}
115
+
116
+		array_walk($testPostData, [$this, 'insertPostData']);
117
+		array_walk($testSeriesData, [$this, 'insertSeriesData']);
118
+		array_walk($testSeriesPostData, [$this, 'insertSeriesPostData']);
119
+
120
+		$repository = new MysqlSeriesRepository(self::$connection);
121
+		$data = $repository->getSeriesForPost(reset($testPostData)['id']);
122
+
123
+		$this->assertNotFalse($data);
124
+		$this->assertInternalType('array', $data);
125
+		foreach ($testPostData as $key => $testPostRow) {
126
+			$this->assertInternalType('array', $data[$key]);
127
+			$this->assertArrayHasKey('series_title', $data[$key]);
128
+			$this->assertEquals(reset($testSeriesData)['title'], $data[$key]['series_title']);
129
+			$this->assertArrayHasKey('series_description', $data[$key]);
130
+			$this->assertEquals(reset($testSeriesData)['description'], $data[$key]['series_description']);
131
+			$this->assertArrayHasKey('post', $data[$key]);
132
+			$this->assertEquals($testPostRow['id'], $data[$key]['post']);
133
+			$this->assertArrayHasKey('title', $data[$key]);
134
+			$this->assertEquals($testPostRow['title'], $data[$key]['title']);
135
+			$this->assertArrayHasKey('category', $data[$key]);
136
+			$this->assertEquals($testPostRow['category'], $data[$key]['category']);
137
+			$this->assertArrayHasKey('path', $data[$key]);
138
+			$this->assertEquals($testPostRow['path'], $data[$key]['path']);
139
+		}
140
+	}
141
+
142
+	public function testGetSeriesForPostOrder()
143
+	{
144
+		$testPostData = [
145
+			[
146
+				'id' => rand(1, 100),
147
+				'display' => 1,
148
+			],
149
+			[
150
+				'id' => rand(101, 200),
151
+				'display' => 1,
152
+			],
153
+			[
154
+				'id' => rand(201, 300),
155
+				'display' => 1,
156
+			],
157
+		];
158
+
159
+		$testSeriesData = [
160
+			[
161
+				'id' => rand(1, 100),
162
+			],
163
+		];
164
+
165
+		$order = [1, 2, 3];
166
+		shuffle($order);
167
+		$testSeriesPostData = [];
168
+		foreach ($testPostData as $key => $testPostDataRow) {
169
+			array_push($testSeriesPostData, [
170
+				'series' => reset($testSeriesData)['id'],
171
+				'post' => $testPostDataRow['id'],
172
+				'order' => $order[$key],
173
+			]);
174
+		}
175
+
176
+		array_walk($testPostData, [$this, 'insertPostData']);
177
+		array_walk($testSeriesData, [$this, 'insertSeriesData']);
178
+		array_walk($testSeriesPostData, [$this, 'insertSeriesPostData']);
179
+
180
+		$repository = new MysqlSeriesRepository(self::$connection);
181
+		$data = $repository->getSeriesForPost(reset($testPostData)['id']);
182
+
183
+		usort($testPostData, function ($rowA, $rowB) use ($testSeriesPostData) {
184
+			$seriesA = array_filter($testSeriesPostData, function ($row) use ($rowA) {
185
+				return ($rowA['id'] == $row['post']);
186
+			});
187
+			$seriesB = array_filter($testSeriesPostData, function ($row) use ($rowB) {
188
+				return ($rowB['id'] == $row['post']);
189
+			});
190
+
191
+			return (reset($seriesA)['order'] > reset($seriesB)['order']);
192
+		});
193
+
194
+		$this->assertNotFalse($data);
195
+		$this->assertInternalType('array', $data);
196
+		foreach ($testPostData as $key => $testPostRow) {
197
+			$this->assertInternalType('array', $data[$key]);
198
+			$this->assertArrayHasKey('post', $data[$key]);
199
+			$this->assertEquals($testPostRow['id'], $data[$key]['post']);
200
+		}
201
+	}
202 202
  
203
-    public function testGetSeriesForPostSeriesFilter()
204
-    {
205
-        $testPostAData = [
206
-            [
207
-                'id' => rand(1, 100),
208
-                'display' => 1,
209
-            ],
210
-            [
211
-                'id' => rand(101, 200),
212
-                'display' => 1,
213
-            ],
214
-        ];
215
-
216
-        $testPostBData = [
217
-            [
218
-                'id' => rand(501, 600),
219
-                'display' => 1,
220
-            ],
221
-            [
222
-                'id' => rand(601, 700),
223
-                'display' => 1,
224
-            ],
225
-        ];
226
-
227
-        $testSeriesData = [
228
-            [
229
-                'id' => rand(1, 100),
230
-            ],
231
-            [
232
-                'id' => rand(101, 200),
233
-            ],
234
-        ];
235
-
236
-        $testSeriesPostData = [];
237
-        foreach ($testPostAData as $testPostDataRow) {
238
-            array_push($testSeriesPostData, [
239
-                'series' => $testSeriesData[0]['id'],
240
-                'post' => $testPostDataRow['id'],
241
-            ]);
242
-        }
243
-        foreach ($testPostBData as $testPostDataRow) {
244
-            array_push($testSeriesPostData, [
245
-                'series' => $testSeriesData[1]['id'],
246
-                'post' => $testPostDataRow['id'],
247
-            ]);
248
-        }
249
-
250
-        $testPostData = array_merge($testPostAData, $testPostBData);
251
-        array_walk($testPostData, [$this, 'insertPostData']);
252
-        array_walk($testSeriesData, [$this, 'insertSeriesData']);
253
-        array_walk($testSeriesPostData, [$this, 'insertSeriesPostData']);
254
-
255
-        $repository = new MysqlSeriesRepository(self::$connection);
256
-        $data = $repository->getSeriesForPost(reset($testPostAData)['id']);
257
-
258
-        $this->assertNotFalse($data);
259
-        $this->assertInternalType('array', $data);
260
-
261
-        $testPosts = array_column($testPostAData, 'id');
262
-        $dataPosts = array_column($data, 'post');
263
-
264
-        $this->assertEmpty(array_merge(
265
-            array_diff($testPosts, $dataPosts),
266
-            array_diff($dataPosts, $testPosts)
267
-        ));
268
-    }
203
+	public function testGetSeriesForPostSeriesFilter()
204
+	{
205
+		$testPostAData = [
206
+			[
207
+				'id' => rand(1, 100),
208
+				'display' => 1,
209
+			],
210
+			[
211
+				'id' => rand(101, 200),
212
+				'display' => 1,
213
+			],
214
+		];
215
+
216
+		$testPostBData = [
217
+			[
218
+				'id' => rand(501, 600),
219
+				'display' => 1,
220
+			],
221
+			[
222
+				'id' => rand(601, 700),
223
+				'display' => 1,
224
+			],
225
+		];
226
+
227
+		$testSeriesData = [
228
+			[
229
+				'id' => rand(1, 100),
230
+			],
231
+			[
232
+				'id' => rand(101, 200),
233
+			],
234
+		];
235
+
236
+		$testSeriesPostData = [];
237
+		foreach ($testPostAData as $testPostDataRow) {
238
+			array_push($testSeriesPostData, [
239
+				'series' => $testSeriesData[0]['id'],
240
+				'post' => $testPostDataRow['id'],
241
+			]);
242
+		}
243
+		foreach ($testPostBData as $testPostDataRow) {
244
+			array_push($testSeriesPostData, [
245
+				'series' => $testSeriesData[1]['id'],
246
+				'post' => $testPostDataRow['id'],
247
+			]);
248
+		}
249
+
250
+		$testPostData = array_merge($testPostAData, $testPostBData);
251
+		array_walk($testPostData, [$this, 'insertPostData']);
252
+		array_walk($testSeriesData, [$this, 'insertSeriesData']);
253
+		array_walk($testSeriesPostData, [$this, 'insertSeriesPostData']);
254
+
255
+		$repository = new MysqlSeriesRepository(self::$connection);
256
+		$data = $repository->getSeriesForPost(reset($testPostAData)['id']);
257
+
258
+		$this->assertNotFalse($data);
259
+		$this->assertInternalType('array', $data);
260
+
261
+		$testPosts = array_column($testPostAData, 'id');
262
+		$dataPosts = array_column($data, 'post');
263
+
264
+		$this->assertEmpty(array_merge(
265
+			array_diff($testPosts, $dataPosts),
266
+			array_diff($dataPosts, $testPosts)
267
+		));
268
+	}
269 269
  
270
-    public function testGetSeriesForPostInactive()
271
-    {
272
-        $testPostData = [
273
-            [
274
-                'id' => rand(1, 100),
275
-                'display' => 1,
276
-            ],
277
-            [
278
-                'id' => rand(101, 200),
279
-                'display' => 0,
280
-            ],
281
-            [
282
-                'id' => rand(201, 300),
283
-                'display' => 0,
284
-            ],
285
-        ];
286
-
287
-        $testSeriesData = [
288
-            [
289
-                'id' => rand(1, 100),
290
-            ],
291
-        ];
292
-
293
-        $testSeriesPostData = [];
294
-        foreach ($testPostData as $testPostDataRow) {
295
-            array_push($testSeriesPostData, [
296
-                'series' => reset($testSeriesData)['id'],
297
-                'post' => $testPostDataRow['id'],
298
-            ]);
299
-        }
300
-
301
-        array_walk($testPostData, [$this, 'insertPostData']);
302
-        array_walk($testSeriesData, [$this, 'insertSeriesData']);
303
-        array_walk($testSeriesPostData, [$this, 'insertSeriesPostData']);
304
-
305
-        $repository = new MysqlSeriesRepository(self::$connection);
306
-        $data = $repository->getSeriesForPost(reset($testPostData)['id']);
307
-
308
-        $this->assertNotFalse($data);
309
-        $this->assertInternalType('array', $data);
310
-
311
-        $testPostData = array_filter($testPostData, function ($row) {
312
-            return ($row['display'] == 1);
313
-        });
314
-        $testPosts = array_column($testPostData, 'id');
315
-        $dataPosts = array_column($data, 'post');
316
-
317
-        $this->assertEmpty(array_merge(
318
-            array_diff($testPosts, $dataPosts),
319
-            array_diff($dataPosts, $testPosts)
320
-        ));
321
-    }
322
-
323
-    public function testGetSeriesForPostFailure()
324
-    {
325
-        $repository = new MysqlSeriesRepository(self::$connection);
326
-        $data = $repository->getSeriesForPost(rand(1, 100));
327
-
328
-        $this->assertEmpty($data);
329
-        $this->assertInternalType('array', $data);
330
-    }
331
-
332
-    protected function tearDown()
333
-    {
334
-        self::$connection->getDefault()->perform("DELETE FROM `jpemeric_blog`.`post`");
335
-        self::$connection->getDefault()->perform("DELETE FROM `jpemeric_blog`.`series`");
336
-        self::$connection->getDefault()->perform("DELETE FROM `jpemeric_blog`.`series_post`");
337
-    }
338
-
339
-    public static function tearDownAfterClass()
340
-    {
341
-        self::$connection->getDefault()->disconnect();
342
-        unlink('jpemeric_blog.db');
343
-    }
344
-
345
-    protected function insertPostData(array $data)
346
-    {
347
-        $defaultData = [
348
-            'id' => null,
349
-            'title' => '',
350
-            'path' => '',
351
-            'category' => '',
352
-            'date' => '',
353
-            'body' => '',
354
-            'display' => 0,
355
-        ];
356
-
357
-        $data = array_merge($defaultData, $data);
358
-
359
-        return self::$connection->getDefault()->perform("
270
+	public function testGetSeriesForPostInactive()
271
+	{
272
+		$testPostData = [
273
+			[
274
+				'id' => rand(1, 100),
275
+				'display' => 1,
276
+			],
277
+			[
278
+				'id' => rand(101, 200),
279
+				'display' => 0,
280
+			],
281
+			[
282
+				'id' => rand(201, 300),
283
+				'display' => 0,
284
+			],
285
+		];
286
+
287
+		$testSeriesData = [
288
+			[
289
+				'id' => rand(1, 100),
290
+			],
291
+		];
292
+
293
+		$testSeriesPostData = [];
294
+		foreach ($testPostData as $testPostDataRow) {
295
+			array_push($testSeriesPostData, [
296
+				'series' => reset($testSeriesData)['id'],
297
+				'post' => $testPostDataRow['id'],
298
+			]);
299
+		}
300
+
301
+		array_walk($testPostData, [$this, 'insertPostData']);
302
+		array_walk($testSeriesData, [$this, 'insertSeriesData']);
303
+		array_walk($testSeriesPostData, [$this, 'insertSeriesPostData']);
304
+
305
+		$repository = new MysqlSeriesRepository(self::$connection);
306
+		$data = $repository->getSeriesForPost(reset($testPostData)['id']);
307
+
308
+		$this->assertNotFalse($data);
309
+		$this->assertInternalType('array', $data);
310
+
311
+		$testPostData = array_filter($testPostData, function ($row) {
312
+			return ($row['display'] == 1);
313
+		});
314
+		$testPosts = array_column($testPostData, 'id');
315
+		$dataPosts = array_column($data, 'post');
316
+
317
+		$this->assertEmpty(array_merge(
318
+			array_diff($testPosts, $dataPosts),
319
+			array_diff($dataPosts, $testPosts)
320
+		));
321
+	}
322
+
323
+	public function testGetSeriesForPostFailure()
324
+	{
325
+		$repository = new MysqlSeriesRepository(self::$connection);
326
+		$data = $repository->getSeriesForPost(rand(1, 100));
327
+
328
+		$this->assertEmpty($data);
329
+		$this->assertInternalType('array', $data);
330
+	}
331
+
332
+	protected function tearDown()
333
+	{
334
+		self::$connection->getDefault()->perform("DELETE FROM `jpemeric_blog`.`post`");
335
+		self::$connection->getDefault()->perform("DELETE FROM `jpemeric_blog`.`series`");
336
+		self::$connection->getDefault()->perform("DELETE FROM `jpemeric_blog`.`series_post`");
337
+	}
338
+
339
+	public static function tearDownAfterClass()
340
+	{
341
+		self::$connection->getDefault()->disconnect();
342
+		unlink('jpemeric_blog.db');
343
+	}
344
+
345
+	protected function insertPostData(array $data)
346
+	{
347
+		$defaultData = [
348
+			'id' => null,
349
+			'title' => '',
350
+			'path' => '',
351
+			'category' => '',
352
+			'date' => '',
353
+			'body' => '',
354
+			'display' => 0,
355
+		];
356
+
357
+		$data = array_merge($defaultData, $data);
358
+
359
+		return self::$connection->getDefault()->perform("
360 360
             INSERT INTO `jpemeric_blog`.`post`
361 361
                 (id, title, path, category, date, body, display)
362 362
             VALUES
363 363
                 (:id, :title, :path, :category, :date, :body, :display)",
364
-            $data
365
-        );
366
-    }
364
+			$data
365
+		);
366
+	}
367 367
 
368
-    protected function insertSeriesData(array $data)
369
-    {
370
-        $defaultData = [
371
-            'id' => null,
372
-            'title' => '',
373
-            'description' => '',
374
-        ];
368
+	protected function insertSeriesData(array $data)
369
+	{
370
+		$defaultData = [
371
+			'id' => null,
372
+			'title' => '',
373
+			'description' => '',
374
+		];
375 375
 
376
-        $data = array_merge($defaultData, $data);
376
+		$data = array_merge($defaultData, $data);
377 377
 
378
-        return self::$connection->getDefault()->perform("
378
+		return self::$connection->getDefault()->perform("
379 379
             INSERT INTO `jpemeric_blog`.`series`
380 380
                 (id, title, description)
381 381
             VALUES
382 382
                 (:id, :title, :description)",
383
-            $data
384
-        );
385
-    }
383
+			$data
384
+		);
385
+	}
386 386
 
387
-    protected function insertSeriesPostData(array $data)
388
-    {
389
-        $defaultData = [
390
-            'series' => '',
391
-            'post' => '',
392
-            'order' => 0,
393
-        ];
387
+	protected function insertSeriesPostData(array $data)
388
+	{
389
+		$defaultData = [
390
+			'series' => '',
391
+			'post' => '',
392
+			'order' => 0,
393
+		];
394 394
 
395
-        $data = array_merge($defaultData, $data);
395
+		$data = array_merge($defaultData, $data);
396 396
 
397
-        return self::$connection->getDefault()->perform("
397
+		return self::$connection->getDefault()->perform("
398 398
             INSERT INTO `jpemeric_blog`.`series_post`
399 399
                 (series, post, `order`)
400 400
             VALUES
401 401
                 (:series, :post, :order)",
402
-            $data
403
-        );
404
-    }
402
+			$data
403
+		);
404
+	}
405 405
 }
Please login to merge, or discard this patch.