@@ 94-106 (lines=13) @@ | ||
91 | /** |
|
92 | * 3 Add an error SQL |
|
93 | */ |
|
94 | public function testExecuteErrorSql() |
|
95 | { |
|
96 | $this->expectOutputRegex('/Execute abort./'); |
|
97 | self::$sds->setSql( |
|
98 | 43, |
|
99 | 'ALTER TABLE ' . self::$tableUser . ' |
|
100 | ADD COLUMN temp1 INT NOT NULL DEFAULT 0' |
|
101 | ); |
|
102 | self::$sds->execute(); |
|
103 | ||
104 | $this->assertEquals(43, self::$sds->lastId); |
|
105 | $this->assertEquals(42, self::$sds->lastIdDone); |
|
106 | } |
|
107 | ||
108 | ||
109 | /** |
|
@@ 112-125 (lines=14) @@ | ||
109 | /** |
|
110 | * 4 Add SQL with smaller id, will not execute |
|
111 | */ |
|
112 | public function testExecuteSmallId() |
|
113 | { |
|
114 | $this->expectOutputRegex('/No un-done SQL to do./'); |
|
115 | self::$sds->setSql( |
|
116 | 22, |
|
117 | 'ALTER TABLE ' . self::$tableUser . ' |
|
118 | ADD COLUMN temp2 INT NOT NULL DEFAULT 0' |
|
119 | ); |
|
120 | self::$sds->execute(); |
|
121 | ||
122 | // Error SQL 43 is cleared by execute() |
|
123 | $this->assertEquals(42, self::$sds->getLastId()); |
|
124 | $this->assertEquals(42, self::$sds->getLastIdDone()); |
|
125 | } |
|
126 | } |
|
127 |