| @@ 216-228 (lines=13) @@ | ||
| 213 | $this->assertTrue($table->hasColumn('email')); |
|
| 214 | } |
|
| 215 | ||
| 216 | public function testAddColumnWithDefaultValue() |
|
| 217 | { |
|
| 218 | $table = new \Phinx\Db\Table('table1', array(), $this->adapter); |
|
| 219 | $table->save(); |
|
| 220 | $table->addColumn('default_zero', 'string', array('default' => 'test')) |
|
| 221 | ->save(); |
|
| 222 | $columns = $this->adapter->getColumns('table1'); |
|
| 223 | foreach ($columns as $column) { |
|
| 224 | if ($column->getName() == 'default_zero') { |
|
| 225 | $this->assertEquals("test", $column->getDefault()); |
|
| 226 | } |
|
| 227 | } |
|
| 228 | } |
|
| 229 | ||
| 230 | public function testAddColumnWithDefaultZero() |
|
| 231 | { |
|
| @@ 230-243 (lines=14) @@ | ||
| 227 | } |
|
| 228 | } |
|
| 229 | ||
| 230 | public function testAddColumnWithDefaultZero() |
|
| 231 | { |
|
| 232 | $table = new \Phinx\Db\Table('table1', array(), $this->adapter); |
|
| 233 | $table->save(); |
|
| 234 | $table->addColumn('default_zero', 'integer', array('default' => 0)) |
|
| 235 | ->save(); |
|
| 236 | $columns = $this->adapter->getColumns('table1'); |
|
| 237 | foreach ($columns as $column) { |
|
| 238 | if ($column->getName() == 'default_zero') { |
|
| 239 | $this->assertNotNull($column->getDefault()); |
|
| 240 | $this->assertEquals('0', $column->getDefault()); |
|
| 241 | } |
|
| 242 | } |
|
| 243 | } |
|
| 244 | ||
| 245 | public function testAddColumnWithDefaultNull() { |
|
| 246 | $table = new \Phinx\Db\Table('table1', array(), $this->adapter); |
|
| @@ 247-259 (lines=13) @@ | ||
| 244 | $this->assertTrue($table->hasColumn('email')); |
|
| 245 | } |
|
| 246 | ||
| 247 | public function testAddColumnWithDefaultValue() |
|
| 248 | { |
|
| 249 | $table = new \Phinx\Db\Table('table1', array(), $this->adapter); |
|
| 250 | $table->save(); |
|
| 251 | $table->addColumn('default_zero', 'string', array('default' => 'test')) |
|
| 252 | ->save(); |
|
| 253 | $columns = $this->adapter->getColumns('table1'); |
|
| 254 | foreach ($columns as $column) { |
|
| 255 | if ($column->getName() == 'default_zero') { |
|
| 256 | $this->assertEquals("'test'::character varying", $column->getDefault()); |
|
| 257 | } |
|
| 258 | } |
|
| 259 | } |
|
| 260 | ||
| 261 | public function testAddColumnWithDefaultZero() |
|
| 262 | { |
|
| @@ 261-274 (lines=14) @@ | ||
| 258 | } |
|
| 259 | } |
|
| 260 | ||
| 261 | public function testAddColumnWithDefaultZero() |
|
| 262 | { |
|
| 263 | $table = new \Phinx\Db\Table('table1', array(), $this->adapter); |
|
| 264 | $table->save(); |
|
| 265 | $table->addColumn('default_zero', 'integer', array('default' => 0)) |
|
| 266 | ->save(); |
|
| 267 | $columns = $this->adapter->getColumns('table1'); |
|
| 268 | foreach ($columns as $column) { |
|
| 269 | if ($column->getName() == 'default_zero') { |
|
| 270 | $this->assertNotNull($column->getDefault()); |
|
| 271 | $this->assertEquals('0', $column->getDefault()); |
|
| 272 | } |
|
| 273 | } |
|
| 274 | } |
|
| 275 | ||
| 276 | public function testAddColumnWithDefaultBoolean() |
|
| 277 | { |
|