Moved 'tests' to 'test' folder to make consistent with other FuzeWorks projects.

This commit is contained in:
Abel Hoogeveen 2018-12-23 19:21:31 +01:00
parent 4086af2040
commit ef149a953f
66 changed files with 49 additions and 49 deletions

View File

@ -22,7 +22,7 @@ test:7.1:
stage: test stage: test
image: php:7.1 image: php:7.1
script: script:
- vendor/bin/phpunit -c tests/phpunit.xml --coverage-text - vendor/bin/phpunit -c test/phpunit.xml --coverage-text
cache: cache:
key: "$CI_BUILD_REF_$CI_BUILD_REF_NAME" key: "$CI_BUILD_REF_$CI_BUILD_REF_NAME"
paths: paths:
@ -32,7 +32,7 @@ test:7.2:
stage: test stage: test
image: php:7.2 image: php:7.2
script: script:
- vendor/bin/phpunit -c tests/phpunit.xml --coverage-text - vendor/bin/phpunit -c test/phpunit.xml --coverage-text
cache: cache:
key: "$CI_BUILD_REF_$CI_BUILD_REF_NAME" key: "$CI_BUILD_REF_$CI_BUILD_REF_NAME"
paths: paths:
@ -44,7 +44,7 @@ release:
only: only:
- master - master
script: script:
- vendor/bin/phpunit -c tests/phpunit.xml --coverage-text - vendor/bin/phpunit -c test/phpunit.xml --coverage-text
artifacts: artifacts:
name: "${CI_BUILD_NAME}_${CI_BUILD_REF_NAME}" name: "${CI_BUILD_NAME}_${CI_BUILD_REF_NAME}"
paths: paths:

View File

@ -5,7 +5,7 @@ php:
- 7 - 7
script: script:
- php vendor/bin/phpunit -v -c tests/phpunit.xml --coverage-text - php vendor/bin/phpunit -v -c test/phpunit.xml --coverage-text
before_script: before_script:
- composer install - composer install

View File

