Skip to content

Commit

Permalink
Optimize test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Sep 8, 2024
1 parent 6c0b780 commit e13b438
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/framework/tests/Unit/Facades/RouteFacadeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Hyde\Pages\MarkdownPage;
use Hyde\Pages\MarkdownPost;
use Hyde\Support\Facades\Render;
use Hyde\Support\Models\RenderData;
use Hyde\Support\Models\Route;
use Hyde\Testing\UnitTestCase;

Expand All @@ -23,11 +22,6 @@ class RouteFacadeTest extends UnitTestCase
protected static bool $needsKernel = true;
protected static bool $needsConfig = true;

protected function setUp(): void
{
Render::swap(new RenderData());
}

public function testRouteFacadeAllMethodReturnsAllRoutes()
{
$this->assertSame(Hyde::routes(), Routes::all());
Expand Down Expand Up @@ -66,13 +60,15 @@ public function testCurrentReturnsCurrentRoute()
{
$route = new Route(new MarkdownPage('foo'));

self::mockRender();
Render::shouldReceive('getRoute')->andReturn($route);

$this->assertSame($route, Routes::current());
}

public function testCurrentReturnsNullIfRouteIsNotFound()
{
self::mockRender();
Render::shouldReceive('getRoute')->andReturn(null);

$this->assertNull(Routes::current());
Expand Down

0 comments on commit e13b438

Please sign in to comment.