chore: code cleanup
This commit is contained in:
1 parent
1a3640b15c
commit
5a01054b0e
65 files changed
+1046
-795
No files matched your search
@@ -2,18 +2,18 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Booking;
|
||||
namespace App\Tests\Config;
|
||||
|
||||
use App\Booking\Horizon;
|
||||
use App\Config\BookingHorizon;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class HorizonTest extends TestCase
|
||||
class BookingHorizonTest extends TestCase
|
||||
{
|
||||
public function testTheHorizonIsThreeMonthsFromTheGivenDay(): void
|
||||
{
|
||||
self::assertSame(
|
||||
'2026-12-14',
|
||||
Horizon::latest(new \DateTimeImmutable('2026-09-14'))->format('Y-m-d'),
|
||||
BookingHorizon::latest(new \DateTimeImmutable('2026-09-14'))->format('Y-m-d'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class HorizonTest extends TestCase
|
||||
{
|
||||
self::assertSame(
|
||||
'2026-12-01',
|
||||
Horizon::latest(new \DateTimeImmutable('2026-08-31'))->format('Y-m-d'),
|
||||
BookingHorizon::latest(new \DateTimeImmutable('2026-08-31'))->format('Y-m-d'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -36,15 +36,15 @@ class HorizonTest extends TestCase
|
||||
{
|
||||
self::assertSame(
|
||||
'00:00:00',
|
||||
Horizon::latest(new \DateTimeImmutable('2026-09-14 17:42:13'))->format('H:i:s'),
|
||||
BookingHorizon::latest(new \DateTimeImmutable('2026-09-14 17:42:13'))->format('H:i:s'),
|
||||
);
|
||||
}
|
||||
|
||||
public function testItDefaultsToToday(): void
|
||||
{
|
||||
self::assertEquals(
|
||||
Horizon::latest(new \DateTimeImmutable('today')),
|
||||
Horizon::latest(),
|
||||
BookingHorizon::latest(new \DateTimeImmutable('today')),
|
||||
BookingHorizon::latest(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,8 @@ namespace App\Tests\Controller\Admin;
|
||||
|
||||
use App\Entity\Booking;
|
||||
use App\Entity\Resource;
|
||||
use App\Entity\ResourceType;
|
||||
use App\Entity\User;
|
||||
use App\Enum\ResourceType;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
@@ -4,12 +4,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Controller;
|
||||
|
||||
use App\Booking\Horizon;
|
||||
use App\Booking\TimeRange;
|
||||
use App\Config\BookingHorizon;
|
||||
use App\Entity\Booking;
|
||||
use App\Entity\Resource;
|
||||
use App\Entity\ResourceType;
|
||||
use App\Entity\User;
|
||||
use App\Enum\ResourceType;
|
||||
use App\Model\TimeRange;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
@@ -399,7 +399,7 @@ class BookingControllerTest extends WebTestCase
|
||||
public function testABookingBeyondTheHorizonIsRejected(): void
|
||||
{
|
||||
$this->client->loginUser($this->user('[email protected]'));
|
||||
$beyond = Horizon::latest()->modify('+1 day');
|
||||
$beyond = BookingHorizon::latest()->modify('+1 day');
|
||||
|
||||
$response = $this->submitBookingModal($this->resource('D1'), $beyond->format('Y-m-d'), ['allDay' => '1']);
|
||||
|
||||
@@ -411,7 +411,7 @@ class BookingControllerTest extends WebTestCase
|
||||
{
|
||||
$this->client->loginUser($this->user('[email protected]'));
|
||||
|
||||
$response = $this->submitBookingModal($this->resource('D1'), Horizon::latest()->format('Y-m-d'), ['allDay' => '1']);
|
||||
$response = $this->submitBookingModal($this->resource('D1'), BookingHorizon::latest()->format('Y-m-d'), ['allDay' => '1']);
|
||||
|
||||
self::assertSame(Response::HTTP_OK, $response->getStatusCode());
|
||||
}
|
||||
@@ -439,7 +439,7 @@ class BookingControllerTest extends WebTestCase
|
||||
public function testAnAdminIsNotBoundByTheHorizon(): void
|
||||
{
|
||||
$this->client->loginUser($this->admin('[email protected]'));
|
||||
$beyond = Horizon::latest()->modify('+2 months');
|
||||
$beyond = BookingHorizon::latest()->modify('+2 months');
|
||||
|
||||
$response = $this->submitBookingModal($this->resource('D1'), $beyond->format('Y-m-d'), ['allDay' => '1']);
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Controller;
|
||||
|
||||
use App\Booking\TimeRange;
|
||||
use App\Entity\Booking;
|
||||
use App\Entity\Resource;
|
||||
use App\Entity\ResourceType;
|
||||
use App\Entity\User;
|
||||
use App\Enum\ResourceType;
|
||||
use App\Model\TimeRange;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
@@ -4,12 +4,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Controller;
|
||||
|
||||
use App\Booking\TimeRange;
|
||||
use App\Entity\Booking;
|
||||
use App\Entity\Resource;
|
||||
use App\Entity\ResourceGroup;
|
||||
use App\Entity\ResourceType;
|
||||
use App\Entity\User;
|
||||
use App\Enum\ResourceType;
|
||||
use App\Model\TimeRange;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
@@ -6,8 +6,8 @@ namespace App\Tests\Entity;
|
||||
|
||||
use App\Entity\Booking;
|
||||
use App\Entity\Resource;
|
||||
use App\Entity\ResourceType;
|
||||
use App\Entity\User;
|
||||
use App\Enum\ResourceType;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class BookingTest extends TestCase
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Entity;
|
||||
namespace App\Tests\Enum;
|
||||
|
||||
use App\Entity\ResourceType;
|
||||
use App\Enum\ResourceType;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ResourceTypeTest extends TestCase
|
||||
@@ -2,16 +2,16 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Booking;
|
||||
namespace App\Tests\Model;
|
||||
|
||||
use App\Booking\Spot;
|
||||
use App\Booking\SpotGroup;
|
||||
use App\Booking\TimeRange;
|
||||
use App\Entity\Booking;
|
||||
use App\Entity\Resource;
|
||||
use App\Entity\ResourceGroup;
|
||||
use App\Entity\ResourceType;
|
||||
use App\Entity\User;
|
||||
use App\Enum\ResourceType;
|
||||
use App\Model\Spot;
|
||||
use App\Model\SpotGroup;
|
||||
use App\Model\TimeRange;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class SpotGroupTest extends TestCase
|
||||
@@ -2,15 +2,15 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Booking;
|
||||
namespace App\Tests\Model;
|
||||
|
||||
use App\Booking\Spot;
|
||||
use App\Booking\SpotState;
|
||||
use App\Booking\TimeRange;
|
||||
use App\Entity\Booking;
|
||||
use App\Entity\Resource;
|
||||
use App\Entity\ResourceType;
|
||||
use App\Entity\User;
|
||||
use App\Enum\ResourceType;
|
||||
use App\Enum\SpotState;
|
||||
use App\Model\Spot;
|
||||
use App\Model\TimeRange;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class SpotTest extends TestCase
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Booking;
|
||||
namespace App\Tests\Model;
|
||||
|
||||
use App\Booking\TimeRange;
|
||||
use App\Model\TimeRange;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Environment;
|
||||
@@ -4,11 +4,11 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Repository;
|
||||
|
||||
use App\Booking\TimeRange;
|
||||
use App\Entity\Booking;
|
||||
use App\Entity\Resource;
|
||||
use App\Entity\ResourceType;
|
||||
use App\Entity\User;
|
||||
use App\Enum\ResourceType;
|
||||
use App\Model\TimeRange;
|
||||
use App\Repository\BookingRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Booking;
|
||||
namespace App\Tests\Service;
|
||||
|
||||
use App\Booking\AlreadyHoldingResourceException;
|
||||
use App\Booking\BookingManager;
|
||||
use App\Booking\RecurrenceRule;
|
||||
use App\Booking\ResourceAlreadyBookedException;
|
||||
use App\Booking\TimeRange;
|
||||
use App\Entity\Booking;
|
||||
use App\Entity\BookingSeries;
|
||||
use App\Entity\Resource;
|
||||
use App\Entity\ResourceType;
|
||||
use App\Entity\User;
|
||||
use App\Enum\RecurrenceRule;
|
||||
use App\Enum\ResourceType;
|
||||
use App\Exception\AlreadyHoldingResourceException;
|
||||
use App\Exception\ResourceAlreadyBookedException;
|
||||
use App\Model\TimeRange;
|
||||
use App\Service\BookingManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
|
||||
Reference in new issue
Block a user