From a5b3a9fc896e50c674949bb150e30d03523818a9 Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 10 Apr 2024 15:03:41 +0000 Subject: [PATCH] Merge pull request #1653 from hydephp/improve-test-suite Internal: Improve test suite https://github.com/hydephp/develop/commit/bcd26e3d126daf9a50912e1ea4e6ac5370e5330c --- .../Feature/{ => Views}/MetadataViewTest.php | 4 +- tests/Feature/Views/SidebarBrandViewTest.php | 6 +-- tests/Feature/{ => Views}/SidebarViewTest.php | 41 ++++--------------- tests/Unit/BreadcrumbsComponentTest.php | 12 +++--- .../BreadcrumbsComponentViewTest.php | 6 +-- .../{Components => }/LinkComponentTest.php | 6 +-- 6 files changed, 25 insertions(+), 50 deletions(-) rename tests/Feature/{ => Views}/MetadataViewTest.php (99%) rename tests/Feature/{ => Views}/SidebarViewTest.php (86%) rename tests/Unit/{ => Views}/BreadcrumbsComponentViewTest.php (99%) rename tests/Unit/Views/{Components => }/LinkComponentTest.php (94%) diff --git a/tests/Feature/MetadataViewTest.php b/tests/Feature/Views/MetadataViewTest.php similarity index 99% rename from tests/Feature/MetadataViewTest.php rename to tests/Feature/Views/MetadataViewTest.php index 40d79186..19975964 100644 --- a/tests/Feature/MetadataViewTest.php +++ b/tests/Feature/Views/MetadataViewTest.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Hyde\Framework\Testing\Feature; +namespace Hyde\Framework\Testing\Feature\Views; -use Hyde\Foundation\HydeKernel; use Hyde\Hyde; use Hyde\Testing\TestCase; +use Hyde\Foundation\HydeKernel; /** * This tests ensures all metadata is rendered correctly in the compiled pages. diff --git a/tests/Feature/Views/SidebarBrandViewTest.php b/tests/Feature/Views/SidebarBrandViewTest.php index 03670822..331f285e 100644 --- a/tests/Feature/Views/SidebarBrandViewTest.php +++ b/tests/Feature/Views/SidebarBrandViewTest.php @@ -5,8 +5,8 @@ namespace Hyde\Framework\Testing\Feature\Views; use Hyde\Hyde; +use Hyde\Facades\Features; use Hyde\Testing\TestCase; -use Hyde\Foundation\HydeKernel; use Hyde\Testing\TestsBladeViews; use Hyde\Pages\DocumentationPage; @@ -59,9 +59,7 @@ public function testSidebarBrandViewWithDefaultHeaderTextAndHomeRoute() public function testSidebarBrandViewWithoutDarkmodeFeature() { - $mock = $this->mock(HydeKernel::class)->makePartial(); - $mock->shouldReceive('hasFeature')->with('darkmode')->andReturn(false); - HydeKernel::setInstance($mock); + Features::mock('darkmode', false); $view = $this->view(view('hyde::components.docs.sidebar-brand')); diff --git a/tests/Feature/SidebarViewTest.php b/tests/Feature/Views/SidebarViewTest.php similarity index 86% rename from tests/Feature/SidebarViewTest.php rename to tests/Feature/Views/SidebarViewTest.php index 005b2421..9de8da87 100644 --- a/tests/Feature/SidebarViewTest.php +++ b/tests/Feature/Views/SidebarViewTest.php @@ -4,13 +4,12 @@ declare(strict_types=1); -namespace Hyde\Framework\Testing\Feature; +namespace Hyde\Framework\Testing\Feature\Views; -use Hyde\Framework\Features\Navigation\DocumentationSidebar; -use Hyde\Hyde; +use Throwable; use Hyde\Testing\TestCase; use Illuminate\Contracts\View\View; -use Throwable; +use Hyde\Framework\Features\Navigation\DocumentationSidebar; /** * Very high level test of the sidebar views and their combinations of layouts. @@ -39,8 +38,7 @@ public function testBaseSidebar() ->assertSeeHtml('Back to home page') ->assertSeeHtml('Toggle dark theme') ->assertDontSee('') - ->assertDontSee('