@@ 127-138 (lines=12) @@ | ||
124 | $this->assertEquals('`test_column`', $this->adapter->quoteColumnName('test_column')); |
|
125 | } |
|
126 | ||
127 | public function testCreateTable() |
|
128 | { |
|
129 | $table = new \Phinx\Db\Table('ntable', array(), $this->adapter); |
|
130 | $table->addColumn('realname', 'string') |
|
131 | ->addColumn('email', 'integer') |
|
132 | ->save(); |
|
133 | $this->assertTrue($this->adapter->hasTable('ntable')); |
|
134 | $this->assertTrue($this->adapter->hasColumn('ntable', 'id')); |
|
135 | $this->assertTrue($this->adapter->hasColumn('ntable', 'realname')); |
|
136 | $this->assertTrue($this->adapter->hasColumn('ntable', 'email')); |
|
137 | $this->assertFalse($this->adapter->hasColumn('ntable', 'address')); |
|
138 | } |
|
139 | ||
140 | public function testCreateTableWithComment() |
|
141 | { |
|
@@ 189-200 (lines=12) @@ | ||
186 | $this->assertEquals($foreignKey['referenced_column_name'], 'id'); |
|
187 | } |
|
188 | ||
189 | public function testCreateTableCustomIdColumn() |
|
190 | { |
|
191 | $table = new \Phinx\Db\Table('ntable', array('id' => 'custom_id'), $this->adapter); |
|
192 | $table->addColumn('realname', 'string') |
|
193 | ->addColumn('email', 'integer') |
|
194 | ->save(); |
|
195 | $this->assertTrue($this->adapter->hasTable('ntable')); |
|
196 | $this->assertTrue($this->adapter->hasColumn('ntable', 'custom_id')); |
|
197 | $this->assertTrue($this->adapter->hasColumn('ntable', 'realname')); |
|
198 | $this->assertTrue($this->adapter->hasColumn('ntable', 'email')); |
|
199 | $this->assertFalse($this->adapter->hasColumn('ntable', 'address')); |
|
200 | } |
|
201 | ||
202 | public function testCreateTableWithNoOptions() |
|
203 | { |
|
@@ 407-417 (lines=11) @@ | ||
404 | $this->assertEquals('varchar(255)', $rows[1]['Type']); |
|
405 | } |
|
406 | ||
407 | public function testRenameColumn() |
|
408 | { |
|
409 | $table = new \Phinx\Db\Table('t', array(), $this->adapter); |
|
410 | $table->addColumn('column1', 'string') |
|
411 | ->save(); |
|
412 | $this->assertTrue($this->adapter->hasColumn('t', 'column1')); |
|
413 | $this->assertFalse($this->adapter->hasColumn('t', 'column2')); |
|
414 | $this->adapter->renameColumn('t', 'column1', 'column2'); |
|
415 | $this->assertFalse($this->adapter->hasColumn('t', 'column1')); |
|
416 | $this->assertTrue($this->adapter->hasColumn('t', 'column2')); |
|
417 | } |
|
418 | ||
419 | public function testRenamingANonExistentColumn() |
|
420 | { |
@@ 81-92 (lines=12) @@ | ||
78 | $this->assertEquals('`test_column`', $this->adapter->quoteColumnName('test_column')); |
|
79 | } |
|
80 | ||
81 | public function testCreateTable() |
|
82 | { |
|
83 | $table = new \Phinx\Db\Table('ntable', array(), $this->adapter); |
|
84 | $table->addColumn('realname', 'string') |
|
85 | ->addColumn('email', 'integer') |
|
86 | ->save(); |
|
87 | $this->assertTrue($this->adapter->hasTable('ntable')); |
|
88 | $this->assertTrue($this->adapter->hasColumn('ntable', 'id')); |
|
89 | $this->assertTrue($this->adapter->hasColumn('ntable', 'realname')); |
|
90 | $this->assertTrue($this->adapter->hasColumn('ntable', 'email')); |
|
91 | $this->assertFalse($this->adapter->hasColumn('ntable', 'address')); |
|
92 | } |
|
93 | ||
94 | public function testCreateTableCustomIdColumn() |
|
95 | { |
|
@@ 94-106 (lines=13) @@ | ||
91 | $this->assertFalse($this->adapter->hasColumn('ntable', 'address')); |
|
92 | } |
|
93 | ||
94 | public function testCreateTableCustomIdColumn() |
|
95 | { |
|
96 | $table = new \Phinx\Db\Table('ntable', array('id' => 'custom_id'), $this->adapter); |
|
97 | $table->addColumn('realname', 'string') |
|
98 | ->addColumn('email', 'integer') |
|
99 | ->save(); |
|
100 | ||
101 | $this->assertTrue($this->adapter->hasTable('ntable')); |
|
102 | $this->assertTrue($this->adapter->hasColumn('ntable', 'custom_id')); |
|
103 | $this->assertTrue($this->adapter->hasColumn('ntable', 'realname')); |
|
104 | $this->assertTrue($this->adapter->hasColumn('ntable', 'email')); |
|
105 | $this->assertFalse($this->adapter->hasColumn('ntable', 'address')); |
|
106 | } |
|
107 | ||
108 | public function testCreateTableWithNoOptions() |
|
109 | { |
@@ 108-119 (lines=12) @@ | ||
105 | $this->assertEquals('[test_column]', $this->adapter->quoteColumnName('test_column')); |
|
106 | } |
|
107 | ||
108 | public function testCreateTable() |
|
109 | { |
|
110 | $table = new \Phinx\Db\Table('ntable', array(), $this->adapter); |
|
111 | $table->addColumn('realname', 'string') |
|
112 | ->addColumn('email', 'integer') |
|
113 | ->save(); |
|
114 | $this->assertTrue($this->adapter->hasTable('ntable')); |
|
115 | $this->assertTrue($this->adapter->hasColumn('ntable', 'id')); |
|
116 | $this->assertTrue($this->adapter->hasColumn('ntable', 'realname')); |
|
117 | $this->assertTrue($this->adapter->hasColumn('ntable', 'email')); |
|
118 | $this->assertFalse($this->adapter->hasColumn('ntable', 'address')); |
|
119 | } |
|
120 | ||
121 | public function testCreateTableCustomIdColumn() |
|
122 | { |
|
@@ 121-132 (lines=12) @@ | ||
118 | $this->assertFalse($this->adapter->hasColumn('ntable', 'address')); |
|
119 | } |
|
120 | ||
121 | public function testCreateTableCustomIdColumn() |
|
122 | { |
|
123 | $table = new \Phinx\Db\Table('ntable', array('id' => 'custom_id'), $this->adapter); |
|
124 | $table->addColumn('realname', 'string') |
|
125 | ->addColumn('email', 'integer') |
|
126 | ->save(); |
|
127 | $this->assertTrue($this->adapter->hasTable('ntable')); |
|
128 | $this->assertTrue($this->adapter->hasColumn('ntable', 'custom_id')); |
|
129 | $this->assertTrue($this->adapter->hasColumn('ntable', 'realname')); |
|
130 | $this->assertTrue($this->adapter->hasColumn('ntable', 'email')); |
|
131 | $this->assertFalse($this->adapter->hasColumn('ntable', 'address')); |
|
132 | } |
|
133 | ||
134 | public function testCreateTableWithNoPrimaryKey() |
|
135 | { |
|
@@ 276-286 (lines=11) @@ | ||
273 | } |
|
274 | } |
|
275 | ||
276 | public function testRenameColumn() |
|
277 | { |
|
278 | $table = new \Phinx\Db\Table('t', array(), $this->adapter); |
|
279 | $table->addColumn('column1', 'string') |
|
280 | ->save(); |
|
281 | $this->assertTrue($this->adapter->hasColumn('t', 'column1')); |
|
282 | $this->assertFalse($this->adapter->hasColumn('t', 'column2')); |
|
283 | $this->adapter->renameColumn('t', 'column1', 'column2'); |
|
284 | $this->assertFalse($this->adapter->hasColumn('t', 'column1')); |
|
285 | $this->assertTrue($this->adapter->hasColumn('t', 'column2')); |
|
286 | } |
|
287 | ||
288 | public function testRenamingANonExistentColumn() |
|
289 | { |
@@ 139-150 (lines=12) @@ | ||
136 | $this->assertEquals('"string.string"', $this->adapter->quoteColumnName('string.string')); |
|
137 | } |
|
138 | ||
139 | public function testCreateTable() |
|
140 | { |
|
141 | $table = new \Phinx\Db\Table('ntable', array(), $this->adapter); |
|
142 | $table->addColumn('realname', 'string') |
|
143 | ->addColumn('email', 'integer') |
|
144 | ->save(); |
|
145 | $this->assertTrue($this->adapter->hasTable('ntable')); |
|
146 | $this->assertTrue($this->adapter->hasColumn('ntable', 'id')); |
|
147 | $this->assertTrue($this->adapter->hasColumn('ntable', 'realname')); |
|
148 | $this->assertTrue($this->adapter->hasColumn('ntable', 'email')); |
|
149 | $this->assertFalse($this->adapter->hasColumn('ntable', 'address')); |
|
150 | } |
|
151 | ||
152 | public function testCreateTableCustomIdColumn() |
|
153 | { |
|
@@ 152-163 (lines=12) @@ | ||
149 | $this->assertFalse($this->adapter->hasColumn('ntable', 'address')); |
|
150 | } |
|
151 | ||
152 | public function testCreateTableCustomIdColumn() |
|
153 | { |
|
154 | $table = new \Phinx\Db\Table('ntable', array('id' => 'custom_id'), $this->adapter); |
|
155 | $table->addColumn('realname', 'string') |
|
156 | ->addColumn('email', 'integer') |
|
157 | ->save(); |
|
158 | $this->assertTrue($this->adapter->hasTable('ntable')); |
|
159 | $this->assertTrue($this->adapter->hasColumn('ntable', 'custom_id')); |
|
160 | $this->assertTrue($this->adapter->hasColumn('ntable', 'realname')); |
|
161 | $this->assertTrue($this->adapter->hasColumn('ntable', 'email')); |
|
162 | $this->assertFalse($this->adapter->hasColumn('ntable', 'address')); |
|
163 | } |
|
164 | ||
165 | public function testCreateTableWithNoPrimaryKey() |
|
166 | { |
|
@@ 350-360 (lines=11) @@ | ||
347 | $this->assertTrue($table->hasColumn($column_name)); |
|
348 | } |
|
349 | ||
350 | public function testRenameColumn() |
|
351 | { |
|
352 | $table = new \Phinx\Db\Table('t', array(), $this->adapter); |
|
353 | $table->addColumn('column1', 'string') |
|
354 | ->save(); |
|
355 | $this->assertTrue($this->adapter->hasColumn('t', 'column1')); |
|
356 | $this->assertFalse($this->adapter->hasColumn('t', 'column2')); |
|
357 | $this->adapter->renameColumn('t', 'column1', 'column2'); |
|
358 | $this->assertFalse($this->adapter->hasColumn('t', 'column1')); |
|
359 | $this->assertTrue($this->adapter->hasColumn('t', 'column2')); |
|
360 | } |
|
361 | ||
362 | public function testRenamingANonExistentColumn() |
|
363 | { |