| @@ 263-285 (lines=23) @@ | ||
| 260 | }  | 
                                |
| 261 | }  | 
                                |
| 262 | ||
| 263 | public function testGetActivitiesByTypeFailure()  | 
                                |
| 264 |     { | 
                                |
| 265 | $testData = [  | 
                                |
| 266 | [  | 
                                |
| 267 | 'id' => rand(1, 100),  | 
                                |
| 268 | 'message' => 'test one',  | 
                                |
| 269 | 'type' => 'type one',  | 
                                |
| 270 | ],  | 
                                |
| 271 | [  | 
                                |
| 272 | 'id' => rand(101, 200),  | 
                                |
| 273 | 'message' => 'test two',  | 
                                |
| 274 | 'type' => 'type one',  | 
                                |
| 275 | ],  | 
                                |
| 276 | ];  | 
                                |
| 277 | ||
| 278 | array_walk($testData, [$this, 'insertData']);  | 
                                |
| 279 | ||
| 280 | $repository = new MysqlActivityRepository(self::$connection);  | 
                                |
| 281 |         $data = $repository->getActivitiesByType('type two'); | 
                                |
| 282 | ||
| 283 | $this->assertEmpty($data);  | 
                                |
| 284 |         $this->assertInternalType('array', $data); | 
                                |
| 285 | }  | 
                                |
| 286 | ||
| 287 | public function testGetActivitiesByTypeRange()  | 
                                |
| 288 |     { | 
                                |
| @@ 396-419 (lines=24) @@ | ||
| 393 | $this->assertEquals(count($testData), $data);  | 
                                |
| 394 | }  | 
                                |
| 395 | ||
| 396 | public function testGetActivitiesByTypeCountEmpty()  | 
                                |
| 397 |     { | 
                                |
| 398 | $testData = [  | 
                                |
| 399 | [  | 
                                |
| 400 | 'id' => rand(1, 100),  | 
                                |
| 401 | 'message' => 'test one',  | 
                                |
| 402 | 'type' => 'type one',  | 
                                |
| 403 | ],  | 
                                |
| 404 | [  | 
                                |
| 405 | 'id' => rand(101, 200),  | 
                                |
| 406 | 'message' => 'test two',  | 
                                |
| 407 | 'type' => 'type one',  | 
                                |
| 408 | ],  | 
                                |
| 409 | ];  | 
                                |
| 410 | ||
| 411 | array_walk($testData, [$this, 'insertData']);  | 
                                |
| 412 | ||
| 413 | $repository = new MysqlActivityRepository(self::$connection);  | 
                                |
| 414 |         $data = $repository->getActivitiesByTypeCount('type two'); | 
                                |
| 415 | ||
| 416 | $this->assertNotFalse($data);  | 
                                |
| 417 |         $this->assertStringMatchesFormat('%d', $data); | 
                                |
| 418 |         $this->assertEquals('0', $data); | 
                                |
| 419 | }  | 
                                |
| 420 | ||
| 421 | protected function tearDown()  | 
                                |
| 422 |     { | 
                                |