@@ 40-68 (lines=29) @@ | ||
37 | /** |
|
38 | * @return DbDiff |
|
39 | */ |
|
40 | protected function buildMockWithFakeDb() |
|
41 | { |
|
42 | $db = $this->getMockBuilder(Adodb::class) |
|
43 | ->disableOriginalConstructor() |
|
44 | ->getMock( |
|
45 | Adodb::class, |
|
46 | [ |
|
47 | 'BeginTrans', 'CommitTrans', 'RollbackTrans', |
|
48 | 'getErrorCode', 'getErrorMessage', |
|
49 | 'execute' |
|
50 | ] |
|
51 | ); |
|
52 | ||
53 | $db->expects($this->any()) |
|
54 | ->method('getErrorCode') |
|
55 | ->will($this->returnCallback(function () { |
|
56 | return DbDiffTest::$getErrorCode; |
|
57 | })); |
|
58 | ||
59 | $db->expects($this->any()) |
|
60 | ->method('getErrorMessage') |
|
61 | ->will($this->returnCallback(function () { |
|
62 | return DbDiffTest::$getErrorMessage; |
|
63 | })); |
|
64 | ||
65 | $dbDiff = new DbDiff($db); |
|
66 | ||
67 | return $dbDiff; |
|
68 | } |
|
69 | ||
70 | ||
71 | public static function setUpBeforeClass() |
@@ 44-73 (lines=30) @@ | ||
41 | } |
|
42 | ||
43 | ||
44 | protected function buildMockWithFakeDb() |
|
45 | { |
|
46 | $db = $this->getMockBuilder(Adodb::class) |
|
47 | ->disableOriginalConstructor() |
|
48 | ->getMock( |
|
49 | Adodb::class, |
|
50 | [ |
|
51 | 'BeginTrans', 'CommitTrans', 'RollbackTrans', |
|
52 | 'getErrorCode', 'getErrorMessage', |
|
53 | 'execute' |
|
54 | ] |
|
55 | ); |
|
56 | ||
57 | $db->expects($this->any()) |
|
58 | ->method('getErrorCode') |
|
59 | ->will($this->returnCallback(function () { |
|
60 | return ExecutorTest::$getErrorCode; |
|
61 | })); |
|
62 | ||
63 | $db->expects($this->any()) |
|
64 | ->method('getErrorMessage') |
|
65 | ->will($this->returnCallback(function () { |
|
66 | return ExecutorTest::$getErrorMessage; |
|
67 | })); |
|
68 | ||
69 | $executor = $this->buildMock(); |
|
70 | $executor->setDb($db); |
|
71 | ||
72 | return $executor; |
|
73 | } |
|
74 | ||
75 | ||
76 | protected function buildMockRowSetWithInvalidMode() |