mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-18 15:39:53 +00:00
Improving test coverage for CakePlugin
This commit is contained in:
parent
4f1a6baf87
commit
46d994c3f0
1 changed files with 41 additions and 0 deletions
|
@ -140,6 +140,12 @@ class CakePluginTest extends CakeTestCase {
|
||||||
$this->assertEquals('loaded plugin bootstrap', Configure::read('CakePluginTest.test_plugin.bootstrap'));
|
$this->assertEquals('loaded plugin bootstrap', Configure::read('CakePluginTest.test_plugin.bootstrap'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that it is possible to load plugin bootstrap by calling a callback function
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function testCallbackBootstrap() {
|
public function testCallbackBootstrap() {
|
||||||
CakePlugin::load('TestPlugin', array('bootstrap' => array($this, 'pluginBootstrap')));
|
CakePlugin::load('TestPlugin', array('bootstrap' => array($this, 'pluginBootstrap')));
|
||||||
$expected = array('TestPlugin');
|
$expected = array('TestPlugin');
|
||||||
|
@ -157,6 +163,41 @@ class CakePluginTest extends CakeTestCase {
|
||||||
CakePlugin::load(array('TestPlugin', 'TestPluginTwo'), array('bootstrap' => true, 'routes' => true));
|
CakePlugin::load(array('TestPlugin', 'TestPluginTwo'), array('bootstrap' => true, 'routes' => true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that CakePlugin::load() throws an exception on unknown plugin
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @expectedException MissingPluginException
|
||||||
|
*/
|
||||||
|
public function testLoadNotFound() {
|
||||||
|
CakePlugin::load('MissingPlugin');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that CakePlugin::path() returns the correct path for the loaded plugins
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testPath() {
|
||||||
|
CakePlugin::load(array('TestPlugin', 'TestPluginTwo'));
|
||||||
|
$expected = CAKE_TESTS . 'test_app' . DS . 'plugins' . DS . 'test_plugin' . DS;
|
||||||
|
$this->assertEquals(CakePlugin::path('TestPlugin'), $expected);
|
||||||
|
|
||||||
|
$expected = CAKE_TESTS . 'test_app' . DS . 'plugins' . DS . 'test_plugin_two' . DS;
|
||||||
|
$this->assertEquals(CakePlugin::path('TestPluginTwo'), $expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that CakePlugin::path() throws an exception on unknown plugin
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @expectedException MissingPluginException
|
||||||
|
*/
|
||||||
|
public function testPathNotFound() {
|
||||||
|
CakePlugin::path('TestPlugin');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Auxiliary function to test plugin bootstrap callbacks
|
* Auxiliary function to test plugin bootstrap callbacks
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue