| @@ 302-323 (lines=22) @@ | ||
| 299 |         $this->assertInternalType('array', $data); | |
| 300 | } | |
| 301 | ||
| 302 | public function testGetActivePostsCount() | |
| 303 |     { | |
| 304 | $testData = [ | |
| 305 | [ | |
| 306 | 'id' => rand(1, 100), | |
| 307 | 'display' => 1, | |
| 308 | ], | |
| 309 | [ | |
| 310 | 'id' => rand(101, 200), | |
| 311 | 'display' => 1, | |
| 312 | ], | |
| 313 | ]; | |
| 314 | ||
| 315 | array_walk($testData, [$this, 'insertPostData']); | |
| 316 | ||
| 317 | $repository = new MysqlPostRepository(self::$connection); | |
| 318 | $data = $repository->getActivePostsCount(); | |
| 319 | ||
| 320 | $this->assertNotFalse($data); | |
| 321 |         $this->assertStringMatchesFormat('%d', $data); | |
| 322 | $this->assertEquals(count($testData), $data); | |
| 323 | } | |
| 324 | ||
| 325 | public function testGetActivePostsCountInactive() | |
| 326 |     { | |
| @@ 192-213 (lines=22) @@ | ||
| 189 |         $this->assertInternalType('array', $data); | |
| 190 | } | |
| 191 | ||
| 192 | public function testGetActivitiesCount() | |
| 193 |     { | |
| 194 | $testData = [ | |
| 195 | [ | |
| 196 | 'id' => rand(1, 100), | |
| 197 | 'message' => 'test one', | |
| 198 | ], | |
| 199 | [ | |
| 200 | 'id' => rand(101, 200), | |
| 201 | 'message' => 'test two', | |
| 202 | ], | |
| 203 | ]; | |
| 204 | ||
| 205 | array_walk($testData, [$this, 'insertData']); | |
| 206 | ||
| 207 | $repository = new MysqlActivityRepository(self::$connection); | |
| 208 | $data = $repository->getActivitiesCount(); | |
| 209 | ||
| 210 | $this->assertNotFalse($data); | |
| 211 |         $this->assertStringMatchesFormat('%d', $data); | |
| 212 | $this->assertEquals(count($testData), $data); | |
| 213 | } | |
| 214 | ||
| 215 | public function testGetActivitiesCountEmpty() | |
| 216 |     { | |