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

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