Updated PHPUnit to ^9 and vfsStream to ~1.6.0.
continuous-integration/drone/push Build is passing Details

- This resulted in some changes needing to be made in the test folder. All tests have been updated to work with these updated dependencies.
- Also, PHP 7.1 is no longer supported.
- psr/log is no longer a dependency of Core
This commit is contained in:
Abel Hoogeveen 2020-07-31 14:29:37 +02:00
parent fbc17a9519
commit 3ebd91d2ef
Signed by: abelhooge
GPG Key ID: 387E8DC1F73306FC
14 changed files with 72 additions and 99 deletions

View File

@ -14,12 +14,11 @@
}
],
"require": {
"php": ">=7.1.0",
"psr/log": "~1.1.0"
"php": ">=7.2.0"
},
"require-dev": {
"phpunit/phpunit": "^7",
"mikey179/vfsstream": "1.1.*"
"phpunit/phpunit": "^9",
"mikey179/vfsstream": "~1.6.0"
},
"autoload": {
"psr-4": {

View File

@ -31,11 +31,9 @@
* @link http://techfuze.net/fuzeworks
* @since Version 0.0.1
*
* @version Version 1.2.0
* @version Version 1.3.0
*/
use FuzeWorks\Config;
use FuzeWorks\Core;
use FuzeWorks\Logger;
// First set the working directory

View File

@ -31,7 +31,7 @@
* @link http://techfuze.net/fuzeworks
* @since Version 1.2.0
*
* @version Version 1.2.0
* @version Version 1.3.0
*/
require_once(dirname(__DIR__) . '/vendor/autoload.php');
@ -45,9 +45,8 @@ $configurator->setLogDirectory(__DIR__ . '/temp');
$configurator->setTimeZone('Europe/Amsterdam');
// Debug related
$configurator->enableDebugMode(true);
$configurator->enableDebugMode();
$configurator->setDebugAddress('ALL');
//$configurator->setDebugEmail('example@mail.com');
$container = $configurator->createContainer();
return $container;

View File

@ -31,14 +31,13 @@
* @link http://techfuze.net/fuzeworks
* @since Version 0.0.1
*
* @version Version 1.2.0
* @version Version 1.3.0
*/
use PHPUnit\Framework\TestCase;
use FuzeWorks\Events;
use FuzeWorks\Factory;
use FuzeWorks\Core;
use FuzeWorks\Config;
use FuzeWorks\LoggerTracyBridge;
/**
* Class CoreTestAbstract.
@ -50,7 +49,7 @@ abstract class CoreTestAbstract extends TestCase
/**
* Reset multiple components to their original state before running the next test
*/
public function tearDown()
public function tearDown(): void
{
// Clear all events created by tests
Events::$listeners = [];

View File

@ -31,11 +31,12 @@
* @link http://techfuze.net/fuzeworks
* @since Version 0.0.1
*
* @version Version 1.2.0
* @version Version 1.3.0
*/
use FuzeWorks\Config;
use FuzeWorks\Event\ConfigGetEvent;
use FuzeWorks\Exception\ConfigException;
use FuzeWorks\Priority;
use FuzeWorks\Events;
@ -53,7 +54,7 @@ class configTest extends CoreTestAbstract
*/
protected $config;
public function setUp()
public function setUp(): void
{
$this->config = new Config();
}
@ -90,10 +91,10 @@ class configTest extends CoreTestAbstract
/**
* @depends testLoadConfig
* @covers ::loadConfigFile
* @expectedException FuzeWorks\Exception\ConfigException
*/
public function testFileNotFound()
{
$this->expectException(ConfigException::class);
$this->config->getConfig('notFound');
}

View File

@ -31,11 +31,12 @@
* @link http://techfuze.net/fuzeworks
* @since Version 1.2.0
*
* @version Version 1.2.0
* @version Version 1.3.0
*/
use FuzeWorks\Configurator;
use FuzeWorks\Core;
use FuzeWorks\Exception\ConfiguratorException;
use FuzeWorks\Factory;
use FuzeWorks\iComponent;
use FuzeWorks\Logger;
@ -54,7 +55,7 @@ class configuratorTest extends CoreTestAbstract
*/
protected $configurator;
public function setUp()
public function setUp(): void
{
$this->configurator = new Configurator;
$this->configurator->setTempDirectory(dirname(__DIR__) . '/temp');
@ -62,7 +63,7 @@ class configuratorTest extends CoreTestAbstract
$this->configurator->setTimeZone('Europe/Amsterdam');
}
public function tearDown()
public function tearDown(): void
{
parent::tearDown();
@ -132,7 +133,6 @@ class configuratorTest extends CoreTestAbstract
* @depends testAddComponent
* @covers ::addComponent
* @covers ::createContainer
* @expectedException FuzeWorks\Exception\ConfiguratorException
*/
public function testAddComponentFail()
{
@ -142,6 +142,7 @@ class configuratorTest extends CoreTestAbstract
$this->configurator->addComponent($component);
// Create container and fail
$this->expectException(ConfiguratorException::class);
$this->configurator->createContainer();
}
@ -175,11 +176,11 @@ class configuratorTest extends CoreTestAbstract
/**
* @depends testSetLogDirectory
* @covers ::setLogDirectory
* @expectedException \FuzeWorks\Exception\InvalidArgumentException
*/
public function testSetLogDirectoryNotDirectory()
{
// Set the directory
$this->expectException(\FuzeWorks\Exception\InvalidArgumentException::class);
$this->configurator->setLogDirectory('not_exist');
}
@ -204,11 +205,11 @@ class configuratorTest extends CoreTestAbstract
/**
* @depends testSetTempDirectory
* @covers ::setTempDirectory
* @expectedException \FuzeWorks\Exception\InvalidArgumentException
*/
public function testSetTempDirectoryNotDirectory()
{
// Set the directory
$this->expectException(\FuzeWorks\Exception\InvalidArgumentException::class);
$this->configurator->setTempDirectory('not_exist');
}
@ -245,10 +246,10 @@ class configuratorTest extends CoreTestAbstract
/**
* @depends testAddComponentDirectory
* @covers ::addDirectory
* @expectedException \FuzeWorks\Exception\InvalidArgumentException
*/
public function testAddComponentDirectoryNotExist()
{
$this->expectException(\FuzeWorks\Exception\InvalidArgumentException::class);
$this->configurator->addDirectory('not_exist', 'irrelevant');
}
@ -342,11 +343,11 @@ class configuratorTest extends CoreTestAbstract
/**
* @depends testSetTimezone
* @expectedException \FuzeWorks\Exception\InvalidArgumentException
* @covers ::setTimeZone
*/
public function testSetTimezoneInvalid()
{
$this->expectException(\FuzeWorks\Exception\InvalidArgumentException::class);
$this->configurator->setTimeZone('Europe/Amsterdamned');
}
@ -472,10 +473,10 @@ class configuratorTest extends CoreTestAbstract
/**
* @depends testEnableDebugMode
* @covers ::setDebugAddress
* @expectedException \FuzeWorks\Exception\InvalidArgumentException
*/
public function testSetDebugAddressInvalidArgument()
{
$this->expectException(\FuzeWorks\Exception\InvalidArgumentException::class);
$this->configurator->setDebugAddress(null);
}
}

View File

@ -31,11 +31,12 @@
* @link http://techfuze.net/fuzeworks
* @since Version 0.0.1
*
* @version Version 1.2.0
* @version Version 1.3.0
*/
use FuzeWorks\Event;
use FuzeWorks\Events;
use FuzeWorks\Exception\EventException;
use FuzeWorks\Priority;
/**
@ -145,21 +146,21 @@ class eventsTest extends CoreTestAbstract
/**
* @depends testFireEvent
* @expectedException FuzeWorks\Exception\EventException
* @covers ::fireEvent
*/
public function testInvalidTypeEvent()
{
$this->expectException(EventException::class);
Events::fireEvent(array('x', 'y', 'z'));
}
/**
* @depends testFireEvent
* @covers ::fireEvent
* @expectedException FuzeWorks\Exception\EventException
*/
public function testInvalidClassEvent()
{
$this->expectException(EventException::class);
Events::fireEvent('nonExistingEvent', 'x', 'y', 'z');
}
@ -185,30 +186,30 @@ class eventsTest extends CoreTestAbstract
/**
* @depends testAddAndRemoveListener
* @covers ::addListener
* @expectedException FuzeWorks\Exception\EventException
*/
public function testAddInvalidPriorityListener()
{
$this->expectException(EventException::class);
Events::addListener(function($event){}, 'mockEvent', 99);
}
/**
* @depends testAddAndRemoveListener
* @covers ::addListener
* @expectedException FuzeWorks\Exception\EventException
*/
public function testAddInvalidNameListener()
{
$this->expectException(EventException::class);
Events::addListener(function($e) {}, '', Priority::NORMAL);
}
/**
* @depends testAddAndRemoveListener
* @covers ::removeListener
* @expectedException FuzeWorks\Exception\EventException
*/
public function testRemoveInvalidPriorityListener()
{
$this->expectException(EventException::class);
Events::removeListener(function($event){}, 'mockEvent', 99);
}

View File

@ -31,7 +31,7 @@
* @link http://techfuze.net/fuzeworks
* @since Version 0.0.1
*
* @version Version 1.2.0
* @version Version 1.3.0
*/
use FuzeWorks\Exception\Exception;
@ -53,83 +53,63 @@ use FuzeWorks\Exception\ConfiguratorException;
class exceptionTestTest extends CoreTestAbstract
{
/**
* @expectedException FuzeWorks\Exception\Exception
*/
public function testException()
{
$this->expectException(Exception::class);
throw new Exception("Exception Test Run", 1);
}
/**
* @expectedException FuzeWorks\Exception\CoreException
*/
public function testCoreException()
{
$this->expectException(CoreException::class);
throw new CoreException("Exception Test Run", 1);
}
/**
* @expectedException FuzeWorks\Exception\ConfigException
*/
public function testConfigException()
{
$this->expectException(ConfigException::class);
throw new ConfigException("Exception Test Run", 1);
}
/**
* @expectedException FuzeWorks\Exception\EventException
*/
public function testEventException()
{
$this->expectException(EventException::class);
throw new EventException("Exception Test Run", 1);
}
/**
* @expectedException FuzeWorks\Exception\FactoryException
*/
public function testFactoryException()
{
$this->expectException(FactoryException::class);
throw new FactoryException("Exception Test Run", 1);
}
/**
* @expectedException FuzeWorks\Exception\HelperException
*/
public function testHelperException()
{
$this->expectException(HelperException::class);
throw new HelperException("Exception Test Run", 1);
}
/**
* @expectedException FuzeWorks\Exception\InvalidArgumentException
*/
public function testInvalidArgumentException()
{
$this->expectException(InvalidArgumentException::class);
throw new InvalidArgumentException("Exception Test Run", 1);
}
/**
* @expectedException FuzeWorks\Exception\LibraryException
*/
public function testLibraryException()
{
$this->expectException(LibraryException::class);
throw new LibraryException("Exception Test Run", 1);
}
/**
* @expectedException FuzeWorks\Exception\LoggerException
*/
public function testLoggerException()
{
$this->expectException(LoggerException::class);
throw new LoggerException("Exception Test Run", 1);
}
/**
* @expectedException FuzeWorks\Exception\ConfiguratorException
*/
public function testConfiguratorException()
{
$this->expectException(ConfiguratorException::class);
throw new ConfiguratorException("Exception Test Run", 1);
}

View File

@ -31,7 +31,7 @@
* @link http://techfuze.net/fuzeworks
* @since Version 0.0.1
*
* @version Version 1.2.0
* @version Version 1.3.0
*/
use FuzeWorks\Factory;
@ -73,10 +73,10 @@ class factoryTest extends CoreTestAbstract
/**
* @depends testGetInstance
* @covers ::getInstance
* @expectedException \FuzeWorks\Exception\FactoryException
*/
public function testGetInstanceNotFound()
{
$this->expectException(FactoryException::class);
Factory::getInstance('NotFound');
}
@ -183,7 +183,6 @@ class factoryTest extends CoreTestAbstract
/**
* @depends testCanLoadFactory
* @covers ::cloneInstance
* @expectedException FuzeWorks\Exception\FactoryException
*/
public function testCloneInstanceWrongClassname()
{
@ -191,6 +190,7 @@ class factoryTest extends CoreTestAbstract
$factory = new Factory;
// Attempt
$this->expectException(FactoryException::class);
$factory->cloneInstance('fake');
}
@ -223,7 +223,6 @@ class factoryTest extends CoreTestAbstract
/**
* @depends testNewFactoryInstance
* @covers ::newInstance
* @expectedException FuzeWorks\Exception\FactoryException
*/
public function testFactoryNewInstanceNotExist()
{
@ -231,13 +230,13 @@ class factoryTest extends CoreTestAbstract
$factory = new Factory;
// First, it does not exist
$this->expectException(FactoryException::class);
$factory->newInstance('fake');
}
/**
* @depends testNewFactoryInstance
* @covers ::newInstance
* @expectedException FuzeWorks\Exception\FactoryException
*/
public function testFactoryNewInstanceWrongNamespace()
{
@ -245,6 +244,7 @@ class factoryTest extends CoreTestAbstract
$factory = new Factory;
// Second, it just fails
$this->expectException(FactoryException::class);
$factory->newInstance('helpers', 'Test\\');
}
@ -278,7 +278,6 @@ class factoryTest extends CoreTestAbstract
/**
* @depends testRemoveInstance
* @covers ::removeInstance
* @expectedException FuzeWorks\Exception\FactoryException
*/
public function testRemoveInstanceNotExist()
{
@ -286,6 +285,7 @@ class factoryTest extends CoreTestAbstract
$factory = new Factory;
// Test
$this->expectException(FactoryException::class);
$factory->removeInstance('fake');
}
@ -308,7 +308,7 @@ class factoryTest extends CoreTestAbstract
$this->assertEquals(5, $factory->test);
}
public function tearDown()
public function tearDown(): void
{
parent::tearDown();

View File

@ -31,7 +31,7 @@
* @link http://techfuze.net/fuzeworks
* @since Version 0.0.1
*
* @version Version 1.2.0
* @version Version 1.3.0
*/
use FuzeWorks\Priority;
@ -52,7 +52,7 @@ class helperTest extends CoreTestAbstract
*/
protected $helpers;
public function setUp()
public function setUp(): void
{
// Prepare class
$this->helpers = new Helpers();

View File

@ -31,10 +31,11 @@
* @link http://techfuze.net/fuzeworks
* @since Version 0.0.1
*
* @version Version 1.2.0
* @version Version 1.3.0
*/
use FuzeWorks\Core;
use FuzeWorks\Exception\LibraryException;
use FuzeWorks\Factory;
use FuzeWorks\Libraries;
@ -52,7 +53,7 @@ class libraryTest extends CoreTestAbstract
*/
protected $libraries;
public function setUp()
public function setUp(): void
{
// Load new libraries class
$this->libraries = new Libraries();
@ -110,10 +111,10 @@ class libraryTest extends CoreTestAbstract
* @depends testGetLibraryFromDirectory
* @covers ::get
* @covers ::initLibrary
* @expectedException FuzeWorks\Exception\LibraryException
*/
public function testGetLibraryFail()
{
$this->expectException(LibraryException::class);
$this->libraries->get('FailLoadLibrary');
}
@ -121,10 +122,10 @@ class libraryTest extends CoreTestAbstract
* @depends testGetLibraryFromDirectory
* @covers ::get
* @covers ::initLibrary
* @expectedException FuzeWorks\Exception\LibraryException
*/
public function testGetLibraryNoName()
{
$this->expectException(LibraryException::class);
$this->libraries->get('');
}
@ -132,10 +133,10 @@ class libraryTest extends CoreTestAbstract
* @depends testGetLibraryFromDirectory
* @covers ::get
* @covers ::initLibrary
* @expectedException FuzeWorks\Exception\LibraryException
*/
public function testGetLibraryNoClass()
{
$this->expectException(LibraryException::class);
$this->libraries->get('TestGetLibraryNoClass');
}
@ -188,10 +189,10 @@ class libraryTest extends CoreTestAbstract
/**
* @depends testAddLibraryClass
* @covers ::addLibraryClass
* @expectedException \FuzeWorks\Exception\LibraryException
*/
public function testAddLibraryClassFail()
{
$this->expectException(LibraryException::class);
$this->libraries->addLibraryClass('LibraryClassFail', '\Case\Not\Exist');
}
@ -214,14 +215,14 @@ class libraryTest extends CoreTestAbstract
/**
* @depends testAddLibraryWithAutoloader
* @covers ::initLibrary
* @expectedException \FuzeWorks\Exception\LibraryException
*/
public function testAddBadAutoloader()
{
$this->expectException(LibraryException::class);
$this->assertInstanceOf('Application\Library\TestAddBadAutoloader', $this->libraries->get('TestAddBadAutoloader'));
}
public function tearDown()
public function tearDown(): void
{
parent::tearDown();

View File

@ -31,7 +31,7 @@
* @link http://techfuze.net/fuzeworks
* @since Version 0.0.1
*
* @version Version 1.2.0
* @version Version 1.3.0
*/
use FuzeWorks\Events;
@ -51,7 +51,7 @@ class loggerTest extends CoreTestAbstract
protected $output;
public function setUp()
public function setUp(): void
{
Factory::getInstance()->config->get('error')->fuzeworks_error_reporting = false;
Logger::$logs = array();
@ -211,7 +211,7 @@ class loggerTest extends CoreTestAbstract
$this->assertFalse(Logger::isEnabled());
}
public function tearDown()
public function tearDown(): void
{
parent::tearDown();

View File

@ -31,10 +31,11 @@
* @link http://techfuze.net/fuzeworks
* @since Version 1.1.4
*
* @version Version 1.2.0
* @version Version 1.3.0
*/
use FuzeWorks\Core;
use FuzeWorks\Exception\PluginException;
use FuzeWorks\Factory;
use FuzeWorks\Plugins;
@ -52,7 +53,7 @@ class pluginTest extends CoreTestAbstract
*/
protected $plugins;
public function setUp()
public function setUp(): void
{
$this->plugins = new Plugins();
$this->plugins->init();
@ -106,10 +107,10 @@ class pluginTest extends CoreTestAbstract
/**
* @depends testLoadPlugin
* @covers ::get
* @expectedException FuzeWorks\Exception\PluginException
*/
public function testMissingHeader()
{
$this->expectException(PluginException::class);
$this->plugins->get('testMissingHeader');
}
@ -134,39 +135,39 @@ class pluginTest extends CoreTestAbstract
/**
* @depends testLoadPlugin
* @covers ::get
* @expectedException FuzeWorks\Exception\PluginException
*/
public function testMissingPlugin()
{
$this->expectException(PluginException::class);
$this->plugins->get('testMissingPlugin');
}
/**
* @depends testMissingPlugin
* @covers ::get
* @expectedException FuzeWorks\Exception\PluginException
*/
public function testLoadHeaderNotIPluginHeader()
{
$this->expectException(PluginException::class);
$this->plugins->get('TestLoadHeaderNotIPluginHeader');
}
/**
* @depends testLoadPlugin
* @covers ::get
* @expectedException FuzeWorks\Exception\PluginException
*/
public function testInvalidClass()
{
$this->expectException(PluginException::class);
$this->plugins->get('testInvalidClass');
}
/**
* @covers ::get
* @expectedException FuzeWorks\Exception\PluginException
*/
public function testGetMissingName()
{
$this->expectException(PluginException::class);
$this->plugins->get('');
}
@ -174,12 +175,12 @@ class pluginTest extends CoreTestAbstract
* @depends testLoadPlugin
* @covers ::get
* @covers ::loadHeadersFromPluginPaths
* @expectedException FuzeWorks\Exception\PluginException
*/
public function testDisabledPlugin()
{
Factory::getInstance()->config->plugins->disabled_plugins = array('TestDisabledPlugin');
$this->plugins->loadHeadersFromPluginPaths();
$this->expectException(PluginException::class);
$this->plugins->get('testDisabledPlugin');
}
@ -187,16 +188,16 @@ class pluginTest extends CoreTestAbstract
* @depends testLoadPlugin
* @covers ::get
* @covers ::loadHeadersFromPluginPaths
* @expectedException FuzeWorks\Exception\PluginException
*/
public function testRunInvalidDirectory()
{
$this->plugins->addComponentPath('exists_not');
$this->plugins->loadHeadersFromPluginPaths();
$this->expectException(PluginException::class);
$this->plugins->get('testRunInvalidDirectory');
}
public function tearDown()
public function tearDown(): void
{
parent::tearDown();

View File

@ -15,13 +15,6 @@
</testsuite>
</testsuites>
<logging>
<log type="json" target="../build/phpunit/logfile.json"/>
<log type="junit" target="../build/phpunit/logfile.xml"/>
<log type="testdox-html" target="../build/phpunit/testdox.html"/>
<log type="testdox-text" target="../build/phpunit/testdox.txt"/>
</logging>
<filter>
<whitelist processUncoveredFilesFromWhitelist="false">
<directory suffix=".php">../</directory>