| @@ 837-864 (lines=28) @@ | ||
| 834 | )); |
|
| 835 | } |
|
| 836 | ||
| 837 | public function testGetActivePostsByCategoryRangeFailure() |
|
| 838 | { |
|
| 839 | $testData = [ |
|
| 840 | [ |
|
| 841 | 'id' => rand(1, 100), |
|
| 842 | 'category' => 'test category', |
|
| 843 | 'display' => 1, |
|
| 844 | ], |
|
| 845 | [ |
|
| 846 | 'id' => rand(101, 200), |
|
| 847 | 'category' => 'test category', |
|
| 848 | 'display' => 1, |
|
| 849 | ], |
|
| 850 | [ |
|
| 851 | 'id' => rand(201, 300), |
|
| 852 | 'category' => 'test category', |
|
| 853 | 'display' => 1, |
|
| 854 | ], |
|
| 855 | ]; |
|
| 856 | ||
| 857 | array_walk($testData, [$this, 'insertPostData']); |
|
| 858 | ||
| 859 | $repository = new MysqlPostRepository(self::$connection); |
|
| 860 | $data = $repository->getActivePostsByCategory(reset($testData)['category'], 1, 3); |
|
| 861 | ||
| 862 | $this->assertEmpty($data); |
|
| 863 | $this->assertInternalType('array', $data); |
|
| 864 | } |
|
| 865 | ||
| 866 | public function testGetActivePostsCountByCategory() |
|
| 867 | { |
|
| @@ 334-361 (lines=28) @@ | ||
| 331 | } |
|
| 332 | } |
|
| 333 | ||
| 334 | public function testGetActivitiesByTypeRangeFailure() |
|
| 335 | { |
|
| 336 | $testData = [ |
|
| 337 | [ |
|
| 338 | 'id' => rand(1, 100), |
|
| 339 | 'message' => 'test one', |
|
| 340 | 'type' => 'type one', |
|
| 341 | ], |
|
| 342 | [ |
|
| 343 | 'id' => rand(101, 200), |
|
| 344 | 'message' => 'test two', |
|
| 345 | 'type' => 'type one', |
|
| 346 | ], |
|
| 347 | [ |
|
| 348 | 'id' => rand(201, 300), |
|
| 349 | 'message' => 'test three', |
|
| 350 | 'type' => 'type one', |
|
| 351 | ], |
|
| 352 | ]; |
|
| 353 | ||
| 354 | array_walk($testData, [$this, 'insertData']); |
|
| 355 | ||
| 356 | $repository = new MysqlActivityRepository(self::$connection); |
|
| 357 | $data = $repository->getActivitiesByType('type two', 2, 1); |
|
| 358 | ||
| 359 | $this->assertEmpty($data); |
|
| 360 | $this->assertInternalType('array', $data); |
|
| 361 | } |
|
| 362 | ||
| 363 | public function testGetActivitiesByTypeCount() |
|
| 364 | { |
|