diff options
-rw-r--r-- | tests/extension/ext/vendor2/bar/migrations/bar.php | 7 | ||||
-rw-r--r-- | tests/extension/ext/vendor2/bar/migrations/foo.php | 54 | ||||
-rw-r--r-- | tests/extension/extension_base_test.php | 17 |
3 files changed, 76 insertions, 2 deletions
diff --git a/tests/extension/ext/vendor2/bar/migrations/bar.php b/tests/extension/ext/vendor2/bar/migrations/bar.php new file mode 100644 index 0000000000..ea5ddb6b8b --- /dev/null +++ b/tests/extension/ext/vendor2/bar/migrations/bar.php @@ -0,0 +1,7 @@ +<?php + +namespace vendor2\foo\migrations; + +class bar +{ +} diff --git a/tests/extension/ext/vendor2/bar/migrations/foo.php b/tests/extension/ext/vendor2/bar/migrations/foo.php new file mode 100644 index 0000000000..d727c2f954 --- /dev/null +++ b/tests/extension/ext/vendor2/bar/migrations/foo.php @@ -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(); + } +} diff --git a/tests/extension/extension_base_test.php b/tests/extension/extension_base_test.php index 898c11d902..1e74efc1fa 100644 --- a/tests/extension/extension_base_test.php +++ b/tests/extension/extension_base_test.php @@ -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,19 +64,29 @@ class phpbb_extension_extension_base_test extends phpbb_test_case return array( array( 'vendor2/bar', + false, array( + '\vendor2\bar\migrations\bar', + '\vendor2\bar\migrations\foo', '\vendor2\bar\migrations\migration', ), ), + array( + 'vendor2/bar', + true, + array( + 2 => '\vendor2\bar\migrations\migration', + ), + ), ); } /** * @dataProvider data_test_suffix_get_classes */ - public function test_suffix_get_classes($extension_name, $expected) + public function test_suffix_get_classes($extension_name, $validate_classes, $expected) { $extension = $this->extension_manager->get_extension($extension_name); - $this->assertEquals($expected, self::$reflection_method_get_migration_file_list->invoke($extension, false)); + $this->assertEquals($expected, self::$reflection_method_get_migration_file_list->invoke($extension, $validate_classes)); } } |