Implemented @covers in all unit tests. Code coverage now shows better what is actually covered and what is not.
This commit is contained in:
parent
f364245d90
commit
e10d84b65d
|
@ -115,6 +115,18 @@ abstract class ConfigORMAbstract implements Iterator
|
|||
return $this->cfg[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a value from a config file.
|
||||
*
|
||||
* @param string $name Key of the requested entry
|
||||
* @return mixed Value of the requested entry
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function get($name)
|
||||
{
|
||||
return $this->cfg[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an entry in the config file.
|
||||
*
|
||||
|
@ -127,6 +139,18 @@ abstract class ConfigORMAbstract implements Iterator
|
|||
$this->cfg[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an entry in the config file.
|
||||
*
|
||||
* @param string $name Key of the entry
|
||||
* @param mixed $value Value of the entry
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function set($name, $value)
|
||||
{
|
||||
$this->cfg[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset a value in a config file.
|
||||
*
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
namespace FuzeWorks;
|
||||
use FuzeWorks\Exception\ConfiguratorException;
|
||||
use FuzeWorks\Exception\InvalidArgumentException;
|
||||
use Tracy\Debugger;
|
||||
|
||||
/**
|
||||
* Class Configurator.
|
||||
|
@ -383,7 +382,7 @@ class Configurator
|
|||
}
|
||||
}
|
||||
|
||||
$container->init();
|
||||
$container->initFactory();
|
||||
return $container;
|
||||
}
|
||||
}
|
|
@ -76,7 +76,7 @@ class Factory
|
|||
*
|
||||
* @var bool Clone all Factory instances.
|
||||
*/
|
||||
protected static $cloneInstances = false;
|
||||
private static $cloneInstances = false;
|
||||
|
||||
/**
|
||||
* Whether the Factory has been initialized or not
|
||||
|
@ -158,7 +158,7 @@ class Factory
|
|||
* @return Factory
|
||||
* @throws CoreException
|
||||
*/
|
||||
public function init(): Factory
|
||||
public function initFactory(): Factory
|
||||
{
|
||||
// If already initialized, cancel
|
||||
if ($this->initialized)
|
||||
|
@ -172,7 +172,7 @@ class Factory
|
|||
}
|
||||
|
||||
// Disable events if requested to do so
|
||||
if (!$cfg->enable_events)
|
||||
if (!$cfg->get('enable_events'))
|
||||
{
|
||||
Events::disable();
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ class Logger {
|
|||
|
||||
// Register the error handler, Untestable
|
||||
// @codeCoverageIgnoreStart
|
||||
if ($cfg_error->fuzeworks_error_reporting == true)
|
||||
if ($cfg_error->get('fuzeworks_error_reporting') == true)
|
||||
{
|
||||
self::enableHandlers();
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@ class Plugins
|
|||
* Called upon creation of the plugins class.
|
||||
*
|
||||
* @return void
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
|
|
@ -40,11 +40,12 @@ use FuzeWorks\ConfigORM\ConfigORMAbstract;
|
|||
* Class ConfigORMAbstractTest
|
||||
*
|
||||
* Config testing suite, will test the special methods from ConfigORMAbstract
|
||||
* @coversDefaultClass \FuzeWorks\ConfigORM\ConfigORMAbstract
|
||||
*/
|
||||
class ConfigORMAbstractTest extends CoreTestAbstract
|
||||
{
|
||||
/**
|
||||
* @covers \FuzeWorks\ConfigORM\ConfigORMAbstract::revert
|
||||
* @covers ::revert
|
||||
*/
|
||||
public function testRevert()
|
||||
{
|
||||
|
@ -69,7 +70,7 @@ class ConfigORMAbstractTest extends CoreTestAbstract
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \FuzeWorks\ConfigORM\ConfigORMAbstract::replace
|
||||
* @covers ::replace
|
||||
*/
|
||||
public function testReplaceWithNewValues()
|
||||
{
|
||||
|
@ -97,7 +98,7 @@ class ConfigORMAbstractTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testReplaceWithNewValues
|
||||
* @covers \FuzeWorks\ConfigORM\ConfigORMAbstract::replace
|
||||
* @covers ::replace
|
||||
*/
|
||||
public function testReplaceExistingValues()
|
||||
{
|
||||
|
@ -125,7 +126,7 @@ class ConfigORMAbstractTest extends CoreTestAbstract
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \FuzeWorks\ConfigORM\ConfigORMAbstract::toArray
|
||||
* @covers ::toArray
|
||||
*/
|
||||
public function testToArray()
|
||||
{
|
||||
|
@ -144,7 +145,7 @@ class ConfigORMAbstractTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testToArray
|
||||
* @covers \FuzeWorks\ConfigORM\ConfigORMAbstract::clear
|
||||
* @covers ::clear
|
||||
*/
|
||||
public function testClear()
|
||||
{
|
||||
|
|
|
@ -43,6 +43,7 @@ use FuzeWorks\Events;
|
|||
* Class ConfigTest.
|
||||
*
|
||||
* Config testing suite, will test basic config functionality while also testing default ORM's
|
||||
* @coversDefaultClass \FuzeWorks\Config
|
||||
*/
|
||||
class configTest extends CoreTestAbstract
|
||||
{
|
||||
|
@ -57,6 +58,9 @@ class configTest extends CoreTestAbstract
|
|||
$this->config = new Config();
|
||||
}
|
||||
|
||||
/**
|
||||
* @coversNothing
|
||||
*/
|
||||
public function testGetConfigClass()
|
||||
{
|
||||
$this->assertInstanceOf('FuzeWorks\Config', $this->config);
|
||||
|
@ -64,8 +68,8 @@ class configTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testGetConfigClass
|
||||
* @covers \FuzeWorks\Config::getConfig
|
||||
* @covers \FuzeWorks\Config::loadConfigFile
|
||||
* @covers ::getConfig
|
||||
* @covers ::loadConfigFile
|
||||
*/
|
||||
public function testLoadConfig()
|
||||
{
|
||||
|
@ -74,8 +78,8 @@ class configTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testLoadConfig
|
||||
* @covers \FuzeWorks\Config::getConfig
|
||||
* @covers \FuzeWorks\Config::loadConfigFile
|
||||
* @covers ::getConfig
|
||||
* @covers ::loadConfigFile
|
||||
*/
|
||||
public function testLoadConfigWithAltDirectory()
|
||||
{
|
||||
|
@ -85,7 +89,7 @@ class configTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testLoadConfig
|
||||
* @covers \FuzeWorks\Config::loadConfigFile
|
||||
* @covers ::loadConfigFile
|
||||
* @expectedException FuzeWorks\Exception\ConfigException
|
||||
*/
|
||||
public function testFileNotFound()
|
||||
|
@ -95,7 +99,7 @@ class configTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testLoadConfig
|
||||
* @covers \FuzeWorks\Config::loadConfigFile
|
||||
* @covers ::loadConfigFile
|
||||
*/
|
||||
public function testLoadConfigCancel()
|
||||
{
|
||||
|
@ -112,7 +116,7 @@ class configTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testLoadConfig
|
||||
* @covers \FuzeWorks\Config::loadConfigFile
|
||||
* @covers ::loadConfigFile
|
||||
*/
|
||||
public function testLoadConfigIntercept()
|
||||
{
|
||||
|
@ -129,8 +133,8 @@ class configTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testLoadConfig
|
||||
* @covers \FuzeWorks\Config::overrideConfig
|
||||
* @covers \FuzeWorks\Config::loadConfigFile
|
||||
* @covers ::overrideConfig
|
||||
* @covers ::loadConfigFile
|
||||
*/
|
||||
public function testLoadConfigOverride()
|
||||
{
|
||||
|
@ -148,8 +152,8 @@ class configTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testLoadConfigOverride
|
||||
* @covers \FuzeWorks\Config::overrideConfig
|
||||
* @covers \FuzeWorks\Config::loadConfigFile
|
||||
* @covers ::overrideConfig
|
||||
* @covers ::loadConfigFile
|
||||
*/
|
||||
public function testLoadConfigCoreOverride()
|
||||
{
|
||||
|
@ -168,7 +172,7 @@ class configTest extends CoreTestAbstract
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \FuzeWorks\Config::getConfig
|
||||
* @covers ::getConfig
|
||||
*/
|
||||
public function testSameConfigObject()
|
||||
{
|
||||
|
|
|
@ -44,6 +44,7 @@ use FuzeWorks\Logger;
|
|||
* Class ConfiguratorTest.
|
||||
*
|
||||
* This test will test the Configurator class
|
||||
* @coversDefaultClass \FuzeWorks\Configurator
|
||||
*/
|
||||
class configuratorTest extends CoreTestAbstract
|
||||
{
|
||||
|
@ -67,11 +68,17 @@ class configuratorTest extends CoreTestAbstract
|
|||
Core::$logDir = dirname(__DIR__) . '/temp';
|
||||
}
|
||||
|
||||
/**
|
||||
* @coversNothing
|
||||
*/
|
||||
public function testGetConfiguratorClass()
|
||||
{
|
||||
$this->assertInstanceOf('FuzeWorks\Configurator', $this->configurator);
|
||||
}
|
||||
|
||||
/**
|
||||
* @coversNothing
|
||||
*/
|
||||
public function testCreateContainer()
|
||||
{
|
||||
$this->assertInstanceOf('FuzeWorks\Factory', $this->configurator->createContainer());
|
||||
|
@ -81,6 +88,8 @@ class configuratorTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testCreateContainer
|
||||
* @covers ::addComponent
|
||||
* @covers ::createContainer
|
||||
*/
|
||||
public function testAddComponent()
|
||||
{
|
||||
|
@ -98,6 +107,8 @@ class configuratorTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testAddComponent
|
||||
* @covers ::addComponent
|
||||
* @covers ::createContainer
|
||||
*/
|
||||
public function testAddComponentClassByObject()
|
||||
{
|
||||
|
@ -117,6 +128,8 @@ class configuratorTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testAddComponent
|
||||
* @covers ::addComponent
|
||||
* @covers ::createContainer
|
||||
* @expectedException FuzeWorks\Exception\ConfiguratorException
|
||||
*/
|
||||
public function testAddComponentFail()
|
||||
|
@ -126,7 +139,7 @@ class configuratorTest extends CoreTestAbstract
|
|||
$component = new FuzeWorks\Component\TestAddComponentFailComponent;
|
||||
$this->configurator->addComponent($component);
|
||||
|
||||
// Create container
|
||||
// Create container and fail
|
||||
$this->configurator->createContainer();
|
||||
}
|
||||
|
||||
|
@ -134,6 +147,8 @@ class configuratorTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testCreateContainer
|
||||
* @covers ::setLogDirectory
|
||||
* @covers ::createContainer
|
||||
*/
|
||||
public function testSetLogDirectory()
|
||||
{
|
||||
|
@ -157,6 +172,7 @@ class configuratorTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testSetLogDirectory
|
||||
* @covers ::setLogDirectory
|
||||
* @expectedException \FuzeWorks\Exception\InvalidArgumentException
|
||||
*/
|
||||
public function testSetLogDirectoryNotDirectory()
|
||||
|
@ -167,6 +183,8 @@ class configuratorTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testCreateContainer
|
||||
* @covers ::setTempDirectory
|
||||
* @covers ::createContainer
|
||||
*/
|
||||
public function testSetTempDirectory()
|
||||
{
|
||||
|
@ -183,6 +201,7 @@ class configuratorTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testSetTempDirectory
|
||||
* @covers ::setTempDirectory
|
||||
* @expectedException \FuzeWorks\Exception\InvalidArgumentException
|
||||
*/
|
||||
public function testSetTempDirectoryNotDirectory()
|
||||
|
@ -194,6 +213,9 @@ class configuratorTest extends CoreTestAbstract
|
|||
/**
|
||||
* @depends testCreateContainer
|
||||
* @depends testAddComponent
|
||||
* @covers ::addComponent
|
||||
* @covers ::addDirectory
|
||||
* @covers ::createContainer
|
||||
*/
|
||||
public function testAddComponentDirectory()
|
||||
{
|
||||
|
@ -222,6 +244,11 @@ class configuratorTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testAddComponent
|
||||
* @covers ::deferComponentClassMethod
|
||||
* @covers ::createContainer
|
||||
* @covers \FuzeWorks\DeferredComponentClass::invoke
|
||||
* @covers \FuzeWorks\DeferredComponentClass::isInvoked
|
||||
* @covers \FuzeWorks\DeferredComponentClass::getResult
|
||||
*/
|
||||
public function testDeferComponentClassMethod()
|
||||
{
|
||||
|
@ -251,6 +278,11 @@ class configuratorTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testDeferComponentClassMethod
|
||||
* @covers ::deferComponentClassMethod
|
||||
* @covers ::createContainer
|
||||
* @covers \FuzeWorks\DeferredComponentClass::invoke
|
||||
* @covers \FuzeWorks\DeferredComponentClass::isInvoked
|
||||
* @covers \FuzeWorks\DeferredComponentClass::getResult
|
||||
*/
|
||||
public function testDeferComponentClassMethodWithCallback()
|
||||
{
|
||||
|
@ -285,6 +317,7 @@ class configuratorTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testCreateContainer
|
||||
* @covers ::setTimeZone
|
||||
*/
|
||||
public function testSetTimezone()
|
||||
{
|
||||
|
@ -298,6 +331,7 @@ class configuratorTest extends CoreTestAbstract
|
|||
/**
|
||||
* @depends testSetTimezone
|
||||
* @expectedException \FuzeWorks\Exception\InvalidArgumentException
|
||||
* @covers ::setTimeZone
|
||||
*/
|
||||
public function testSetTimezoneInvalid()
|
||||
{
|
||||
|
@ -306,6 +340,8 @@ class configuratorTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testCreateContainer
|
||||
* @covers ::setParameters
|
||||
* @covers ::createContainer
|
||||
*/
|
||||
public function testSetParameter()
|
||||
{
|
||||
|
@ -317,6 +353,11 @@ class configuratorTest extends CoreTestAbstract
|
|||
$this->assertEquals('fake_directory', Core::$tempDir);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreateContainer
|
||||
* @covers ::setConfigOverride
|
||||
* @covers ::createContainer
|
||||
*/
|
||||
public function testSetConfigOverride()
|
||||
{
|
||||
// Set an override that can be verified
|
||||
|
@ -333,6 +374,9 @@ class configuratorTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testCreateContainer
|
||||
* @covers ::enableDebugMode
|
||||
* @covers ::isDebugMode
|
||||
* @covers ::createContainer
|
||||
*/
|
||||
public function testEnableDebugMode()
|
||||
{
|
||||
|
@ -355,6 +399,9 @@ class configuratorTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testEnableDebugMode
|
||||
* @covers ::enableDebugMode
|
||||
* @covers ::isDebugMode
|
||||
* @covers ::createContainer
|
||||
*/
|
||||
public function testDisableDebugMode()
|
||||
{
|
||||
|
@ -369,6 +416,9 @@ class configuratorTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testEnableDebugMode
|
||||
* @covers ::setDebugAddress
|
||||
* @covers ::enableDebugMode
|
||||
* @covers ::isDebugMode
|
||||
*/
|
||||
public function testSetDebugAddress()
|
||||
{
|
||||
|
@ -422,6 +472,7 @@ class configuratorTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testEnableDebugMode
|
||||
* @covers ::setDebugAddress
|
||||
* @expectedException \FuzeWorks\Exception\InvalidArgumentException
|
||||
*/
|
||||
public function testSetDebugAddressInvalidArgument()
|
||||
|
|
|
@ -40,6 +40,7 @@ use FuzeWorks\Core;
|
|||
* Class CoreTest.
|
||||
*
|
||||
* Core testing suite, will test basic core functionality
|
||||
* @coversDefaultClass \FuzeWorks\Core
|
||||
*/
|
||||
class coreTest extends CoreTestAbstract
|
||||
{
|
||||
|
@ -63,6 +64,9 @@ class coreTest extends CoreTestAbstract
|
|||
$this->assertTrue(class_exists('FuzeWorks\Priority'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::isPHP
|
||||
*/
|
||||
public function testIsPHP()
|
||||
{
|
||||
$this->assertTrue(Core::isPHP('1.2.0'));
|
||||
|
|
|
@ -41,10 +41,14 @@ use FuzeWorks\Priority;
|
|||
* Class EventTest.
|
||||
*
|
||||
* This test will test the Event class
|
||||
* @coversDefaultClass \FuzeWorks\Event
|
||||
*/
|
||||
class eventTest extends CoreTestAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
* @coversNothing
|
||||
*/
|
||||
public function testFireEvent()
|
||||
{
|
||||
$event = Events::fireEvent('testEvent');
|
||||
|
@ -52,6 +56,11 @@ class eventTest extends CoreTestAbstract
|
|||
$this->assertInstanceOf('FuzeWorks\Event', $event);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testFireEvent
|
||||
* @covers ::isCancelled
|
||||
* @covers ::setCancelled
|
||||
*/
|
||||
public function testCancelEvent()
|
||||
{
|
||||
Events::addListener(array($this, 'listener_cancel'), 'testCancelEvent', Priority::NORMAL);
|
||||
|
@ -60,6 +69,11 @@ class eventTest extends CoreTestAbstract
|
|||
$this->assertTrue($event->isCancelled());
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCancelEvent
|
||||
* @covers ::setCancelled
|
||||
* @covers ::isCancelled
|
||||
*/
|
||||
public function testUncancelEvent()
|
||||
{
|
||||
Events::addListener(array($this, 'listener_cancel'), 'testUncancelEvent', Priority::HIGH);
|
||||
|
|
|
@ -42,20 +42,26 @@ use FuzeWorks\Priority;
|
|||
* Class EventTest.
|
||||
*
|
||||
* This test will test Events
|
||||
* @coversDefaultClass \FuzeWorks\Events
|
||||
*/
|
||||
class eventsTest extends CoreTestAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
* @covers ::fireEvent
|
||||
*/
|
||||
public function testFireEvent()
|
||||
{
|
||||
$mock = $this->getMockBuilder(Observer::class)->setMethods(['mockMethod'])->getMock();
|
||||
$mock->expects($this->once())->method('mockMethod');
|
||||
$mock = $this->getMockBuilder(Observer::class)->setMethods(['mockListener'])->getMock();
|
||||
$mock->expects($this->once())->method('mockListener')->with($this->isInstanceOf('MockEvent'));
|
||||
|
||||
Events::addListener(array($mock, 'mockMethod'), 'mockEvent', Priority::NORMAL);
|
||||
Events::addListener(array($mock, 'mockListener'), 'mockEvent', Priority::NORMAL);
|
||||
Events::fireEvent('mockEvent');
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testFireEvent
|
||||
* @covers ::fireEvent
|
||||
*/
|
||||
public function testObjectEvent()
|
||||
{
|
||||
|
@ -70,6 +76,7 @@ class eventsTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testObjectEvent
|
||||
* @covers ::fireEvent
|
||||
*/
|
||||
public function testVariablePassing()
|
||||
{
|
||||
|
@ -86,6 +93,10 @@ class eventsTest extends CoreTestAbstract
|
|||
Events::fireEvent($event);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testFireEvent
|
||||
* @covers ::fireEvent
|
||||
*/
|
||||
public function testEventArguments()
|
||||
{
|
||||
// Prepare test argument
|
||||
|
@ -101,6 +112,7 @@ class eventsTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testVariablePassing
|
||||
* @covers ::fireEvent
|
||||
*/
|
||||
public function testVariableChanging()
|
||||
{
|
||||
|
@ -134,6 +146,7 @@ class eventsTest extends CoreTestAbstract
|
|||
/**
|
||||
* @depends testFireEvent
|
||||
* @expectedException FuzeWorks\Exception\EventException
|
||||
* @covers ::fireEvent
|
||||
*/
|
||||
public function testInvalidTypeEvent()
|
||||
{
|
||||
|
@ -142,6 +155,7 @@ class eventsTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testFireEvent
|
||||
* @covers ::fireEvent
|
||||
* @expectedException FuzeWorks\Exception\EventException
|
||||
*/
|
||||
public function testInvalidClassEvent()
|
||||
|
@ -151,6 +165,8 @@ class eventsTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testFireEvent
|
||||
* @covers ::addListener
|
||||
* @covers ::removeListener
|
||||
*/
|
||||
public function testAddAndRemoveListener()
|
||||
{
|
||||
|
@ -168,6 +184,7 @@ class eventsTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testAddAndRemoveListener
|
||||
* @covers ::addListener
|
||||
* @expectedException FuzeWorks\Exception\EventException
|
||||
*/
|
||||
public function testAddInvalidPriorityListener()
|
||||
|
@ -177,6 +194,7 @@ class eventsTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testAddAndRemoveListener
|
||||
* @covers ::addListener
|
||||
* @expectedException FuzeWorks\Exception\EventException
|
||||
*/
|
||||
public function testAddInvalidNameListener()
|
||||
|
@ -186,6 +204,7 @@ class eventsTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testAddAndRemoveListener
|
||||
* @covers ::removeListener
|
||||
* @expectedException FuzeWorks\Exception\EventException
|
||||
*/
|
||||
public function testRemoveInvalidPriorityListener()
|
||||
|
@ -195,6 +214,7 @@ class eventsTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testAddAndRemoveListener
|
||||
* @covers ::removeListener
|
||||
*/
|
||||
public function testRemoveUnsetEventListener()
|
||||
{
|
||||
|
@ -203,6 +223,7 @@ class eventsTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testAddAndRemoveListener
|
||||
* @covers ::removeListener
|
||||
*/
|
||||
public function testRemoveUnsetListener()
|
||||
{
|
||||
|
@ -212,6 +233,7 @@ class eventsTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testAddAndRemoveListener
|
||||
* @covers ::addListener
|
||||
*/
|
||||
public function testListenerVariablePass()
|
||||
{
|
||||
|
@ -228,6 +250,11 @@ class eventsTest extends CoreTestAbstract
|
|||
Events::fireEvent($event);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testFireEvent
|
||||
* @covers ::disable
|
||||
* @covers ::fireEvent
|
||||
*/
|
||||
public function testDisable()
|
||||
{
|
||||
// First add the listener, expect it to be never called
|
||||
|
@ -242,6 +269,11 @@ class eventsTest extends CoreTestAbstract
|
|||
Events::fireEvent('mockEvent');
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testDisable
|
||||
* @covers ::disable
|
||||
* @covers ::enable
|
||||
*/
|
||||
public function testReEnable()
|
||||
{
|
||||
// First add the listener, expect it to be never called
|
||||
|
|
|
@ -41,9 +41,14 @@ use FuzeWorks\Exception\FactoryException;
|
|||
* Class FactoryTest.
|
||||
*
|
||||
* Will test the FuzeWorks Factory.
|
||||
* @coversDefaultClass \FuzeWorks\Factory
|
||||
*/
|
||||
class factoryTest extends CoreTestAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
* @covers ::getInstance
|
||||
*/
|
||||
public function testCanLoadFactory()
|
||||
{
|
||||
$this->assertInstanceOf('FuzeWorks\Factory', Factory::getInstance());
|
||||
|
@ -51,6 +56,7 @@ class factoryTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testCanLoadFactory
|
||||
* @covers ::getInstance
|
||||
*/
|
||||
public function testLoadSameInstance()
|
||||
{
|
||||
|
@ -59,6 +65,8 @@ class factoryTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testCanLoadFactory
|
||||
* @covers ::getInstance
|
||||
* @covers ::cloneInstance
|
||||
*/
|
||||
public function testLoadDifferentInstance()
|
||||
{
|
||||
|
@ -71,6 +79,8 @@ class factoryTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testCanLoadFactory
|
||||
* @covers ::getInstance
|
||||
* @covers ::setInstance
|
||||
*/
|
||||
public function testObjectsSameInstance()
|
||||
{
|
||||
|
@ -97,6 +107,9 @@ class factoryTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testObjectsSameInstance
|
||||
* @covers ::getInstance
|
||||
* @covers ::setInstance
|
||||
* @covers ::cloneInstance
|
||||
*/
|
||||
public function testObjectsDifferentInstance()
|
||||
{
|
||||
|
@ -117,6 +130,9 @@ class factoryTest extends CoreTestAbstract
|
|||
$factory3 = Factory::getInstance(true)->setInstance('Mock', $mock);
|
||||
$factory4 = Factory::getInstance(true)->setInstance('Mock', $mock);
|
||||
|
||||
// Should be same for now
|
||||
$this->assertSame($factory3->mock, $factory4->mock);
|
||||
|
||||
// Clone the instance in factory4
|
||||
$factory4->cloneInstance('Mock');
|
||||
|
||||
|
@ -125,6 +141,8 @@ class factoryTest extends CoreTestAbstract
|
|||
}
|
||||
|
||||
/**
|
||||
* @depends testCanLoadFactory
|
||||
* @covers ::cloneInstance
|
||||
* @expectedException FuzeWorks\Exception\FactoryException
|
||||
*/
|
||||
public function testCloneInstanceWrongClassname()
|
||||
|
@ -136,6 +154,13 @@ class factoryTest extends CoreTestAbstract
|
|||
$factory->cloneInstance('fake');
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCanLoadFactory
|
||||
* @covers ::enableCloneInstances
|
||||
* @covers ::disableCloneInstances
|
||||
* @covers ::cloneInstance
|
||||
* @covers ::getInstance
|
||||
*/
|
||||
public function testGlobalCloneInstance()
|
||||
{
|
||||
// First test without global cloning
|
||||
|
@ -154,6 +179,11 @@ class factoryTest extends CoreTestAbstract
|
|||
$this->assertSame(Factory::getInstance(), Factory::getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCanLoadFactory
|
||||
* @covers ::getInstance
|
||||
* @covers ::newInstance
|
||||
*/
|
||||
public function testNewFactoryInstance()
|
||||
{
|
||||
// Load the different factories
|
||||
|
@ -176,6 +206,8 @@ class factoryTest extends CoreTestAbstract
|
|||
}
|
||||
|
||||
/**
|
||||
* @depends testNewFactoryInstance
|
||||
* @covers ::newInstance
|
||||
* @expectedException FuzeWorks\Exception\FactoryException
|
||||
*/
|
||||
public function testFactoryNewInstanceNotExist()
|
||||
|
@ -188,6 +220,8 @@ class factoryTest extends CoreTestAbstract
|
|||
}
|
||||
|
||||
/**
|
||||
* @depends testNewFactoryInstance
|
||||
* @covers ::newInstance
|
||||
* @expectedException FuzeWorks\Exception\FactoryException
|
||||
*/
|
||||
public function testFactoryNewInstanceWrongNamespace()
|
||||
|
@ -199,6 +233,11 @@ class factoryTest extends CoreTestAbstract
|
|||
$factory->newInstance('helpers', 'Test\\');
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testNewFactoryInstance
|
||||
* @covers ::setInstance
|
||||
* @covers ::removeInstance
|
||||
*/
|
||||
public function testRemoveInstance()
|
||||
{
|
||||
// Load the factory
|
||||
|
@ -222,6 +261,8 @@ class factoryTest extends CoreTestAbstract
|
|||
}
|
||||
|
||||
/**
|
||||
* @depends testRemoveInstance
|
||||
* @covers ::removeInstance
|
||||
* @expectedException FuzeWorks\Exception\FactoryException
|
||||
*/
|
||||
public function testRemoveInstanceNotExist()
|
||||
|
@ -233,6 +274,11 @@ class factoryTest extends CoreTestAbstract
|
|||
$factory->removeInstance('fake');
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCanLoadFactory
|
||||
* @covers ::instanceIsset
|
||||
* @covers ::setInstance
|
||||
*/
|
||||
public function testInstanceIsset()
|
||||
{
|
||||
// Load the factory
|
||||
|
|
|
@ -42,6 +42,7 @@ use FuzeWorks\Helpers;
|
|||
* Class HelperTest.
|
||||
*
|
||||
* Helpers testing suite, will test basic loading of Helpers
|
||||
* @coversDefaultClass \FuzeWorks\Helpers
|
||||
*/
|
||||
class helperTest extends CoreTestAbstract
|
||||
{
|
||||
|
@ -58,13 +59,16 @@ class helperTest extends CoreTestAbstract
|
|||
$this->helpers->setDirectories([3 => ['test' . DS . 'helpers']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @coversNothing
|
||||
*/
|
||||
public function testGetHelpersClass()
|
||||
{
|
||||
$this->assertInstanceOf('FuzeWorks\Helpers', $this->helpers);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FuzeWorks\Helpers::load
|
||||
* @covers ::load
|
||||
*/
|
||||
public function testLoadHelper()
|
||||
{
|
||||
|
@ -80,7 +84,7 @@ class helperTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testLoadHelper
|
||||
* @covers \FuzeWorks\Helpers::load
|
||||
* @covers ::load
|
||||
*/
|
||||
public function testLoadHelperWithoutSubdirectory()
|
||||
{
|
||||
|
@ -96,7 +100,7 @@ class helperTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testLoadHelper
|
||||
* @covers \FuzeWorks\Helpers::load
|
||||
* @covers ::load
|
||||
*/
|
||||
public function testLoadHelperWithAltDirectory()
|
||||
{
|
||||
|
@ -112,7 +116,7 @@ class helperTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testLoadHelper
|
||||
* @covers \FuzeWorks\Helpers::load
|
||||
* @covers ::load
|
||||
*/
|
||||
public function testReloadHelper()
|
||||
{
|
||||
|
@ -134,7 +138,7 @@ class helperTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testLoadHelper
|
||||
* @covers \FuzeWorks\Helpers::load
|
||||
* @covers ::load
|
||||
*/
|
||||
public function testCancelLoadHelper()
|
||||
{
|
||||
|
@ -152,7 +156,7 @@ class helperTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testLoadHelper
|
||||
* @covers \FuzeWorks\Helpers::get
|
||||
* @covers ::get
|
||||
*/
|
||||
public function testGetHelper()
|
||||
{
|
||||
|
|
|
@ -42,6 +42,7 @@ use FuzeWorks\Libraries;
|
|||
* Class LibraryTest.
|
||||
*
|
||||
* Libraries testing suite, will test basic loading of and management of Libraries
|
||||
* @coversDefaultClass \FuzeWorks\Libraries
|
||||
*/
|
||||
class libraryTest extends CoreTestAbstract
|
||||
{
|
||||
|
@ -60,6 +61,9 @@ class libraryTest extends CoreTestAbstract
|
|||
$this->libraries->setDirectories([3 => ['test'.DS.'libraries']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @coversNothing
|
||||
*/
|
||||
public function testLibrariesClass()
|
||||
{
|
||||
$this->assertInstanceOf('FuzeWorks\Libraries', $this->libraries);
|
||||
|
@ -69,6 +73,8 @@ class libraryTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testLibrariesClass
|
||||
* @covers ::get
|
||||
* @covers ::initLibrary
|
||||
*/
|
||||
public function testGetLibraryFromDirectory()
|
||||
{
|
||||
|
@ -77,6 +83,8 @@ class libraryTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testGetLibraryFromDirectory
|
||||
* @covers ::get
|
||||
* @covers ::initLibrary
|
||||
*/
|
||||
public function testGetLibraryFromSubdirectory()
|
||||
{
|
||||
|
@ -88,6 +96,8 @@ class libraryTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testGetLibraryFromDirectory
|
||||
* @covers ::get
|
||||
* @covers ::initLibrary
|
||||
*/
|
||||
public function testGetLibraryFromAltDirectory()
|
||||
{
|
||||
|
@ -97,6 +107,9 @@ class libraryTest extends CoreTestAbstract
|
|||
}
|
||||
|
||||
/**
|
||||
* @depends testGetLibraryFromDirectory
|
||||
* @covers ::get
|
||||
* @covers ::initLibrary
|
||||
* @expectedException FuzeWorks\Exception\LibraryException
|
||||
*/
|
||||
public function testGetLibraryFail()
|
||||
|
@ -105,6 +118,9 @@ class libraryTest extends CoreTestAbstract
|
|||
}
|
||||
|
||||
/**
|
||||
* @depends testGetLibraryFromDirectory
|
||||
* @covers ::get
|
||||
* @covers ::initLibrary
|
||||
* @expectedException FuzeWorks\Exception\LibraryException
|
||||
*/
|
||||
public function testGetLibraryNoName()
|
||||
|
@ -113,6 +129,9 @@ class libraryTest extends CoreTestAbstract
|
|||
}
|
||||
|
||||
/**
|
||||
* @depends testGetLibraryFromDirectory
|
||||
* @covers ::get
|
||||
* @covers ::initLibrary
|
||||
* @expectedException FuzeWorks\Exception\LibraryException
|
||||
*/
|
||||
public function testGetLibraryNoClass()
|
||||
|
@ -120,6 +139,11 @@ class libraryTest extends CoreTestAbstract
|
|||
$this->libraries->get('TestGetLibraryNoClass');
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testGetLibraryFromDirectory
|
||||
* @covers ::get
|
||||
* @covers ::initLibrary
|
||||
*/
|
||||
public function testGetLibraryParametersFromConfig()
|
||||
{
|
||||
// Prepare the config file
|
||||
|
@ -137,6 +161,10 @@ class libraryTest extends CoreTestAbstract
|
|||
|
||||
/* ---------------------------------- Add libraries --------------------------------------------- */
|
||||
|
||||
/**
|
||||
* @covers ::addLibraryObject
|
||||
* @covers ::get
|
||||
*/
|
||||
public function testAddLibraryObject()
|
||||
{
|
||||
$this->libraries->addLibraryObject('TestAddLibraryObject', 5);
|
||||
|
@ -144,6 +172,10 @@ class libraryTest extends CoreTestAbstract
|
|||
$this->assertEquals(5, $this->libraries->get('TestAddLibraryObject'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::addLibraryClass
|
||||
* @covers ::get
|
||||
*/
|
||||
public function testAddLibraryClass()
|
||||
{
|
||||
require_once('test'.DS.'libraries'.DS.'TestAddLibraryClass'.DS.'TestAddLibraryClass.php');
|
||||
|
@ -155,6 +187,7 @@ class libraryTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testAddLibraryClass
|
||||
* @covers ::addLibraryClass
|
||||
* @expectedException \FuzeWorks\Exception\LibraryException
|
||||
*/
|
||||
public function testAddLibraryClassFail()
|
||||
|
|
|
@ -43,6 +43,7 @@ use FuzeWorks\Exception\LoggerException;
|
|||
* Class ModelTest.
|
||||
*
|
||||
* Will test the FuzeWorks Model System.
|
||||
* @coversDefaultClass \FuzeWorks\Logger
|
||||
*/
|
||||
class loggerTest extends CoreTestAbstract
|
||||
{
|
||||
|
@ -56,6 +57,9 @@ class loggerTest extends CoreTestAbstract
|
|||
Logger::$logs = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @coversNothing
|
||||
*/
|
||||
public function testGetLogger()
|
||||
{
|
||||
$this->assertInstanceOf('FuzeWorks\Logger', new Logger);
|
||||
|
@ -63,6 +67,9 @@ class loggerTest extends CoreTestAbstract
|
|||
$this->assertInstanceOf('FuzeWorks\Logger', new Logger);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::errorHandler
|
||||
*/
|
||||
public function testErrorHandler()
|
||||
{
|
||||
Logger::errorHandler(E_ERROR, 'Example error', __FILE__, 1);
|
||||
|
@ -77,6 +84,8 @@ class loggerTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testErrorHandler
|
||||
* @covers ::errorHandler
|
||||
* @covers ::getType
|
||||
*/
|
||||
public function testErrorHandlerTypes()
|
||||
{
|
||||
|
@ -114,6 +123,9 @@ class loggerTest extends CoreTestAbstract
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::exceptionHandler
|
||||
*/
|
||||
public function testExceptionHandler()
|
||||
{
|
||||
// Create the exception
|
||||
|
@ -129,6 +141,9 @@ class loggerTest extends CoreTestAbstract
|
|||
Logger::exceptionHandler($exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::log
|
||||
*/
|
||||
public function testLog()
|
||||
{
|
||||
// Log the message
|
||||
|
@ -147,6 +162,12 @@ class loggerTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testLog
|
||||
* @covers ::newLevel
|
||||
* @covers ::stopLevel
|
||||
* @covers ::logError
|
||||
* @covers ::logWarning
|
||||
* @covers ::logDebug
|
||||
* @covers ::mark
|
||||
*/
|
||||
public function testLogTypes()
|
||||
{
|
||||
|
@ -174,6 +195,11 @@ class loggerTest extends CoreTestAbstract
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::enable
|
||||
* @covers ::disable
|
||||
* @covers ::isEnabled
|
||||
*/
|
||||
public function testEnableDisable()
|
||||
{
|
||||
// First enable
|
||||
|
|
|
@ -42,6 +42,7 @@ use FuzeWorks\Plugins;
|
|||
* Class PluginsTest.
|
||||
*
|
||||
* Plugins testing suite, will test basic loading of and management of Plugins
|
||||
* @coversDefaultClass \FuzeWorks\Plugins
|
||||
*/
|
||||
class pluginTest extends CoreTestAbstract
|
||||
{
|
||||
|
@ -58,6 +59,9 @@ class pluginTest extends CoreTestAbstract
|
|||
$this->plugins->loadHeadersFromPluginPaths();
|
||||
}
|
||||
|
||||
/**
|
||||
* @coversNothing
|
||||
*/
|
||||
public function testGetPluginsClass()
|
||||
{
|
||||
$this->assertInstanceOf('FuzeWorks\Plugins', $this->plugins);
|
||||
|
@ -65,6 +69,7 @@ class pluginTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testGetPluginsClass
|
||||
* @covers ::get
|
||||
*/
|
||||
public function testLoadPlugin()
|
||||
{
|
||||
|
@ -73,6 +78,7 @@ class pluginTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testLoadPlugin
|
||||
* @covers ::get
|
||||
*/
|
||||
public function testReloadPlugin()
|
||||
{
|
||||
|
@ -81,6 +87,7 @@ class pluginTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testLoadPlugin
|
||||
* @covers ::get
|
||||
*/
|
||||
public function testLoadHeader()
|
||||
{
|
||||
|
@ -97,6 +104,7 @@ class pluginTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testLoadPlugin
|
||||
* @covers ::get
|
||||
* @expectedException FuzeWorks\Exception\PluginException
|
||||
*/
|
||||
public function testMissingHeader()
|
||||
|
@ -106,6 +114,7 @@ class pluginTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testLoadPlugin
|
||||
* @covers ::get
|
||||
*/
|
||||
public function testGetPluginMethod()
|
||||
{
|
||||
|
@ -114,6 +123,7 @@ class pluginTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testLoadPlugin
|
||||
* @covers ::get
|
||||
*/
|
||||
public function testGetPluginWithClassFile()
|
||||
{
|
||||
|
@ -122,6 +132,7 @@ class pluginTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testLoadPlugin
|
||||
* @covers ::get
|
||||
* @expectedException FuzeWorks\Exception\PluginException
|
||||
*/
|
||||
public function testMissingPlugin()
|
||||
|
@ -131,18 +142,17 @@ class pluginTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testMissingPlugin
|
||||
* @covers ::get
|
||||
* @expectedException FuzeWorks\Exception\PluginException
|
||||
*/
|
||||
public function testLoadHeaderNotIPluginHeader()
|
||||
{
|
||||
// Attempt to load all headers
|
||||
$this->plugins->loadHeadersFromPluginPaths();
|
||||
|
||||
$this->plugins->get('TestLoadHeaderNotIPluginHeader');
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testLoadPlugin
|
||||
* @covers ::get
|
||||
* @expectedException FuzeWorks\Exception\PluginException
|
||||
*/
|
||||
public function testInvalidClass()
|
||||
|
@ -151,6 +161,7 @@ class pluginTest extends CoreTestAbstract
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers ::get
|
||||
* @expectedException FuzeWorks\Exception\PluginException
|
||||
*/
|
||||
public function testGetMissingName()
|
||||
|
@ -160,6 +171,8 @@ class pluginTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testLoadPlugin
|
||||
* @covers ::get
|
||||
* @covers ::loadHeadersFromPluginPaths
|
||||
* @expectedException FuzeWorks\Exception\PluginException
|
||||
*/
|
||||
public function testDisabledPlugin()
|
||||
|
@ -171,6 +184,8 @@ class pluginTest extends CoreTestAbstract
|
|||
|
||||
/**
|
||||
* @depends testLoadPlugin
|
||||
* @covers ::get
|
||||
* @covers ::loadHeadersFromPluginPaths
|
||||
* @expectedException FuzeWorks\Exception\PluginException
|
||||
*/
|
||||
public function testRunInvalidDirectory()
|
||||
|
|
|
@ -39,10 +39,14 @@ use FuzeWorks\Priority;
|
|||
* Class priorityTest.
|
||||
*
|
||||
* This test will test the Priority class
|
||||
* @coversDefaultClass \FuzeWorks\Priority
|
||||
*/
|
||||
class priorityTest extends CoreTestAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
* @coversNothing
|
||||
*/
|
||||
public function testPriorities()
|
||||
{
|
||||
$this->assertEquals(Priority::LOWEST, 5);
|
||||
|
@ -53,6 +57,9 @@ class priorityTest extends CoreTestAbstract
|
|||
$this->assertEquals(Priority::MONITOR, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::getPriority
|
||||
*/
|
||||
public function testGetPriority()
|
||||
{
|
||||
$this->assertEquals(Priority::getPriority(5), 'Priority::LOWEST');
|
||||
|
@ -63,16 +70,25 @@ class priorityTest extends CoreTestAbstract
|
|||
$this->assertEquals(Priority::getPriority(0), 'Priority::MONITOR');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::getPriority
|
||||
*/
|
||||
public function testGetInvalidPriority()
|
||||
{
|
||||
$this->assertFalse(Priority::getPriority(99));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::getHighestPriority
|
||||
*/
|
||||
public function testHighestPriority()
|
||||
{
|
||||
$this->assertEquals(Priority::getHighestPriority(), Priority::MONITOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::getLowestPriority
|
||||
*/
|
||||
public function testLowestPriority()
|
||||
{
|
||||
$this->assertEquals(Priority::getLowestPriority(), Priority::LOWEST);
|
||||
|
|
|
@ -52,7 +52,7 @@ class coreStartEventTest extends CoreTestAbstract
|
|||
|
||||
Events::addListener(array($mock, 'mockMethod'), 'coreStartEvent', Priority::NORMAL);
|
||||
$factory = new Factory;
|
||||
$factory->init();
|
||||
$factory->initFactory();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,136 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* FuzeWorks Framework Core.
|
||||
*
|
||||
* The FuzeWorks PHP FrameWork
|
||||
*
|
||||
* Copyright (C) 2013-2019 TechFuze
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* @author TechFuze
|
||||
* @copyright Copyright (c) 2013 - 2019, TechFuze. (http://techfuze.net)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
*
|
||||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 1.2.0
|
||||
*
|
||||
* @version Version 1.2.0
|
||||
*/
|
||||
|
||||
// This autoloader provide convinient way to working with mock object
|
||||
// make the test looks natural. This autoloader support cascade file loading as well
|
||||
// within mocks directory.
|
||||
//
|
||||
// Prototype :
|
||||
//
|
||||
// $mock_table = new Mock_Libraries_Table(); // Will load ./mocks/libraries/table.php
|
||||
// $mock_database_driver = new Mock_Database_Driver(); // Will load ./mocks/database/driver.php
|
||||
// and so on...
|
||||
function autoload($class)
|
||||
{
|
||||
$dir = realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR;
|
||||
|
||||
$fw_core = array(
|
||||
'Benchmark',
|
||||
'Config',
|
||||
'Controller',
|
||||
'Exceptions',
|
||||
'Hooks',
|
||||
'Input',
|
||||
'Lang',
|
||||
'Loader',
|
||||
'Log',
|
||||
'Model',
|
||||
'Output',
|
||||
'Router',
|
||||
'Security',
|
||||
'URI',
|
||||
'Utf8'
|
||||
);
|
||||
|
||||
$fw_libraries = array(
|
||||
'Calendar',
|
||||
'Cart',
|
||||
'Driver_Library',
|
||||
'Email',
|
||||
'Encrypt',
|
||||
'Encryption',
|
||||
'Form_validation',
|
||||
'Ftp',
|
||||
'Image_lib',
|
||||
'Javascript',
|
||||
'Migration',
|
||||
'Pagination',
|
||||
'Parser',
|
||||
'Profiler',
|
||||
'Table',
|
||||
'Trackback',
|
||||
'Typography',
|
||||
'Unit_test',
|
||||
'Upload',
|
||||
'User_agent',
|
||||
'Xmlrpc',
|
||||
'Zip'
|
||||
);
|
||||
|
||||
$fw_drivers = array('Session', 'Cache');
|
||||
|
||||
if (strpos($class, 'Mock_') === 0)
|
||||
{
|
||||
$class = strtolower(str_replace(array('Mock_', '_'), array('', DIRECTORY_SEPARATOR), $class));
|
||||
}
|
||||
elseif (strpos($class, 'FW_') === 0)
|
||||
{
|
||||
$subclass = substr($class, 3);
|
||||
|
||||
if (in_array($subclass, $fw_core))
|
||||
{
|
||||
$dir = 'Core'.DIRECTORY_SEPARATOR.'System'.DIRECTORY_SEPARATOR;
|
||||
$class = $subclass;
|
||||
}
|
||||
elseif (in_array($subclass, $fw_libraries))
|
||||
{
|
||||
$dir = 'Core'.DIRECTORY_SEPARATOR.'Libraries'.DIRECTORY_SEPARATOR;
|
||||
$class = ($subclass === 'Driver_Library') ? 'Driver' : $subclass;
|
||||
}
|
||||
elseif (in_array($subclass, $fw_drivers))
|
||||
{
|
||||
$dir = 'Core'.DIRECTORY_SEPARATOR.'Libraries'.DIRECTORY_SEPARATOR.$subclass.DIRECTORY_SEPARATOR;
|
||||
$class = $subclass;
|
||||
}
|
||||
elseif (in_array(($parent = strtok($subclass, '_')), $fw_drivers)) {
|
||||
$dir = 'Core'.DIRECTORY_SEPARATOR.'Libraries'.DIRECTORY_SEPARATOR.$parent.DIRECTORY_SEPARATOR.'drivers'.DIRECTORY_SEPARATOR;
|
||||
$class = $subclass;
|
||||
}
|
||||
else
|
||||
{
|
||||
$class = strtolower($class);
|
||||
}
|
||||
}
|
||||
|
||||
$file = isset($file) ? $file : $dir.$class.'.php';
|
||||
|
||||
if ( ! file_exists($file))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
include_once($file);
|
||||
}
|
Loading…
Reference in New Issue