@@ 111-128 (lines=18) @@ | ||
108 | * @param string $expected |
|
109 | * @dataProvider diffProvider |
|
110 | */ |
|
111 | public function testDiff($firstTableText, $secondTableText, $expected) |
|
112 | { |
|
113 | $collation = new CollationInfo(); |
|
114 | ||
115 | $firstStream = $this->makeStream($firstTableText); |
|
116 | $firstTable = new CreateTable($collation); |
|
117 | $firstTable->setDefaultEngine('InnoDB'); |
|
118 | $firstTable->parse($firstStream); |
|
119 | ||
120 | $secondStream = $this->makeStream($secondTableText); |
|
121 | $secondTable = new CreateTable($collation); |
|
122 | $secondTable->setDefaultEngine('InnoDB'); |
|
123 | $secondTable->parse($secondStream); |
|
124 | ||
125 | $diff = $firstTable->diff($secondTable); |
|
126 | ||
127 | $this->assertEquals($expected == "" ? [] : [$expected], $diff); |
|
128 | } |
|
129 | ||
130 | /** |
|
131 | * @return array |
|
@@ 168-186 (lines=19) @@ | ||
165 | * @param array $flags |
|
166 | * @param string $expected |
|
167 | */ |
|
168 | public function testAlterEngineDiff(array $flags, $expected) |
|
169 | { |
|
170 | $sql = 'create table t (a int)'; |
|
171 | $collation = new CollationInfo(); |
|
172 | ||
173 | $firstStream = $this->makeStream($sql); |
|
174 | $firstTable = new CreateTable($collation); |
|
175 | $firstTable->setDefaultEngine('InnoDb'); |
|
176 | $firstTable->parse($firstStream); |
|
177 | ||
178 | $secondStream = $this->makeStream($sql); |
|
179 | $secondTable = new CreateTable($collation); |
|
180 | $secondTable->setDefaultEngine('MyISAM'); |
|
181 | $secondTable->parse($secondStream); |
|
182 | ||
183 | $diff = $firstTable->diff($secondTable, $flags); |
|
184 | ||
185 | $this->assertEquals($expected, $diff); |
|
186 | } |
|
187 | ||
188 | /** |
|
189 | * @return array |