Code Duplication    Length = 23-25 lines in 3 locations

tests/unit/Domain/Stream/Activity/MysqlActivityRepositoryTest.php 2 locations

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

tests/unit/Domain/Blog/Post/MysqlPostRepositoryTest.php 1 location

@@ 276-300 (lines=25) @@
273
        ));
274
    }
275
276
    public function testGetActivePostsRangeFailure()
277
    {
278
        $testData = [
279
            [
280
                'id'      => rand(1, 100),
281
                'display' => 1,
282
            ],
283
            [
284
                'id'      => rand(101, 200),
285
                'display' => 1,
286
            ],
287
            [
288
                'id'      => rand(201, 300),
289
                'display' => 1,
290
            ],
291
        ];
292
293
        array_walk($testData, [$this, 'insertPostData']);
294
295
        $repository = new MysqlPostRepository(self::$connection);
296
        $data = $repository->getActivePosts(1, 3);
297
298
        $this->assertEmpty($data);
299
        $this->assertInternalType('array', $data);
300
    }
301
302
    public function testGetActivePostsCount()
303
    {