diff --git a/e107_handlers/plugin_class.php b/e107_handlers/plugin_class.php index 4917939b7..f925639b9 100644 --- a/e107_handlers/plugin_class.php +++ b/e107_handlers/plugin_class.php @@ -4222,6 +4222,7 @@ class e107plugin { case 'install': // Add all active extended fields case 'upgrade': + case 'refresh': if (!$remove) { diff --git a/e107_tests/tests/unit/pluginsTest.php b/e107_tests/tests/unit/pluginsTest.php index 87ed3c0cd..506babf80 100644 --- a/e107_tests/tests/unit/pluginsTest.php +++ b/e107_tests/tests/unit/pluginsTest.php @@ -468,6 +468,33 @@ $this->pluginUninstall('tagcloud'); } + + + public function testRefreshExtendedFields() + { + + $this->pluginInstall('_blank'); + $count = e107::getDb()->count('user_extended_struct', '(*)', "user_extended_struct_name LIKE 'plugin__blank_custom%'"); + $this::assertEquals(1, $count, 'Field was not installed'); + + $this->pluginRefresh('_blank'); + $count = e107::getDb()->count('user_extended_struct', '(*)', "user_extended_struct_name LIKE 'plugin__blank_custom%'"); + $this::assertEquals(1, $count, 'Field was duplicated or is missing'); + + e107::getDb()->delete('user_extended_struct', "user_extended_struct_name LIKE 'plugin__blank_custom%'"); + $count = e107::getDb()->count('user_extended_struct', '(*)', "user_extended_struct_name LIKE 'plugin__blank_custom%'"); + $this::assertEquals(0, $count, 'Field was not deleted'); + $this->pluginRefresh('_blank'); + + $count = e107::getDb()->count('user_extended_struct', '(*)', "user_extended_struct_name LIKE 'plugin__blank_custom%'"); + $this::assertEquals(1, $count, 'Field was not re-installed'); + + $this->pluginUninstall('_blank'); + + + + } + /* public function testThirdParty() { @@ -520,23 +547,6 @@ }*/ - public function testVstore() - { - if(!is_dir(e_PLUGIN."vstore")) - { - return ; - } - - $this->pluginInstall('vstore'); - $this->pluginRefresh('vstore'); - - $links = e107::getDb()->retrieve('links', '*', 'link_owner = "vstore"', true); - $this->assertNotEmpty($links); - $this->assertCount(2, $links); - - $this->pluginUninstall('vstore'); - - } public function testplugInstalledStatus() {