1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-06 16:56:44 +02:00

Merge pull request #4126 from marc1706/ticket/13733

[ticket/13733] Allow non-migration files inside migrations folder

* marc1706/ticket/13733:
  [ticket/13733] Remove validate_classes method argument
  [ticket/13733] Make sure migration classes always have same order in tests
  [ticket/13733] Properly test setting validate_classes to false/true
  [ticket/13733] Use interface for migratinos
  [ticket/13733] Update comment explaining migration class validation
  [ticket/13733] Add isInstantiable() check.
  [ticket/13733] Braces on their own lines
  [ticket/13733] Allow tests the skip class validation
  [ticket/13733] Properly handle nonexistent classes as well
  [ticket/13733] Handle nonexistent classes as well
  [ticket/13733] Only use migration classes that extension the base migration class.
This commit is contained in:
Tristan Darricau
2016-01-25 09:08:23 +01:00
6 changed files with 162 additions and 32 deletions

View File

@@ -0,0 +1,7 @@
<?php
namespace vendor2\foo\migrations;
class bar
{
}

View File

@@ -0,0 +1,54 @@
<?php
namespace vendor2\foo\migrations;
class foo implements \phpbb\db\migration\migration_interface
{
/**
* {@inheritdoc}
*/
static public function depends_on()
{
return array();
}
/**
* {@inheritdoc}
*/
public function effectively_installed()
{
return false;
}
/**
* {@inheritdoc}
*/
public function update_schema()
{
return array();
}
/**
* {@inheritdoc}
*/
public function revert_schema()
{
return array();
}
/**
* {@inheritdoc}
*/
public function update_data()
{
return array();
}
/**
* {@inheritdoc}
*/
public function revert_data()
{
return array();
}
}

View File

@@ -11,6 +11,9 @@
*
*/
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
require_once dirname(__FILE__) . '/ext/vendor2/bar/migrations/bar.php';
require_once dirname(__FILE__) . '/ext/vendor2/bar/migrations/foo.php';
require_once dirname(__FILE__) . '/ext/vendor2/bar/migrations/migration.php';
class phpbb_extension_extension_base_test extends phpbb_test_case
{
@@ -61,9 +64,7 @@ class phpbb_extension_extension_base_test extends phpbb_test_case
return array(
array(
'vendor2/bar',
array(
'\vendor2\bar\migrations\migration',
),
array('\vendor2\bar\migrations\migration'),
),
);
}
@@ -74,6 +75,8 @@ class phpbb_extension_extension_base_test extends phpbb_test_case
public function test_suffix_get_classes($extension_name, $expected)
{
$extension = $this->extension_manager->get_extension($extension_name);
$this->assertEquals($expected, self::$reflection_method_get_migration_file_list->invoke($extension));
$migration_classes = self::$reflection_method_get_migration_file_list->invoke($extension);
sort($migration_classes);
$this->assertEquals($expected, $migration_classes);
}
}