| @@ 419-436 (lines=18) @@ | ||
| 416 | $this->assertTrue($this->adapter->hasColumn('t', 'column2')); |
|
| 417 | } |
|
| 418 | ||
| 419 | public function testRenamingANonExistentColumn() |
|
| 420 | { |
|
| 421 | $table = new \Phinx\Db\Table('t', array(), $this->adapter); |
|
| 422 | $table->addColumn('column1', 'string') |
|
| 423 | ->save(); |
|
| 424 | ||
| 425 | try { |
|
| 426 | $this->adapter->renameColumn('t', 'column2', 'column1'); |
|
| 427 | $this->fail('Expected the adapter to throw an exception'); |
|
| 428 | } catch (\InvalidArgumentException $e) { |
|
| 429 | $this->assertInstanceOf( |
|
| 430 | 'InvalidArgumentException', |
|
| 431 | $e, |
|
| 432 | 'Expected exception of type InvalidArgumentException, got ' . get_class($e) |
|
| 433 | ); |
|
| 434 | $this->assertEquals('The specified column doesn\'t exist: column2', $e->getMessage()); |
|
| 435 | } |
|
| 436 | } |
|
| 437 | ||
| 438 | public function testChangeColumn() |
|
| 439 | { |
|
| @@ 262-279 (lines=18) @@ | ||
| 259 | $this->assertTrue($this->adapter->hasColumn('t', 'column2')); |
|
| 260 | } |
|
| 261 | ||
| 262 | public function testRenamingANonExistentColumn() |
|
| 263 | { |
|
| 264 | $table = new \Phinx\Db\Table('t', array(), $this->adapter); |
|
| 265 | $table->addColumn('column1', 'string') |
|
| 266 | ->save(); |
|
| 267 | ||
| 268 | try { |
|
| 269 | $this->adapter->renameColumn('t', 'column2', 'column1'); |
|
| 270 | $this->fail('Expected the adapter to throw an exception'); |
|
| 271 | } catch (\InvalidArgumentException $e) { |
|
| 272 | $this->assertInstanceOf( |
|
| 273 | 'InvalidArgumentException', |
|
| 274 | $e, |
|
| 275 | 'Expected exception of type InvalidArgumentException, got ' . get_class($e) |
|
| 276 | ); |
|
| 277 | $this->assertEquals('The specified column doesn\'t exist: column2', $e->getMessage()); |
|
| 278 | } |
|
| 279 | } |
|
| 280 | ||
| 281 | public function testChangeColumn() |
|
| 282 | { |
|
| @@ 288-305 (lines=18) @@ | ||
| 285 | $this->assertTrue($this->adapter->hasColumn('t', 'column2')); |
|
| 286 | } |
|
| 287 | ||
| 288 | public function testRenamingANonExistentColumn() |
|
| 289 | { |
|
| 290 | $table = new \Phinx\Db\Table('t', array(), $this->adapter); |
|
| 291 | $table->addColumn('column1', 'string') |
|
| 292 | ->save(); |
|
| 293 | ||
| 294 | try { |
|
| 295 | $this->adapter->renameColumn('t', 'column2', 'column1'); |
|
| 296 | $this->fail('Expected the adapter to throw an exception'); |
|
| 297 | } catch (\InvalidArgumentException $e) { |
|
| 298 | $this->assertInstanceOf( |
|
| 299 | 'InvalidArgumentException', |
|
| 300 | $e, |
|
| 301 | 'Expected exception of type InvalidArgumentException, got ' . get_class($e) |
|
| 302 | ); |
|
| 303 | $this->assertEquals('The specified column does not exist: column2', $e->getMessage()); |
|
| 304 | } |
|
| 305 | } |
|
| 306 | ||
| 307 | public function testChangeColumn() |
|
| 308 | { |
|
| @@ 362-379 (lines=18) @@ | ||
| 359 | $this->assertTrue($this->adapter->hasColumn('t', 'column2')); |
|
| 360 | } |
|
| 361 | ||
| 362 | public function testRenamingANonExistentColumn() |
|
| 363 | { |
|
| 364 | $table = new \Phinx\Db\Table('t', array(), $this->adapter); |
|
| 365 | $table->addColumn('column1', 'string') |
|
| 366 | ->save(); |
|
| 367 | ||
| 368 | try { |
|
| 369 | $this->adapter->renameColumn('t', 'column2', 'column1'); |
|
| 370 | $this->fail('Expected the adapter to throw an exception'); |
|
| 371 | } catch (\InvalidArgumentException $e) { |
|
| 372 | $this->assertInstanceOf( |
|
| 373 | 'InvalidArgumentException', |
|
| 374 | $e, |
|
| 375 | 'Expected exception of type InvalidArgumentException, got ' . get_class($e) |
|
| 376 | ); |
|
| 377 | $this->assertEquals('The specified column does not exist: column2', $e->getMessage()); |
|
| 378 | } |
|
| 379 | } |
|
| 380 | ||
| 381 | public function testChangeColumn() |
|
| 382 | { |
|