| @@ 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 | { |
|
| @@ 309-330 (lines=22) @@ | ||
| 306 | $this->assertInternalType('array', $data); |
|
| 307 | } |
|
| 308 | ||
| 309 | public function testGetActivePostsCount() |
|
| 310 | { |
|
| 311 | $testData = [ |
|
| 312 | [ |
|
| 313 | 'id' => rand(1, 100), |
|
| 314 | 'display' => 1, |
|
| 315 | ], |
|
| 316 | [ |
|
| 317 | 'id' => rand(101, 200), |
|
| 318 | 'display' => 1, |
|
| 319 | ], |
|
| 320 | ]; |
|
| 321 | ||
| 322 | array_walk($testData, [$this, 'insertPostData']); |
|
| 323 | ||
| 324 | $repository = new MysqlPostRepository(self::$connection); |
|
| 325 | $data = $repository->getActivePostsCount(); |
|
| 326 | ||
| 327 | $this->assertNotFalse($data); |
|
| 328 | $this->assertStringMatchesFormat('%d', $data); |
|
| 329 | $this->assertEquals(count($testData), $data); |
|
| 330 | } |
|
| 331 | ||
| 332 | public function testGetActivePostsCountInactive() |
|
| 333 | { |
|