aboutsummaryrefslogtreecommitdiffstats
path: root/tests/migrator
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2014-04-06 20:33:12 +0200
committerMarc Alexander <admin@m-a-styles.de>2014-04-06 20:33:12 +0200
commitf123512280adbde8196ded39bdcaf8bd1a30bde0 (patch)
treea7d6cc26b904706bc1bb33a8839fd562921c1a9a /tests/migrator
parent904de5b39aa20e692e9b2d1dcda77736b5928dc2 (diff)
downloadforums-f123512280adbde8196ded39bdcaf8bd1a30bde0.tar
forums-f123512280adbde8196ded39bdcaf8bd1a30bde0.tar.gz
forums-f123512280adbde8196ded39bdcaf8bd1a30bde0.tar.bz2
forums-f123512280adbde8196ded39bdcaf8bd1a30bde0.tar.xz
forums-f123512280adbde8196ded39bdcaf8bd1a30bde0.zip
[ticket/12362] Add tests for schema generator
PHPBB3-12362
Diffstat (limited to 'tests/migrator')
-rw-r--r--tests/migrator/schema_generator_test.php55
1 files changed, 55 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..9f9213779c
--- /dev/null
+++ b/tests/migrator/schema_generator_test.php
@@ -0,0 +1,55 @@
+<?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_database_test_case
+{
+ // Use some bogus fixture as we don't actually need to access the database
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/../dbal/fixtures/config.xml');
+ }
+
+ public function setUp()
+ {
+ parent::setUp();
+
+ $this->config = new \phpbb\config\config(array());
+ $this->db = $this->new_dbal();
+ $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());
+ }
+}