diff --git a/Application/Timerecording/Application.php b/Application/Timerecording/Application.php index 1b56851..e76d177 100755 --- a/Application/Timerecording/Application.php +++ b/Application/Timerecording/Application.php @@ -136,7 +136,7 @@ final class Application $this->app->sessionManager = new HttpSession(60); $this->app->cookieJar = new CookieJar(); - $this->app->moduleManager = new ModuleManager($this->app, __DIR__ . '/../../Modules'); + $this->app->moduleManager = new ModuleManager($this->app, __DIR__ . '/../../Modules/'); $this->app->dispatcher = new Dispatcher($this->app); $this->app->dbPool->create('select', $this->config['db']['core']['masters']['select']); diff --git a/tests/Models/SessionElementMapperTest.php b/tests/Models/SessionElementMapperTest.php index ccb9105..6540c2c 100755 --- a/tests/Models/SessionElementMapperTest.php +++ b/tests/Models/SessionElementMapperTest.php @@ -14,6 +14,7 @@ declare(strict_types=1); namespace Modules\HumanResourceTimeRecording\tests\Models; +use Modules\HumanResourceManagement\Models\NullEmployee; use Modules\HumanResourceTimeRecording\Models\Session; use Modules\HumanResourceTimeRecording\Models\SessionElement; use Modules\HumanResourceTimeRecording\Models\SessionElementMapper; @@ -29,7 +30,7 @@ class SessionElementMapperTest extends \PHPUnit\Framework\TestCase */ public function testCRUD() : void { - $element = new SessionElement(new Session(1), new \DateTime('now')); + $element = new SessionElement(new Session(new NullEmployee(1)), new \DateTime('now')); $id = SessionElementMapper::create($element); self::assertGreaterThan(0, $element->getId()); @@ -38,6 +39,6 @@ class SessionElementMapperTest extends \PHPUnit\Framework\TestCase $elementR = SessionElementMapper::get($element->getId()); self::assertEquals($element->getDatetime()->format('Y-m-d'), $elementR->getDatetime()->format('Y-m-d')); self::assertEquals($element->getStatus(), $elementR->getStatus()); - self::assertEquals($element->getSession()->getEmployee(), $elementR->getSession()->getEmployee()->getId()); + self::assertEquals($element->session->getEmployee()->getId(), $elementR->session->getEmployee()->getId()); } } diff --git a/tests/Models/SessionElementTest.php b/tests/Models/SessionElementTest.php index 28095d5..2d0f826 100755 --- a/tests/Models/SessionElementTest.php +++ b/tests/Models/SessionElementTest.php @@ -31,7 +31,7 @@ class SessionElementTest extends \PHPUnit\Framework\TestCase $element = new SessionElement(); self::assertEquals(0, $element->getId()); - self::assertEquals(0, $element->getSession()); + self::assertEquals(0, $element->session->getId()); self::assertEquals((new \DateTime('now'))->format('Y-m-d'), $element->getDatetime()->format('Y-m-d')); self::assertEquals(ClockingStatus::START, $element->getStatus()); } diff --git a/tests/Models/SessionMapperTest.php b/tests/Models/SessionMapperTest.php index e8bb638..022da26 100755 --- a/tests/Models/SessionMapperTest.php +++ b/tests/Models/SessionMapperTest.php @@ -14,6 +14,7 @@ declare(strict_types=1); namespace Modules\HumanResourceTimeRecording\tests\Models; +use Modules\HumanResourceManagement\Models\NullEmployee; use Modules\HumanResourceTimeRecording\Models\ClockingStatus; use Modules\HumanResourceTimeRecording\Models\Session; use Modules\HumanResourceTimeRecording\Models\SessionElement; @@ -30,7 +31,7 @@ class SessionMapperTest extends \PHPUnit\Framework\TestCase */ public function testCRUD() : void { - $session = new Session(1); + $session = new Session(new NullEmployee(1)); $dt = new \DateTime(\date('Y-m-d', \strtotime('now')) . ' 7:55:34'); $element = new SessionElement($session, $dt); @@ -60,7 +61,7 @@ class SessionMapperTest extends \PHPUnit\Framework\TestCase continue; } - $session = new Session(1); + $session = new Session(new NullEmployee(1)); $hourStart = \mt_rand(7, 9); $minutesStart = \mt_rand(0, 59); diff --git a/tests/Models/SessionTest.php b/tests/Models/SessionTest.php index 2093ef0..4a03395 100755 --- a/tests/Models/SessionTest.php +++ b/tests/Models/SessionTest.php @@ -51,7 +51,7 @@ class SessionTest extends \PHPUnit\Framework\TestCase $session->setType(ClockingType::VACATION); self::assertEquals(ClockingType::VACATION, $session->getType()); - $element = new SessionElement(0, new \DateTime('now')); + $element = new SessionElement(null, new \DateTime('now')); $element->setStatus(ClockingStatus::PAUSE); $session->addSessionElement($element);