diff --git a/lib/Alchemy/Phrasea/Vocabulary/Controller.php b/lib/Alchemy/Phrasea/Vocabulary/Controller.php index feb8b02f9b..3c52f7fec3 100644 --- a/lib/Alchemy/Phrasea/Vocabulary/Controller.php +++ b/lib/Alchemy/Phrasea/Vocabulary/Controller.php @@ -31,7 +31,7 @@ class Controller */ public static function get($type) { - $classname = 'ControlProvider\\' . $type; + $classname = __NAMESPACE__ . '\\ControlProvider\\' . $type . 'Provider'; if (!class_exists($classname)) { diff --git a/lib/unitTest/Alchemy/Phrasea/Vocabulary/ControllerTest.php b/lib/unitTest/Alchemy/Phrasea/Vocabulary/ControllerTest.php new file mode 100644 index 0000000000..6a5d71f999 --- /dev/null +++ b/lib/unitTest/Alchemy/Phrasea/Vocabulary/ControllerTest.php @@ -0,0 +1,41 @@ +assertInstanceOf('\\Alchemy\\Phrasea\\Vocabulary\\ControlProvider\\UserProvider', $provider); + + try + { + $provider = \Alchemy\Phrasea\Vocabulary\Controller::get('Zebulon'); + $this->fail('Should raise an exception'); + } + catch(\Exception $e) + { + + } + } + + public function testGetAvailable() + { + $available = \Alchemy\Phrasea\Vocabulary\Controller::getAvailable(); + + $this->assertTrue(is_array($available)); + + foreach($available as $controller) + { + $this->assertInstanceOf('\\Alchemy\\Phrasea\\Vocabulary\\ControlProvider\\ControlProviderInterface', $controller); + } + } + +}