refactor/update #30

Merged
TorstenHettstedt merged 15 commits from refactor/update into master 2025-06-16 15:48:34 +02:00
4 changed files with 14 additions and 16 deletions
Showing only changes of commit 85d22d5c06 - Show all commits
+1 -1
View File
@@ -17,7 +17,7 @@ use TorstenHettstedt\TimekeepingApi\Middleware\OriginAccessControlHandler;
$container = new Container(); $container = new Container();
$container->set('databases', function () { $container->set('databases', function () {
$dsn = "pgsql:host=${_ENV['DATABASES_HOST']};port=5432;dbname=${_ENV['DATABASES_NAME']}"; $dsn = "pgsql:host={$_ENV['DATABASES_HOST']};port=5432;dbname={$_ENV['DATABASES_NAME']}";
return new PDO($dsn, $_ENV['DATABASES_USER'], $_ENV['DATABASES_PASS']); return new PDO($dsn, $_ENV['DATABASES_USER'], $_ENV['DATABASES_PASS']);
}); });
@@ -19,11 +19,11 @@ use TorstenHettstedt\TimekeepingApi\Controller\WorkingHoursController;
class WorkingHoursControllerTest extends AbstractControllerTest class WorkingHoursControllerTest extends AbstractControllerTest
{ {
protected const FICTIONAL_STATUS_CODE = 666; protected const int FICTIONAL_STATUS_CODE = 666;
public const EXISTING_DATE = '2020-01-28'; public const string EXISTING_DATE = '2020-01-28';
public const EXISTING_INTERVAL = '07:20:00'; public const string EXISTING_INTERVAL = '07:20:00';
public const NEW_DATE = '2020-04-01'; public const string NEW_DATE = '2020-04-01';
public const NEW_INTERVAL = '07:59:00'; public const string NEW_INTERVAL = '07:59:00';
protected ContainerInterface $container; protected ContainerInterface $container;
protected Request $request; protected Request $request;
@@ -18,11 +18,11 @@ use TorstenHettstedt\TimekeepingApi\Repositories\WorkingHoursRepository;
class WorkingHoursRepositoryTest extends Unit class WorkingHoursRepositoryTest extends Unit
{ {
public const EXISTING_DATE = '2020-01-28'; public const string EXISTING_DATE = '2020-01-28';
public const EXISTING_INTERVAL = 'PT7H20M'; public const string EXISTING_INTERVAL = 'PT7H20M';
public const NEW_DATE = '2020-04-01'; public const string NEW_DATE = '2020-04-01';
public const NEW_INTERVAL = 'PT7H59M'; public const string NEW_INTERVAL = 'PT7H59M';
public const RECORDS_COUNT = 61; public const int RECORDS_COUNT = 61;
protected PDO $pdoObject; protected PDO $pdoObject;
@@ -6,7 +6,6 @@ use Codeception\Attribute\DataProvider;
use Codeception\Test\Unit; use Codeception\Test\Unit;
use DateTime; use DateTime;
use DateTimeZone; use DateTimeZone;
use Exception;
use PDO;use TorstenHettstedt\TimekeepingApi\Models\WorkingHoursView; use PDO;use TorstenHettstedt\TimekeepingApi\Models\WorkingHoursView;
use TorstenHettstedt\TimekeepingApi\Repositories\RepositoryRecordNotFoundException; use TorstenHettstedt\TimekeepingApi\Repositories\RepositoryRecordNotFoundException;
use TorstenHettstedt\TimekeepingApi\Repositories\WorkingHoursWeeklyViewRepository; use TorstenHettstedt\TimekeepingApi\Repositories\WorkingHoursWeeklyViewRepository;
@@ -38,14 +37,13 @@ class WorkingHoursViewRepositoryTest extends Unit
/** /**
* @return array<array{string, string, int, DateTime}> * @return array<array{string, string, int, DateTime}>
* @throws Exception
*/ */
public function existingObjectProvider(): array public function existingObjectProvider(): array
{ {
return [ return [
[WorkingHoursYearlyViewRepository::class, '2020', 61, new DateTime('2020-01-01', new DateTimeZone('UCT'))], [WorkingHoursYearlyViewRepository::class, '2020', 61, date_create('2020-01-01', new DateTimeZone('UCT'))],
[WorkingHoursMonthlyViewRepository::class, '2020 February', 20, new DateTime('2020-02-01', new DateTimeZone('UCT'))], [WorkingHoursMonthlyViewRepository::class, '2020 February', 20, date_create('2020-02-01', new DateTimeZone('UCT'))],
[WorkingHoursWeeklyViewRepository::class, '2020#03', 5, new DateTime('2020-01-13', new DateTimeZone('UCT'))], [WorkingHoursWeeklyViewRepository::class, '2020#03', 5, date_create('2020-01-13', new DateTimeZone('UCT'))],
]; ];
} }