Skip to content

Commit

Permalink
Clean up test mock resets
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Sep 8, 2024
1 parent 66eedd6 commit d3e182a
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions packages/framework/tests/Unit/Facades/RouteFacadeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ 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 @@ -64,17 +69,13 @@ public function testCurrentReturnsCurrentRoute()
Render::shouldReceive('getRoute')->andReturn($route);

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

$this->resetMockInstance();
}

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

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

$this->resetMockInstance();
}

public function testExistsForExistingRoute()
Expand All @@ -86,9 +87,4 @@ public function testExistsForNonExistingRoute()
{
$this->assertFalse(Routes::exists('not-found'));
}

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

0 comments on commit d3e182a

Please sign in to comment.