diff options
author | Marc Alexander <admin@m-a-styles.de> | 2016-01-19 23:32:07 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2016-01-19 23:32:07 +0100 |
commit | 0defce65c8ade296523cd9f5788c2abf43c73513 (patch) | |
tree | 94e614fdcbf8a6416191773c14746129a6b22f55 | |
parent | e954b0b82b9fe873211bdd8885aefb78284f0893 (diff) | |
download | forums-0defce65c8ade296523cd9f5788c2abf43c73513.tar forums-0defce65c8ade296523cd9f5788c2abf43c73513.tar.gz forums-0defce65c8ade296523cd9f5788c2abf43c73513.tar.bz2 forums-0defce65c8ade296523cd9f5788c2abf43c73513.tar.xz forums-0defce65c8ade296523cd9f5788c2abf43c73513.zip |
[ticket/13733] Properly test setting validate_classes to false/true
PHPBB3-13733
-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)); } } |