Skip to content

Commit

Permalink
adds routing test
Browse files Browse the repository at this point in the history
  • Loading branch information
davisenra committed Mar 24, 2024
1 parent 9646355 commit d239017
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/Application/RoutingTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

namespace Application;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Tests\Traits\AppTestTrait;

class RoutingTest extends TestCase
{
use AppTestTrait;

#[Test]
public function itLoadsAllRoutes(): void
{
$routes = $this->app
->getRouteCollector()
->getRoutes();

$this->assertNotEmpty($routes);
}

#[Test]
public function itGracefullyHandlesNotFoundRoutes(): void
{
$request = $this->createJsonRequest('GET', '/invalid-route');
$response = $this->app->handle($request);

$this->assertEquals(404, $response->getStatusCode());
}
}

0 comments on commit d239017

Please sign in to comment.