@ -107,7 +107,7 @@ class configTest extends CoreTestAbstract
}, 'configGetEvent', EventPriority::NORMAL); }, 'configGetEvent', EventPriority::NORMAL);
// Load file // Load file
$config = $this->config->getConfig('does_not_exist', ['tests'.DS.'config'.DS.'testLoadConfigIntercept']); $config = $this->config->getConfig('does_not_exist', ['test'.DS.'config'.DS.'testLoadConfigIntercept']);
$this->assertEquals('exists', $config->it); $this->assertEquals('exists', $config->it);
} }
@ -126,7 +126,7 @@ class configTest extends CoreTestAbstract
public function testAddConfigPath() public function testAddConfigPath()
{ {
// Add the configPath // Add the configPath
$this->config->addConfigPath('tests'.DS.'config'.DS.'testAddConfigPath'); $this->config->addConfigPath('test'.DS.'config'.DS.'testAddConfigPath');
// And try to load it again // And try to load it again
$this->assertInstanceOf('FuzeWorks\ConfigORM\ConfigORM', $this->config->getConfig('testAddConfigPath')); $this->assertInstanceOf('FuzeWorks\ConfigORM\ConfigORM', $this->config->getConfig('testAddConfigPath'));
@ -135,25 +135,25 @@ class configTest extends CoreTestAbstract
public function testRemoveConfigPath() public function testRemoveConfigPath()
{ {
// Test if the path does NOT exist // Test if the path does NOT exist
$this->assertFalse(in_array('tests'.DS.'config'.DS.'testRemoveConfigPath', $this->config->getConfigPaths())); $this->assertFalse(in_array('test'.DS.'config'.DS.'testRemoveConfigPath', $this->config->getConfigPaths()));
// Add it // Add it
$this->config->addConfigPath('tests'.DS.'config'.DS.'testRemoveConfigPath'); $this->config->addConfigPath('test'.DS.'config'.DS.'testRemoveConfigPath');
// Assert if it's there // Assert if it's there
$this->assertTrue(in_array('tests'.DS.'config'.DS.'testRemoveConfigPath', $this->config->getConfigPaths())); $this->assertTrue(in_array('test'.DS.'config'.DS.'testRemoveConfigPath', $this->config->getConfigPaths()));
// Remove it // Remove it
$this->config->removeConfigPath('tests'.DS.'config'.DS.'testRemoveConfigPath'); $this->config->removeConfigPath('test'.DS.'config'.DS.'testRemoveConfigPath');
// And test if it's gone again // And test if it's gone again
$this->assertFalse(in_array('tests'.DS.'config'.DS.'testRemoveConfigPath', $this->config->getConfigPaths())); $this->assertFalse(in_array('test'.DS.'config'.DS.'testRemoveConfigPath', $this->config->getConfigPaths()));
} }
public function testSameConfigObject() public function testSameConfigObject()
{ {
$config = $this->config->getConfig('testsameconfigobject', array('tests'.DS.'config'.DS.'testSameConfigObject')); $config = $this->config->getConfig('testsameconfigobject', array('test'.DS.'config'.DS.'testSameConfigObject'));
$config2 = $this->config->getConfig('testsameconfigobject', array('tests'.DS.'config'.DS.'testSameConfigObject')); $config2 = $this->config->getConfig('testsameconfigobject', array('test'.DS.'config'.DS.'testSameConfigObject'));
// First test if the objects are the same instance // First test if the objects are the same instance
$this->assertSame($config, $config2); $this->assertSame($config, $config2);
@ -169,7 +169,7 @@ class configTest extends CoreTestAbstract
public function testSetDirectories() public function testSetDirectories()
{ {
// Add the directory // Add the directory
$directory = 'tests' . DS . 'config'; $directory = 'test' . DS . 'config';
$this->config->setDirectories([$directory]); $this->config->setDirectories([$directory]);
// Assert expectations // Assert expectations

View File

@ -84,7 +84,7 @@ class configuratorTest extends CoreTestAbstract
public function testAddComponent() public function testAddComponent()
{ {
// Load the component // Load the component
require_once 'tests'.DS.'components'.DS.'testAddComponent'.DS.'TestAddComponent.php'; require_once 'test'.DS.'components'.DS.'testAddComponent'.DS.'TestAddComponent.php';
$component = new FuzeWorks\Component\TestComponent(); $component = new FuzeWorks\Component\TestComponent();
$this->assertInstanceOf('FuzeWorks\Configurator', $this->configurator->addComponent($component)); $this->assertInstanceOf('FuzeWorks\Configurator', $this->configurator->addComponent($component));
@ -102,7 +102,7 @@ class configuratorTest extends CoreTestAbstract
public function testAddComponentFail() public function testAddComponentFail()
{ {
// Load the component // Load the component
require_once 'tests'.DS.'components'.DS.'testAddComponentFail'.DS.'TestAddComponentFail.php'; require_once 'test'.DS.'components'.DS.'testAddComponentFail'.DS.'TestAddComponentFail.php';
$component = new FuzeWorks\Component\TestAddComponentFailComponent; $component = new FuzeWorks\Component\TestAddComponentFailComponent;
$this->configurator->addComponent($component); $this->configurator->addComponent($component);
@ -197,7 +197,7 @@ class configuratorTest extends CoreTestAbstract
vfsStream::setup('testAddComponentDirectory'); vfsStream::setup('testAddComponentDirectory');
// Add the component // Add the component
require_once 'tests'.DS.'components'.DS.'testAddComponentDirectory'.DS.'TestAddComponentDirectory.php'; require_once 'test'.DS.'components'.DS.'testAddComponentDirectory'.DS.'TestAddComponentDirectory.php';
$component = new FuzeWorks\Component\TestAddComponentDirectoryComponent(); $component = new FuzeWorks\Component\TestAddComponentDirectoryComponent();
$this->configurator->addComponent($component); $this->configurator->addComponent($component);

View File

@ -55,7 +55,7 @@ class helperTest extends CoreTestAbstract
{ {
// Prepare class // Prepare class
$this->helpers = new Helpers(); $this->helpers = new Helpers();
$this->helpers->setDirectories(['tests' . DS . 'helpers']); $this->helpers->setDirectories(['test' . DS . 'helpers']);
} }
public function testGetHelpersClass() public function testGetHelpersClass()
@ -171,7 +171,7 @@ class helperTest extends CoreTestAbstract
public function testAddHelperPath() public function testAddHelperPath()
{ {
// Add the helperPath // Add the helperPath
$this->helpers->addHelperPath('tests'.DS.'helpers'.DS.'testAddHelperPath'); $this->helpers->addHelperPath('test'.DS.'helpers'.DS.'testAddHelperPath');
// And try to load it again // And try to load it again
$this->assertTrue($this->helpers->load('testAddHelperPath')); $this->assertTrue($this->helpers->load('testAddHelperPath'));
@ -187,19 +187,19 @@ class helperTest extends CoreTestAbstract
public function testRemoveHelperPath() public function testRemoveHelperPath()
{ {
// Test if the path does NOT exist // Test if the path does NOT exist
$this->assertFalse(in_array('tests'.DS.'helpers'.DS.'testRemoveHelperPath', $this->helpers->getHelperPaths())); $this->assertFalse(in_array('test'.DS.'helpers'.DS.'testRemoveHelperPath', $this->helpers->getHelperPaths()));
// Add it // Add it
$this->helpers->addHelperPath('tests'.DS.'helpers'.DS.'testRemoveHelperPath'); $this->helpers->addHelperPath('test'.DS.'helpers'.DS.'testRemoveHelperPath');
// Assert if it's there // Assert if it's there
$this->assertTrue(in_array('tests'.DS.'helpers'.DS.'testRemoveHelperPath', $this->helpers->getHelperPaths())); $this->assertTrue(in_array('test'.DS.'helpers'.DS.'testRemoveHelperPath', $this->helpers->getHelperPaths()));
// Remove it // Remove it
$this->helpers->removeHelperPath('tests'.DS.'helpers'.DS.'testRemoveHelperPath'); $this->helpers->removeHelperPath('test'.DS.'helpers'.DS.'testRemoveHelperPath');
// And test if it's gone again // And test if it's gone again
$this->assertFalse(in_array('tests'.DS.'helpers'.DS.'testRemoveHelperPath', $this->helpers->getHelperPaths())); $this->assertFalse(in_array('test'.DS.'helpers'.DS.'testRemoveHelperPath', $this->helpers->getHelperPaths()));
} }
/** /**
@ -209,11 +209,11 @@ class helperTest extends CoreTestAbstract
public function testSetDirectories() public function testSetDirectories()
{ {
// Add the directory // Add the directory
$directory = 'tests' . DS . 'helpers'; $directory = 'test' . DS . 'helpers';
$this->helpers->setDirectories([$directory]); $this->helpers->setDirectories([$directory]);
// Assert expectations // Assert expectations
$expected = array_merge(\FuzeWorks\Core::$appDirs, ['tests' . DS . 'helpers', $directory]); $expected = array_merge(\FuzeWorks\Core::$appDirs, ['test' . DS . 'helpers', $directory]);
$this->assertEquals($expected, $this->helpers->getHelperPaths()); $this->assertEquals($expected, $this->helpers->getHelperPaths());
} }
} }

View File

@ -57,7 +57,7 @@ class libraryTest extends CoreTestAbstract
$this->libraries = new Libraries(); $this->libraries = new Libraries();
// And then set all paths // And then set all paths
$this->libraries->setDirectories(['tests'.DS.'libraries']); $this->libraries->setDirectories(['test'.DS.'libraries']);
} }
public function testLibrariesClass() public function testLibrariesClass()
@ -73,7 +73,7 @@ class libraryTest extends CoreTestAbstract
public function testSetDirectories() public function testSetDirectories()
{ {
// Test initial // Test initial
$initial = array_merge(Core::$appDirs, ['tests'.DS.'libraries']); $initial = array_merge(Core::$appDirs, ['test'.DS.'libraries']);
$this->assertEquals($initial, $this->libraries->getLibraryPaths()); $this->assertEquals($initial, $this->libraries->getLibraryPaths());
// Add path // Add path
@ -101,8 +101,8 @@ class libraryTest extends CoreTestAbstract
public function testAddLibraryPath() public function testAddLibraryPath()
{ {
// Add the libraryPath // Add the libraryPath
$this->libraries->removeLibraryPath('tests'.DS.'libraries'); $this->libraries->removeLibraryPath('test'.DS.'libraries');
$this->libraries->addLibraryPath('tests'.DS.'libraries'.DS.'testAddLibraryPath'); $this->libraries->addLibraryPath('test'.DS.'libraries'.DS.'testAddLibraryPath');
// And try to load it again // And try to load it again
$this->assertInstanceOf('Application\Library\TestAddLibraryPath', $this->libraries->get('TestAddLibraryPath')); $this->assertInstanceOf('Application\Library\TestAddLibraryPath', $this->libraries->get('TestAddLibraryPath'));
@ -111,19 +111,19 @@ class libraryTest extends CoreTestAbstract
public function testRemoveLibraryPath() public function testRemoveLibraryPath()
{ {
// Test if the path does NOT exist // Test if the path does NOT exist
$this->assertFalse(in_array('tests'.DS.'libraries'.DS.'testRemoveLibraryPath', $this->libraries->getLibraryPaths())); $this->assertFalse(in_array('test'.DS.'libraries'.DS.'testRemoveLibraryPath', $this->libraries->getLibraryPaths()));
// Add it // Add it
$this->libraries->addLibraryPath('tests'.DS.'libraries'.DS.'testRemoveLibraryPath'); $this->libraries->addLibraryPath('test'.DS.'libraries'.DS.'testRemoveLibraryPath');
// Assert if it's there // Assert if it's there
$this->assertTrue(in_array('tests'.DS.'libraries'.DS.'testRemoveLibraryPath', $this->libraries->getLibraryPaths())); $this->assertTrue(in_array('test'.DS.'libraries'.DS.'testRemoveLibraryPath', $this->libraries->getLibraryPaths()));
// Remove it // Remove it
$this->libraries->removeLibraryPath('tests'.DS.'libraries'.DS.'testRemoveLibraryPath'); $this->libraries->removeLibraryPath('test'.DS.'libraries'.DS.'testRemoveLibraryPath');
// And test if it's gone again // And test if it's gone again
$this->assertFalse(in_array('tests'.DS.'libraries'.DS.'testRemoveLibraryPath', $this->libraries->getLibraryPaths())); $this->assertFalse(in_array('test'.DS.'libraries'.DS.'testRemoveLibraryPath', $this->libraries->getLibraryPaths()));
} }
/* ---------------------------------- Load library from directories ------------------- */ /* ---------------------------------- Load library from directories ------------------- */
@ -142,7 +142,7 @@ class libraryTest extends CoreTestAbstract
public function testGetLibraryFromSubdirectory() public function testGetLibraryFromSubdirectory()
{ {
// Add test directory path // Add test directory path
$this->libraries->addLibraryPath('tests'.DS.'libraries'.DS.'testGetLibraryFromSubdirectory'); $this->libraries->addLibraryPath('test'.DS.'libraries'.DS.'testGetLibraryFromSubdirectory');
$this->assertInstanceOf('Application\Library\TestGetLibraryFromSubdirectory', $this->libraries->get('TestGetLibraryFromSubdirectory')); $this->assertInstanceOf('Application\Library\TestGetLibraryFromSubdirectory', $this->libraries->get('TestGetLibraryFromSubdirectory'));
} }
@ -154,7 +154,7 @@ class libraryTest extends CoreTestAbstract
{ {
// Simple test of loading a library and checking if it exists // Simple test of loading a library and checking if it exists
$this->assertInstanceOf('Application\Library\TestGetLibraryFromAltDirectory', $this->assertInstanceOf('Application\Library\TestGetLibraryFromAltDirectory',
$this->libraries->get('TestGetLibraryFromAltDirectory', [], ['tests'.DS.'libraries'.DS.'testGetLibraryFromAltDirectory'])); $this->libraries->get('TestGetLibraryFromAltDirectory', [], ['test'.DS.'libraries'.DS.'testGetLibraryFromAltDirectory']));
} }
/** /**
@ -185,7 +185,7 @@ class libraryTest extends CoreTestAbstract
{ {
// Prepare the config file // Prepare the config file
$libraryName = 'TestGetLibraryParametersFromConfig'; $libraryName = 'TestGetLibraryParametersFromConfig';
$libraryDir = 'tests'.DS.'libraries'.DS.'testGetLibraryParametersFromConfig'; $libraryDir = 'test'.DS.'libraries'.DS.'testGetLibraryParametersFromConfig';
$config = Factory::getInstance()->config->getConfig(strtolower($libraryName), [$libraryDir]); $config = Factory::getInstance()->config->getConfig(strtolower($libraryName), [$libraryDir]);
// Load the library // Load the library
@ -207,7 +207,7 @@ class libraryTest extends CoreTestAbstract
public function testAddLibraryClass() public function testAddLibraryClass()
{ {
require_once('tests'.DS.'libraries'.DS.'testAddLibraryClass'.DS.'TestAddLibraryClass.php'); require_once('test'.DS.'libraries'.DS.'testAddLibraryClass'.DS.'TestAddLibraryClass.php');
$this->libraries->addLibraryClass('LibraryClass', '\Custom\Spaces\TestAddLibraryClass'); $this->libraries->addLibraryClass('LibraryClass', '\Custom\Spaces\TestAddLibraryClass');

View File

@ -54,7 +54,7 @@ class pluginTest extends CoreTestAbstract
public function setUp() public function setUp()
{ {
$this->plugins = new Plugins(); $this->plugins = new Plugins();
$this->plugins->addPluginPath('tests'.DS.'plugins'); $this->plugins->addPluginPath('test'.DS.'plugins');
$this->plugins->loadHeadersFromPluginPaths(); $this->plugins->loadHeadersFromPluginPaths();
} }
@ -85,7 +85,7 @@ class pluginTest extends CoreTestAbstract
public function testLoadHeader() public function testLoadHeader()
{ {
// Load the header object // Load the header object
require_once('tests' . DS . 'plugins' . DS . 'testLoadHeader'.DS.'loadHeader'.DS.'header.php'); require_once('test' . DS . 'plugins' . DS . 'testLoadHeader'.DS.'loadHeader'.DS.'header.php');
$header = new Plugins\TestLoadHeaderHeader(); $header = new Plugins\TestLoadHeaderHeader();
// Register the header object // Register the header object
@ -183,7 +183,7 @@ class pluginTest extends CoreTestAbstract
public function testAddPluginPath() public function testAddPluginPath()
{ {
// Add the pluginPath // Add the pluginPath
$this->plugins->addPluginPath('tests'.DS.'plugins'.DS.'testAddPluginPath'); $this->plugins->addPluginPath('test'.DS.'plugins'.DS.'testAddPluginPath');
// And try to load it again // And try to load it again
$this->plugins->loadHeadersFromPluginPaths(); $this->plugins->loadHeadersFromPluginPaths();
@ -196,27 +196,27 @@ class pluginTest extends CoreTestAbstract
public function testRemovePluginPath() public function testRemovePluginPath()
{ {
// Test if the path does NOT exist // Test if the path does NOT exist
$this->assertFalse(in_array('tests'.DS.'plugins'.DS.'testRemovePluginPath', $this->plugins->getPluginPaths())); $this->assertFalse(in_array('test'.DS.'plugins'.DS.'testRemovePluginPath', $this->plugins->getPluginPaths()));
// Add it // Add it
$this->plugins->addPluginPath('tests'.DS.'plugins'.DS.'testRemovePluginPath'); $this->plugins->addPluginPath('test'.DS.'plugins'.DS.'testRemovePluginPath');
// Assert if it's there // Assert if it's there
$this->assertTrue(in_array('tests'.DS.'plugins'.DS.'testRemovePluginPath', $this->plugins->getPluginPaths())); $this->assertTrue(in_array('test'.DS.'plugins'.DS.'testRemovePluginPath', $this->plugins->getPluginPaths()));
// Remove it // Remove it
$this->plugins->removePluginPath('tests'.DS.'plugins'.DS.'testRemovePluginPath'); $this->plugins->removePluginPath('test'.DS.'plugins'.DS.'testRemovePluginPath');
// And test if it's gone again // And test if it's gone again
$this->assertFalse(in_array('tests'.DS.'plugins'.DS.'testRemovePluginPath', $this->plugins->getPluginPaths())); $this->assertFalse(in_array('test'.DS.'plugins'.DS.'testRemovePluginPath', $this->plugins->getPluginPaths()));
} }
public function testSetDirectories() public function testSetDirectories()
{ {
// Add the directory // Add the directory
$appDir = Core::$appDirs[0]; $appDir = Core::$appDirs[0];
$directory = 'tests' . DS . 'helpers'; $directory = 'test' . DS . 'helpers';
$expected = [$appDir, 'tests'.DS.'plugins', $directory]; $expected = [$appDir, 'test'.DS.'plugins', $directory];
$this->plugins->setDirectories([$directory]); $this->plugins->setDirectories([$directory]);
$this->assertEquals($expected, $this->plugins->getPluginPaths()); $this->assertEquals($expected, $this->plugins->getPluginPaths());