parent
cc351c1a02
commit
870917fdeb
|
@ -150,6 +150,16 @@ class Config
|
|||
throw new ConfigException("Could not load config. File $configName not found", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the directories. Automatically gets invoked if configPaths are added to FuzeWorks\Configurator.
|
||||
*
|
||||
* @param array $directories
|
||||
*/
|
||||
public function setDirectories(array $directories)
|
||||
{
|
||||
$this->configPaths = $directories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a path where config files can be found
|
||||
*
|
||||
|
|
|
@ -93,6 +93,6 @@ class ConfigORM extends ConfigORMAbstract
|
|||
|
||||
return true;
|
||||
}
|
||||
throw new ConfigException("Could not write config file. $file is not writable", 1);
|
||||
throw new ConfigException("Could not write config file. $this->file is not writable", 1);
|
||||
}
|
||||
}
|
|
@ -157,12 +157,13 @@ class Events
|
|||
*
|
||||
* The Event gets created, passed around and then returned to the issuer.
|
||||
*
|
||||
* @param mixed $input Object for direct event, string for system event or notifierEvent
|
||||
* @param mixed $parameters,... Parameters for the event
|
||||
* @param mixed $input Object for direct event, string for system event or notifierEvent
|
||||
* @param mixed $parameters,... Parameters for the event
|
||||
* @todo Implement Application Events
|
||||
* @todo Implement Directory input for Events from other locations (like Modules)
|
||||
*
|
||||
* @return Event The Event
|
||||
* @throws EventException
|
||||
*/
|
||||
public static function fireEvent($input): Event
|
||||
{
|
||||
|
|
|
@ -171,16 +171,27 @@ class Helpers
|
|||
/**
|
||||
* Alias for load
|
||||
* @see load() for more details
|
||||
*
|
||||
* @param string $helperName Name of the helper
|
||||
* @param string|null $directory Directory to load the helper from, will ignore $helperPaths
|
||||
*
|
||||
* @param string $helperName Name of the helper
|
||||
* @param string|null $directory Directory to load the helper from, will ignore $helperPaths
|
||||
* @return bool Whether the helper was succesfully loaded (true if yes)
|
||||
* @throws HelperException
|
||||
*/
|
||||
public function get($helperName, $directory = null): bool
|
||||
{
|
||||
return $this->load($helperName, $directory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the directories. Automatically gets invoked if helperPaths are added to FuzeWorks\Configurator.
|
||||
*
|
||||
* @param array $directories
|
||||
*/
|
||||
public function setDirectories(array $directories)
|
||||
{
|
||||
$this->helperPaths = $directories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a path where helpers can be found
|
||||
*
|
||||
|
|
|
@ -285,6 +285,16 @@ class Plugins
|
|||
return $this->plugins[$pluginName];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the directories. Automatically gets invoked if pluginPaths are added to FuzeWorks\Configurator.
|
||||
*
|
||||
* @param array $directories
|
||||
*/
|
||||
public function setDirectories(array $directories)
|
||||
{
|
||||
$this->pluginPaths = $directories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a path where plugins can be found
|
||||
*
|
||||
|
|
|
@ -43,6 +43,10 @@ use FuzeWorks\Config;
|
|||
*/
|
||||
class configTest extends CoreTestAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Config
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
public function setUp()
|
||||
|
@ -127,4 +131,13 @@ class configTest extends CoreTestAbstract
|
|||
$this->assertEquals($config2->key, 'other_value');
|
||||
}
|
||||
|
||||
public function testSetDirectories()
|
||||
{
|
||||
// Add the directory
|
||||
$directory = 'tests' . DS . 'config';
|
||||
$this->config->setDirectories([$directory]);
|
||||
|
||||
$this->assertEquals([$directory], $this->config->getConfigPaths());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
*/
|
||||
|
||||
use FuzeWorks\Factory;
|
||||
use FuzeWorks\Helpers;
|
||||
|
||||
/**
|
||||
* Class HelperTest.
|
||||
|
@ -44,6 +45,9 @@ use FuzeWorks\Factory;
|
|||
class helperTest extends CoreTestAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Helpers
|
||||
*/
|
||||
protected $helpers;
|
||||
|
||||
public function setUp()
|
||||
|
@ -113,4 +117,13 @@ class helperTest extends CoreTestAbstract
|
|||
// And test if it's gone again
|
||||
$this->assertFalse(in_array('tests'.DS.'helpers'.DS.'testRemoveHelperPath', $this->helpers->getHelperPaths()));
|
||||
}
|
||||
|
||||
public function testSetDirectories()
|
||||
{
|
||||
// Add the directory
|
||||
$directory = 'tests' . DS . 'helpers';
|
||||
$this->helpers->setDirectories([$directory]);
|
||||
|
||||
$this->assertEquals([$directory], $this->helpers->getHelperPaths());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -210,6 +210,15 @@ class pluginTest extends CoreTestAbstract
|
|||
$this->assertFalse(in_array('tests'.DS.'plugins'.DS.'testRemovePluginPath', $this->plugins->getPluginPaths()));
|
||||
}
|
||||
|
||||
public function testSetDirectories()
|
||||
{
|
||||
// Add the directory
|
||||
$directory = 'tests' . DS . 'helpers';
|
||||
$this->plugins->setDirectories([$directory]);
|
||||
|
||||
$this->assertEquals([$directory], $this->plugins->getPluginPaths());
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
$factory = Factory::getInstance();
|
||||
|
|
Loading…
Reference in New Issue