@@ 670-679 (lines=10) @@ | ||
667 | } |
|
668 | ||
669 | ||
670 | public function testAddIndex() |
|
671 | { |
|
672 | $table = new \Phinx\Db\Table('table1', array(), $this->adapter); |
|
673 | $table->addColumn('email', 'string') |
|
674 | ->save(); |
|
675 | $this->assertFalse($table->hasIndex('email')); |
|
676 | $table->addIndex('email') |
|
677 | ->save(); |
|
678 | $this->assertTrue($table->hasIndex('email')); |
|
679 | } |
|
680 | ||
681 | public function testDropIndex() |
|
682 | { |
|
@@ 934-942 (lines=9) @@ | ||
931 | $this->assertEquals("enum('one','two')", $rows[1]['Type']); |
|
932 | } |
|
933 | ||
934 | public function testHasColumn() |
|
935 | { |
|
936 | $table = new \Phinx\Db\Table('table1', array(), $this->adapter); |
|
937 | $table->addColumn('column1', 'string') |
|
938 | ->save(); |
|
939 | ||
940 | $this->assertFalse($table->hasColumn('column2')); |
|
941 | $this->assertTrue($table->hasColumn('column1')); |
|
942 | } |
|
943 | ||
944 | public function testHasColumnReservedName() |
|
945 | { |
|
@@ 944-952 (lines=9) @@ | ||
941 | $this->assertTrue($table->hasColumn('column1')); |
|
942 | } |
|
943 | ||
944 | public function testHasColumnReservedName() |
|
945 | { |
|
946 | $tableQuoted = new \Phinx\Db\Table('group', array(), $this->adapter); |
|
947 | $tableQuoted->addColumn('value', 'string') |
|
948 | ->save(); |
|
949 | ||
950 | $this->assertFalse($tableQuoted->hasColumn('column2')); |
|
951 | $this->assertTrue($tableQuoted->hasColumn('value')); |
|
952 | } |
|
953 | ||
954 | public function testInsertData() |
|
955 | { |
@@ 205-218 (lines=14) @@ | ||
202 | $this->assertTrue($this->adapter->hasTable('table2')); |
|
203 | } |
|
204 | ||
205 | public function testAddColumn() |
|
206 | { |
|
207 | $table = new \Phinx\Db\Table('table1', array(), $this->adapter); |
|
208 | $table->save(); |
|
209 | $this->assertFalse($table->hasColumn('email')); |
|
210 | $table->addColumn('email', 'string') |
|
211 | ->save(); |
|
212 | $this->assertTrue($table->hasColumn('email')); |
|
213 | ||
214 | // In SQLite it is not possible to dictate order of added columns. |
|
215 | // $table->addColumn('realname', 'string', array('after' => 'id')) |
|
216 | // ->save(); |
|
217 | // $this->assertEquals('realname', $rows[1]['Field']); |
|
218 | } |
|
219 | ||
220 | public function testAddColumnWithDefaultValue() |
|
221 | { |
|
@@ 376-385 (lines=10) @@ | ||
373 | } |
|
374 | } |
|
375 | ||
376 | public function testAddIndex() |
|
377 | { |
|
378 | $table = new \Phinx\Db\Table('table1', array(), $this->adapter); |
|
379 | $table->addColumn('email', 'string') |
|
380 | ->save(); |
|
381 | $this->assertFalse($table->hasIndex('email')); |
|
382 | $table->addIndex('email') |
|
383 | ->save(); |
|
384 | $this->assertTrue($table->hasIndex('email')); |
|
385 | } |
|
386 | ||
387 | public function testDropIndex() |
|
388 | { |
@@ 206-214 (lines=9) @@ | ||
203 | $this->assertTrue($this->adapter->hasTable('table2')); |
|
204 | } |
|
205 | ||
206 | public function testAddColumn() |
|
207 | { |
|
208 | $table = new \Phinx\Db\Table('table1', array(), $this->adapter); |
|
209 | $table->save(); |
|
210 | $this->assertFalse($table->hasColumn('email')); |
|
211 | $table->addColumn('email', 'string') |
|
212 | ->save(); |
|
213 | $this->assertTrue($table->hasColumn('email')); |
|
214 | } |
|
215 | ||
216 | public function testAddColumnWithDefaultValue() |
|
217 | { |
|
@@ 421-430 (lines=10) @@ | ||
418 | $this->assertSame('text', $columns['column4']->getDefault()); |
|
419 | } |
|
420 | ||
421 | public function testAddIndex() |
|
422 | { |
|
423 | $table = new \Phinx\Db\Table('table1', array(), $this->adapter); |
|
424 | $table->addColumn('email', 'string') |
|
425 | ->save(); |
|
426 | $this->assertFalse($table->hasIndex('email')); |
|
427 | $table->addIndex('email') |
|
428 | ->save(); |
|
429 | $this->assertTrue($table->hasIndex('email')); |
|
430 | } |
|
431 | ||
432 | public function testGetIndexes() |
|
433 | { |
@@ 237-245 (lines=9) @@ | ||
234 | $this->assertTrue($this->adapter->hasTable('table2')); |
|
235 | } |
|
236 | ||
237 | public function testAddColumn() |
|
238 | { |
|
239 | $table = new \Phinx\Db\Table('table1', array(), $this->adapter); |
|
240 | $table->save(); |
|
241 | $this->assertFalse($table->hasColumn('email')); |
|
242 | $table->addColumn('email', 'string') |
|
243 | ->save(); |
|
244 | $this->assertTrue($table->hasColumn('email')); |
|
245 | } |
|
246 | ||
247 | public function testAddColumnWithDefaultValue() |
|
248 | { |
|
@@ 490-499 (lines=10) @@ | ||
487 | } |
|
488 | } |
|
489 | ||
490 | public function testAddIndex() |
|
491 | { |
|
492 | $table = new \Phinx\Db\Table('table1', array(), $this->adapter); |
|
493 | $table->addColumn('email', 'string') |
|
494 | ->save(); |
|
495 | $this->assertFalse($table->hasIndex('email')); |
|
496 | $table->addIndex('email') |
|
497 | ->save(); |
|
498 | $this->assertTrue($table->hasIndex('email')); |
|
499 | } |
|
500 | ||
501 | public function testDropIndex() |
|
502 | { |