From 51153520e2cfb521623b01e7b49edb360f163789 Mon Sep 17 00:00:00 2001 From: Abel Hoogeveen Date: Thu, 28 Jan 2021 16:07:48 +0100 Subject: [PATCH] Added absolute pathing for unit tests. --- test/mcr/ControllersTest.php | 6 +++--- test/mcr/ModelsTest.php | 6 +++--- test/mcr/RouterTest.php | 4 ++-- test/mcr/ViewsTest.php | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/test/mcr/ControllersTest.php b/test/mcr/ControllersTest.php index ade10cc..89a3a45 100644 --- a/test/mcr/ControllersTest.php +++ b/test/mcr/ControllersTest.php @@ -58,7 +58,7 @@ class ControllersTest extends TestCase public function setUp(): void { $this->controllers = new Controllers(); - $this->controllers->addComponentPath('controllers'); + $this->controllers->addComponentPath(dirname(__DIR__) . DS . 'controllers'); } /** @@ -171,8 +171,8 @@ class ControllersTest extends TestCase public function testDifferentComponentPathPriority() { // Add the directories for this test - $this->controllers->addComponentPath('controllers'.DS.'TestDifferentComponentPathPriority'.DS.'Lowest', Priority::LOWEST); - $this->controllers->addComponentPath('controllers'.DS.'TestDifferentComponentPathPriority'.DS.'Highest', Priority::HIGHEST); + $this->controllers->addComponentPath(dirname(__DIR__) . DS . 'controllers'.DS.'TestDifferentComponentPathPriority'.DS.'Lowest', Priority::LOWEST); + $this->controllers->addComponentPath(dirname(__DIR__) . DS . 'controllers'.DS.'TestDifferentComponentPathPriority'.DS.'Highest', Priority::HIGHEST); // Load the controller and assert it is the correct type $controller = $this->controllers->get('TestDifferentComponentPathPriority'); diff --git a/test/mcr/ModelsTest.php b/test/mcr/ModelsTest.php index 3e9c95e..fdd01c8 100644 --- a/test/mcr/ModelsTest.php +++ b/test/mcr/ModelsTest.php @@ -59,7 +59,7 @@ class ModelsTest extends TestCase public function setUp(): void { $this->models = new Models(); - $this->models->addComponentPath('models'); + $this->models->addComponentPath(dirname(__DIR__) . DS . 'models'); } /** @@ -172,8 +172,8 @@ class ModelsTest extends TestCase public function testDifferentComponentPathPriority() { // Add the directories for this test - $this->models->addComponentPath('models'.DS.'TestDifferentComponentPathPriority'.DS.'Lowest', Priority::LOWEST); - $this->models->addComponentPath('models'.DS.'TestDifferentComponentPathPriority'.DS.'Highest', Priority::HIGHEST); + $this->models->addComponentPath(dirname(__DIR__) . DS . 'models'.DS.'TestDifferentComponentPathPriority'.DS.'Lowest', Priority::LOWEST); + $this->models->addComponentPath(dirname(__DIR__) . DS . 'models'.DS.'TestDifferentComponentPathPriority'.DS.'Highest', Priority::HIGHEST); // Load the model and assert it is the correct type $model = $this->models->get('TestDifferentComponentPathPriority'); diff --git a/test/mcr/RouterTest.php b/test/mcr/RouterTest.php index c7fcfb6..b3651c7 100644 --- a/test/mcr/RouterTest.php +++ b/test/mcr/RouterTest.php @@ -71,8 +71,8 @@ class RouterTest extends TestCase $this->config = Factory::getInstance()->config; // Append required routes - Factory::getInstance()->controllers->addComponentPath('controllers'); - Factory::getInstance()->views->addComponentPath('views'); + Factory::getInstance()->controllers->addComponentPath(dirname(__DIR__) . DS . 'controllers'); + Factory::getInstance()->views->addComponentPath(dirname(__DIR__) . DS . 'views'); } /** diff --git a/test/mcr/ViewsTest.php b/test/mcr/ViewsTest.php index dc9ce2c..02515ad 100644 --- a/test/mcr/ViewsTest.php +++ b/test/mcr/ViewsTest.php @@ -65,7 +65,7 @@ class ViewsTest extends TestCase public function setUp(): void { $this->views = new Views(); - $this->views->addComponentPath('views'); + $this->views->addComponentPath(dirname(__DIR__) . DS . 'views'); $this->mockController = $this->getMockBuilder(Controller::class)->getMock(); } @@ -179,8 +179,8 @@ class ViewsTest extends TestCase public function testDifferentComponentPathPriority() { // Add the directories for this test - $this->views->addComponentPath('views'.DS.'TestDifferentComponentPathPriority'.DS.'Lowest', Priority::LOWEST); - $this->views->addComponentPath('views'.DS.'TestDifferentComponentPathPriority'.DS.'Highest', Priority::HIGHEST); + $this->views->addComponentPath(dirname(__DIR__) . DS . 'views'.DS.'TestDifferentComponentPathPriority'.DS.'Lowest', Priority::LOWEST); + $this->views->addComponentPath(dirname(__DIR__) . DS . 'views'.DS.'TestDifferentComponentPathPriority'.DS.'Highest', Priority::HIGHEST); // Load the view and assert it is the correct type $view = $this->views->get('TestDifferentComponentPathPriority', $this->mockController);