aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PluginManagerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/PluginManagerTest.php')
-rw-r--r--tests/PluginManagerTest.php29
1 files changed, 23 insertions, 6 deletions
diff --git a/tests/PluginManagerTest.php b/tests/PluginManagerTest.php
index 195d959c..a5d5dbe9 100644
--- a/tests/PluginManagerTest.php
+++ b/tests/PluginManagerTest.php
@@ -25,7 +25,7 @@ class PluginManagerTest extends \PHPUnit\Framework\TestCase
25 */ 25 */
26 protected $pluginManager; 26 protected $pluginManager;
27 27
28 public function setUp() 28 public function setUp(): void
29 { 29 {
30 $conf = new ConfigManager(''); 30 $conf = new ConfigManager('');
31 $this->pluginManager = new PluginManager($conf); 31 $this->pluginManager = new PluginManager($conf);
@@ -33,10 +33,8 @@ class PluginManagerTest extends \PHPUnit\Framework\TestCase
33 33
34 /** 34 /**
35 * Test plugin loading and hook execution. 35 * Test plugin loading and hook execution.
36 *
37 * @return void
38 */ 36 */
39 public function testPlugin() 37 public function testPlugin(): void
40 { 38 {
41 PluginManager::$PLUGINS_PATH = self::$pluginPath; 39 PluginManager::$PLUGINS_PATH = self::$pluginPath;
42 $this->pluginManager->load(array(self::$pluginName)); 40 $this->pluginManager->load(array(self::$pluginName));
@@ -57,9 +55,28 @@ class PluginManagerTest extends \PHPUnit\Framework\TestCase
57 } 55 }
58 56
59 /** 57 /**
58 * Test plugin loading and hook execution with an error: raise an incompatibility error.
59 */
60 public function testPluginWithPhpError(): void
61 {
62 PluginManager::$PLUGINS_PATH = self::$pluginPath;
63 $this->pluginManager->load(array(self::$pluginName));
64
65 $this->assertTrue(function_exists('hook_test_error'));
66
67 $data = [];
68 $this->pluginManager->executeHooks('error', $data);
69
70 $this->assertSame(
71 'test [plugin incompatibility]: Class \'Unknown\' not found',
72 $this->pluginManager->getErrors()[0]
73 );
74 }
75
76 /**
60 * Test missing plugin loading. 77 * Test missing plugin loading.
61 */ 78 */
62 public function testPluginNotFound() 79 public function testPluginNotFound(): void
63 { 80 {
64 $this->pluginManager->load(array()); 81 $this->pluginManager->load(array());
65 $this->pluginManager->load(array('nope', 'renope')); 82 $this->pluginManager->load(array('nope', 'renope'));
@@ -69,7 +86,7 @@ class PluginManagerTest extends \PHPUnit\Framework\TestCase
69 /** 86 /**
70 * Test plugin metadata loading. 87 * Test plugin metadata loading.
71 */ 88 */
72 public function testGetPluginsMeta() 89 public function testGetPluginsMeta(): void
73 { 90 {
74 PluginManager::$PLUGINS_PATH = self::$pluginPath; 91 PluginManager::$PLUGINS_PATH = self::$pluginPath;
75 $this->pluginManager->load(array(self::$pluginName)); 92 $this->pluginManager->load(array(self::$pluginName));