| @@ 97-121 (lines=25) @@ | ||
| 94 | ); |
|
| 95 | } |
|
| 96 | ||
| 97 | public function testWrongTableNameQuery() |
|
| 98 | { |
|
| 99 | $migration = new WrongTableNameMigration(); |
|
| 100 | $migrations = [ |
|
| 101 | new MigrationState($migration) |
|
| 102 | ]; |
|
| 103 | $this->setExpectedException( |
|
| 104 | '\RuntimeException', |
|
| 105 | 'Failed migrations: RDV\Bundle\MigrationBundle\Tests\Unit\Fixture\TestPackage\WrongTableNameMigration.' |
|
| 106 | ); |
|
| 107 | $this->executor->executeUp($migrations); |
|
| 108 | $this->assertEquals( |
|
| 109 | '> RDV\Bundle\MigrationBundle\Tests\Unit\Fixture\TestPackage\WrongTableNameMigration', |
|
| 110 | $this->logger->getMessages()[0] |
|
| 111 | ); |
|
| 112 | $this->assertEquals( |
|
| 113 | sprintf( |
|
| 114 | ' ERROR: Max table name length is %s. Please correct "%s" table in "%s" migration', |
|
| 115 | $this->nameGenerator->getMaxIdentifierSize(), |
|
| 116 | 'extra_long_table_name_bigger_than_30_chars', |
|
| 117 | get_class($migration) |
|
| 118 | ), |
|
| 119 | $this->logger->getMessages()[1] |
|
| 120 | ); |
|
| 121 | } |
|
| 122 | ||
| 123 | public function testWrongColumnNameQuery() |
|
| 124 | { |
|
| @@ 123-148 (lines=26) @@ | ||
| 120 | ); |
|
| 121 | } |
|
| 122 | ||
| 123 | public function testWrongColumnNameQuery() |
|
| 124 | { |
|
| 125 | $migration = new WrongColumnNameMigration(); |
|
| 126 | $migrations = [ |
|
| 127 | new MigrationState($migration) |
|
| 128 | ]; |
|
| 129 | $this->setExpectedException( |
|
| 130 | '\RuntimeException', |
|
| 131 | 'Failed migrations: RDV\Bundle\MigrationBundle\Tests\Unit\Fixture\TestPackage\WrongColumnNameMigration.' |
|
| 132 | ); |
|
| 133 | $this->executor->executeUp($migrations); |
|
| 134 | $this->assertEquals( |
|
| 135 | '> RDV\Bundle\MigrationBundle\Tests\Unit\Fixture\TestPackage\WrongColumnNameMigration', |
|
| 136 | $this->logger->getMessages()[0] |
|
| 137 | ); |
|
| 138 | $this->assertEquals( |
|
| 139 | sprintf( |
|
| 140 | ' ERROR: Max column name length is %s. Please correct "%s:%s" column in "%s" migration', |
|
| 141 | $this->nameGenerator->getMaxIdentifierSize(), |
|
| 142 | 'wrong_table', |
|
| 143 | 'extra_long_column_bigger_30_chars', |
|
| 144 | get_class($migration) |
|
| 145 | ), |
|
| 146 | $this->logger->getMessages()[1] |
|
| 147 | ); |
|
| 148 | } |
|
| 149 | } |
|
| 150 | ||