diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-04-07 22:42:42 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-04-07 22:42:42 +0200 |
commit | 6c6916dc7dc9233e60823013c96cab38cd930406 (patch) | |
tree | f7eb6166a2aaf44d01d369f89b2ee02941fc0dd8 /tests | |
parent | b2d73922c6ca9a22cb3c25c3f9fa615028d2f1be (diff) | |
parent | 44a9bfc07142a023e7e5f62245f2665be9f09359 (diff) | |
download | forums-6c6916dc7dc9233e60823013c96cab38cd930406.tar forums-6c6916dc7dc9233e60823013c96cab38cd930406.tar.gz forums-6c6916dc7dc9233e60823013c96cab38cd930406.tar.bz2 forums-6c6916dc7dc9233e60823013c96cab38cd930406.tar.xz forums-6c6916dc7dc9233e60823013c96cab38cd930406.zip |
Merge remote-tracking branch 'Marc/ticket/12362' into develop-ascraeus
* Marc/ticket/12362:
[ticket/12362] Do not use database test case as it's not needed
[ticket/12362] Add tests for schema generator
[ticket/12362] Throw exception in schema generator on unresolvable dependency
Diffstat (limited to 'tests')
-rw-r--r-- | tests/migrator/schema_generator_test.php | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/migrator/schema_generator_test.php b/tests/migrator/schema_generator_test.php new file mode 100644 index 0000000000..4bac447229 --- /dev/null +++ b/tests/migrator/schema_generator_test.php @@ -0,0 +1,49 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2014 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +class schmema_generator_test extends phpbb_test_case +{ + public function setUp() + { + parent::setUp(); + + $this->config = new \phpbb\config\config(array()); + $this->db = new \phpbb\db\driver\sqlite(); + $this->db_tools = new \phpbb\db\tools($this->db); + $this->table_prefix = 'phpbb_'; + } + + protected function get_schema_generator(array $class_names) + { + $this->generator = new \phpbb\db\migration\schema_generator($class_names, $this->config, $this->db, $this->db_tools, $this->phpbb_root_path, $this->php_ext, $this->table_prefix); + + return $this->generator; + } + + /** + * @expectedException \UnexpectedValueException + */ + public function test_check_dependencies_fail() + { + $this->get_schema_generator(array('\phpbb\db\migration\data\v310\forgot_password')); + + $this->generator->get_schema(); + } + + public function test_get_schema_success() + { + $this->get_schema_generator(array( + '\phpbb\db\migration\data\v30x\release_3_0_1_rc1', + '\phpbb\db\migration\data\v30x\release_3_0_0', + '\phpbb\db\migration\data\v310\boardindex' + )); + + $this->assertArrayHasKey('phpbb_users', $this->generator->get_schema()); + } +} |