Code Duplication    Length = 33-35 lines in 3 locations

tests/unit/Domain/Blog/Series/MysqlSeriesRepositoryTest.php 1 location

@@ 14-48 (lines=35) @@
11
12
    protected static $connection;
13
14
    public static function setUpBeforeClass()
15
    {
16
        $extendedPdo = new ExtendedPdo('sqlite::memory:');
17
        $extendedPdo->exec("ATTACH DATABASE `jpemeric_blog.db` AS `jpemeric_blog`");
18
19
        $extendedPdo->exec("
20
            CREATE TABLE IF NOT EXISTS `jpemeric_blog`.`post` (
21
                `id` integer PRIMARY KEY AUTOINCREMENT,
22
                `title` varchar(60) NOT NULL,
23
                `path` varchar(60) NOT NULL,
24
                `category` varchar(15) NOT NULL,
25
                `date` datetime,
26
                `body` text,
27
                `display` integer(1) NOT NULL
28
            )"
29
        );
30
        $extendedPdo->exec("
31
            CREATE TABLE IF NOT EXISTS `jpemeric_blog`.`series` (
32
                `id` integer PRIMARY KEY AUTOINCREMENT,
33
                `title` text NOT NULL,
34
                `description` text NOT NULL
35
            )"
36
        );
37
        $extendedPdo->exec("
38
            CREATE TABLE IF NOT EXISTS `jpemeric_blog`.`series_post` (
39
                `series` integer NOT NULL,
40
                `post` integer NOT NULL,
41
                `order` integer(1) NOT NULL
42
            )"
43
        );
44
45
        self::$connection = new ConnectionLocator(function () use ($extendedPdo) {
46
            return $extendedPdo;
47
        });
48
    }
49
50
    public function testIsInstanceOfSeriesRepository()
51
    {

tests/unit/Domain/Blog/Tag/MysqlTagRepositoryTest.php 1 location

@@ 14-46 (lines=33) @@
11
12
    protected static $connection;
13
14
    public static function setUpBeforeClass()
15
    {
16
        $extendedPdo = new ExtendedPdo('sqlite::memory:');
17
        $extendedPdo->exec("ATTACH DATABASE `jpemeric_blog.db` AS `jpemeric_blog`");
18
19
        $extendedPdo->exec("
20
            CREATE TABLE IF NOT EXISTS `jpemeric_blog`.`post` (
21
                `id` integer PRIMARY KEY AUTOINCREMENT,
22
                `title` varchar(60) NOT NULL,
23
                `path` varchar(60) NOT NULL,
24
                `category` varchar(15) NOT NULL,
25
                `date` datetime,
26
                `body` text,
27
                `display` integer(1) NOT NULL
28
            )"
29
        );
30
        $extendedPdo->exec("
31
            CREATE TABLE IF NOT EXISTS `jpemeric_blog`.`ptlink` (
32
                `post_id` integer NOT NULL,
33
                `tag_id` integer NOT NULL
34
            )"
35
        );
36
        $extendedPdo->exec("
37
            CREATE TABLE IF NOT EXISTS `jpemeric_blog`.`tag` (
38
                `id` integer PRIMARY KEY AUTOINCREMENT,
39
                `tag` varchar(25) NOT NULL
40
            )"
41
        );
42
43
        self::$connection = new ConnectionLocator(function () use ($extendedPdo) {
44
            return $extendedPdo;
45
        });
46
    }
47
48
    public function testIsInstanceOfTagRepository()
49
    {

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

@@ 15-47 (lines=33) @@
12
13
    protected static $connection;
14
15
    public static function setUpBeforeClass()
16
    {
17
        $extendedPdo = new ExtendedPdo('sqlite::memory:');
18
        $extendedPdo->exec('ATTACH DATABASE `jpemeric_blog.db` AS `jpemeric_blog`');
19
20
        $extendedPdo->exec("
21
            CREATE TABLE IF NOT EXISTS `jpemeric_blog`.`post` (
22
                `id` integer PRIMARY KEY AUTOINCREMENT,
23
                `title` varchar(60) NOT NULL,
24
                `path` varchar(60) NOT NULL,
25
                `category` varchar(15) NOT NULL,
26
                `date` datetime,
27
                `body` text,
28
                `display` integer(1) NOT NULL
29
            )"
30
        );
31
        $extendedPdo->exec("
32
            CREATE TABLE IF NOT EXISTS `jpemeric_blog`.`ptlink` (
33
                `post_id` integer NOT NULL,
34
                `tag_id` integer NOT NULL
35
            )"
36
        );
37
        $extendedPdo->exec("
38
            CREATE TABLE IF NOT EXISTS `jpemeric_blog`.`tag` (
39
                `id` integer PRIMARY KEY AUTOINCREMENT,
40
                `tag` varchar(25) NOT NULL
41
            )"
42
        );
43
44
        self::$connection = new ConnectionLocator(function () use ($extendedPdo) {
45
            return $extendedPdo;
46
        });
47
    }
48
49
    public function testIsInstanceOfPostRepository()
50
    {