phpbb/tests/migrator/schema_generator_test.php
2014-05-27 20:51:13 +02:00

53 lines
1.4 KiB
PHP

<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
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());
}
}