diff options
| author | Nils Adermann <naderman@naderman.de> | 2014-02-05 17:52:17 +0100 |
|---|---|---|
| committer | Nils Adermann <naderman@naderman.de> | 2014-02-05 17:52:17 +0100 |
| commit | 32bc5d72e424881109e0c86b716e8bd77e41bffc (patch) | |
| tree | f5714414117e6024106f56e751c19a3637d6a8fe /tests/dbal | |
| parent | 0b6b7fc486055c728a21227a406a3b9a1ac32d38 (diff) | |
| parent | be28445b66c8c74f92a50b086fd6b472ecaa963b (diff) | |
| download | forums-32bc5d72e424881109e0c86b716e8bd77e41bffc.tar forums-32bc5d72e424881109e0c86b716e8bd77e41bffc.tar.gz forums-32bc5d72e424881109e0c86b716e8bd77e41bffc.tar.bz2 forums-32bc5d72e424881109e0c86b716e8bd77e41bffc.tar.xz forums-32bc5d72e424881109e0c86b716e8bd77e41bffc.zip | |
Merge pull request #1995 from EXreaction/ticket/11880
Schema changes can take too long and cause a timeout
Diffstat (limited to 'tests/dbal')
| -rw-r--r-- | tests/dbal/migration/schema.php | 33 | ||||
| -rw-r--r-- | tests/dbal/migrator_test.php | 23 |
2 files changed, 55 insertions, 1 deletions
diff --git a/tests/dbal/migration/schema.php b/tests/dbal/migration/schema.php new file mode 100644 index 0000000000..46cf66eaec --- /dev/null +++ b/tests/dbal/migration/schema.php @@ -0,0 +1,33 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2014 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* +*/ + +class phpbb_dbal_migration_schema extends \phpbb\db\migration\migration +{ + function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'config' => array( + 'test_column1' => array('BOOL', 1), + ), + ), + ); + } + + function revert_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'config' => array( + 'test_column1', + ), + ), + ); + } +} diff --git a/tests/dbal/migrator_test.php b/tests/dbal/migrator_test.php index c6b4c289d3..c075f19825 100644 --- a/tests/dbal/migrator_test.php +++ b/tests/dbal/migrator_test.php @@ -16,6 +16,7 @@ require_once dirname(__FILE__) . '/migration/revert.php'; require_once dirname(__FILE__) . '/migration/revert_with_dependency.php'; require_once dirname(__FILE__) . '/migration/fail.php'; require_once dirname(__FILE__) . '/migration/installed.php'; +require_once dirname(__FILE__) . '/migration/schema.php'; class phpbb_dbal_migrator_test extends phpbb_database_test_case { @@ -49,7 +50,8 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case dirname(__FILE__) . '/../../phpBB/', 'php', 'phpbb_', - $tools + $tools, + new \phpbb\db\migration\helper() ); $container = new phpbb_mock_container_builder(); @@ -267,4 +269,23 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case $this->fail('Installed test failed'); } } + + public function test_schema() + { + $this->migrator->set_migrations(array('phpbb_dbal_migration_schema')); + + while (!$this->migrator->finished()) + { + $this->migrator->update(); + } + + $this->assertTrue($this->db_tools->sql_column_exists('phpbb_config', 'test_column1')); + + while ($this->migrator->migration_state('phpbb_dbal_migration_schema')) + { + $this->migrator->revert('phpbb_dbal_migration_schema'); + } + + $this->assertFalse($this->db_tools->sql_column_exists('phpbb_config', 'test_column1')); + } } |
