Code Duplication    Length = 21-21 lines in 5 locations

tests/FwlibTest/Db/DbDiffTest.php 5 locations

@@ 87-107 (lines=21) @@
84
     * @expectedException \Exception
85
     * @expectedExceptionMessage can't commit again
86
     */
87
    public function testCommitAgain()
88
    {
89
        $dbDiff = $this->buildMock();
90
91
        $json = '{
92
            "rowCount": 0,
93
            "executeStatus": 100,
94
            "diff": {
95
                "' . self::$tableUser .  '": [
96
                    {
97
                        "mode": "Whatever",
98
                        "pk": [],
99
                        "column": []
100
                    }
101
                ]
102
            }
103
        }';
104
105
        $dbDiff->import($json);
106
        $dbDiff->commit();
107
    }
108
109
110
    /**
@@ 155-175 (lines=21) @@
152
     * @expectedException \Exception
153
     * @expectedExceptionMessage Invalid mode
154
     */
155
    public function testCommitWithInvalidMode()
156
    {
157
        $dbDiff = $this->buildMock();
158
159
        $json = '{
160
            "rowCount": 0,
161
            "executeStatus": 0,
162
            "diff": {
163
                "' . self::$tableUser .  '": [
164
                    {
165
                        "mode": "InvalidMode",
166
                        "pk": [],
167
                        "column": []
168
                    }
169
                ]
170
            }
171
        }';
172
173
        $dbDiff->import($json);
174
        $dbDiff->commit();
175
    }
176
177
178
    /**
@@ 353-373 (lines=21) @@
350
     * @expectedException \Exception
351
     * @expectedExceptionMessage can't execute again
352
     */
353
    public function testExecuteAgain()
354
    {
355
        $dbDiff = $this->buildMock();
356
357
        $json = '{
358
            "rowCount": 0,
359
            "executeStatus": 100,
360
            "diff": {
361
                "' . self::$tableUser .  '": [
362
                    {
363
                        "mode": "Whatever",
364
                        "pk": [],
365
                        "column": []
366
                    }
367
                ]
368
            }
369
        }';
370
371
        $dbDiff->import($json);
372
        $dbDiff->execute();
373
    }
374
375
376
    public function testExecuteInsertThenRollback()
@@ 475-495 (lines=21) @@
472
     * @expectedException \Exception
473
     * @expectedExceptionMessage can't rollback again
474
     */
475
    public function testRollbackAgain()
476
    {
477
        $dbDiff = $this->buildMock();
478
479
        $json = '{
480
            "rowCount": 0,
481
            "executeStatus": -100,
482
            "diff": {
483
                "' . self::$tableUser .  '": [
484
                    {
485
                        "mode": "Whatever",
486
                        "pk": [],
487
                        "column": []
488
                    }
489
                ]
490
            }
491
        }';
492
493
        $dbDiff->import($json);
494
        $dbDiff->rollback();
495
    }
496
497
498
    /**
@@ 543-563 (lines=21) @@
540
     * @expectedException \Exception
541
     * @expectedExceptionMessage Invalid mode
542
     */
543
    public function testRollbackWithInvalidMode()
544
    {
545
        $dbDiff = $this->buildMock();
546
547
        $json = '{
548
            "rowCount": 0,
549
            "executeStatus": 0,
550
            "diff": {
551
                "' . self::$tableUser .  '": [
552
                    {
553
                        "mode": "InvalidMode",
554
                        "pk": [],
555
                        "column": []
556
                    }
557
                ]
558
            }
559
        }';
560
561
        $dbDiff->import($json);
562
        $dbDiff->rollback();
563
    }
564
565
566
    /**