[ticket/13733] Allow tests the skip class validation

PHPBB3-13733
This commit is contained in:
David King 2015-05-23 21:13:30 -04:00
parent 4ecc13af83
commit 65316cffaf
2 changed files with 19 additions and 14 deletions

View file

@ -121,9 +121,11 @@ class base implements \phpbb\extension\extension_interface
/** /**
* Get the list of migration files from this extension * Get the list of migration files from this extension
* *
* @var bool $validate_classes Whether or not to check that the migration
* class exists and extends the base migration class.
* @return array * @return array
*/ */
protected function get_migration_file_list() protected function get_migration_file_list($validate_classes = true)
{ {
if ($this->migrations !== false) if ($this->migrations !== false)
{ {
@ -137,6 +139,8 @@ class base implements \phpbb\extension\extension_interface
$migrations = $this->extension_finder->get_classes_from_files($migrations); $migrations = $this->extension_finder->get_classes_from_files($migrations);
if ($validate_classes)
{
foreach ($migrations as $key => $migration) foreach ($migrations as $key => $migration)
{ {
// If the class exists and is a subclass of the // If the class exists and is a subclass of the
@ -155,6 +159,7 @@ class base implements \phpbb\extension\extension_interface
unset($migrations[$key]); unset($migrations[$key]);
} }
}
return $migrations; return $migrations;
} }

View file

@ -74,6 +74,6 @@ class phpbb_extension_extension_base_test extends phpbb_test_case
public function test_suffix_get_classes($extension_name, $expected) public function test_suffix_get_classes($extension_name, $expected)
{ {
$extension = $this->extension_manager->get_extension($extension_name); $extension = $this->extension_manager->get_extension($extension_name);
$this->assertEquals($expected, self::$reflection_method_get_migration_file_list->invoke($extension)); $this->assertEquals($expected, self::$reflection_method_get_migration_file_list->invoke($extension, false));
} }
} }