aboutsummaryrefslogtreecommitdiffstats
path: root/tests/migrator
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-05-28 23:33:25 +0200
committerJoas Schilling <nickvergessen@gmx.de>2014-05-28 23:33:25 +0200
commit033df350d956121388b7b9be8f1b0f1d1439d2e4 (patch)
treec40644d7d4e8c613a84accf52eeb768528c941b3 /tests/migrator
parent1b2238a6b11ff7ad8f8feae44816268c790f809d (diff)
parent9f37d414be1cc13377b9af1777220577c7af645c (diff)
downloadforums-033df350d956121388b7b9be8f1b0f1d1439d2e4.tar
forums-033df350d956121388b7b9be8f1b0f1d1439d2e4.tar.gz
forums-033df350d956121388b7b9be8f1b0f1d1439d2e4.tar.bz2
forums-033df350d956121388b7b9be8f1b0f1d1439d2e4.tar.xz
forums-033df350d956121388b7b9be8f1b0f1d1439d2e4.zip
Merge pull request #2474 from PayBas/ticket/12561
[ticket/12561] Add "after" check to schema_generator for columns_add * PayBas/ticket/12561: [ticket/12561] Reworked tests by nickvergessen [ticket/12561] Added tests for "after last", "after missing" and "empty" [ticket/12561] Add check to see if "after" column actually exists [ticket/12561] Added test for "after" [ticket/12561] Add "after" check to schema_generator for columns_add
Diffstat (limited to 'tests/migrator')
-rw-r--r--tests/migrator/schema_generator_test.php87
1 files changed, 86 insertions, 1 deletions
diff --git a/tests/migrator/schema_generator_test.php b/tests/migrator/schema_generator_test.php
index 976265272a..9adf518a5d 100644
--- a/tests/migrator/schema_generator_test.php
+++ b/tests/migrator/schema_generator_test.php
@@ -11,8 +11,19 @@
*
*/
-class schmema_generator_test extends phpbb_test_case
+require_once __DIR__ . '/../dbal/migration/dummy_order.php';
+require_once __DIR__ . '/../dbal/migration/dummy_order_0.php';
+require_once __DIR__ . '/../dbal/migration/dummy_order_1.php';
+require_once __DIR__ . '/../dbal/migration/dummy_order_2.php';
+require_once __DIR__ . '/../dbal/migration/dummy_order_3.php';
+require_once __DIR__ . '/../dbal/migration/dummy_order_4.php';
+require_once __DIR__ . '/../dbal/migration/dummy_order_5.php';
+
+class schema_generator_test extends phpbb_test_case
{
+ /** @var \phpbb\db\migration\schema_generator */
+ protected $generator;
+
public function setUp()
{
parent::setUp();
@@ -50,4 +61,78 @@ class schmema_generator_test extends phpbb_test_case
$this->assertArrayHasKey('phpbb_users', $this->generator->get_schema());
}
+
+ public function column_add_after_data()
+ {
+ return array(
+ array(
+ 'phpbb_dbal_migration_dummy_order_0',
+ array(
+ 'foobar1',
+ 'foobar2',
+ 'foobar3',
+ ),
+ ),
+ array(
+ 'phpbb_dbal_migration_dummy_order_1',
+ array(
+ 'foobar1',
+ 'foobar3',
+ 'foobar4',
+ ),
+ ),
+ array(
+ 'phpbb_dbal_migration_dummy_order_2',
+ array(
+ 'foobar1',
+ 'foobar3',
+ 'foobar5',
+ ),
+ ),
+ array(
+ 'phpbb_dbal_migration_dummy_order_3',
+ array(
+ 'foobar1',
+ 'foobar3',
+ 'foobar6',
+ ),
+ ),
+ array(
+ 'phpbb_dbal_migration_dummy_order_4',
+ array(
+ 'foobar1',
+ 'foobar3',
+ 'foobar7',
+ ),
+ ),
+ array(
+ 'phpbb_dbal_migration_dummy_order_5',
+ array(
+ 'foobar1',
+ 'foobar3',
+ 'foobar9',
+ 'foobar8',
+ ),
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider column_add_after_data
+ */
+ public function test_column_add_after($migration, $expected)
+ {
+ $this->get_schema_generator(array(
+ 'phpbb_dbal_migration_dummy_order',
+ $migration,
+ ));
+
+ $tables = $this->generator->get_schema();
+
+ $this->assertEquals(
+ $expected,
+ array_keys($tables[$this->table_prefix . 'column_order_test1']['COLUMNS']),
+ 'The schema generator could not position the column correctly, using the "after" option in the migration script.'
+ );
+ }
}