Skip to content

Commit

Permalink
Merge pull request #1588 from hydephp/improved-view-testing
Browse files Browse the repository at this point in the history
Improved view testing hydephp/develop@1ec4ca5
  • Loading branch information
github-actions committed Feb 24, 2024
1 parent 830ad89 commit 59d0329
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions tests/Feature/Views/SidebarFooterTextViewTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

declare(strict_types=1);

namespace Hyde\Framework\Testing\Feature\Views;

use Hyde\Facades\Config;
use Hyde\Testing\TestCase;
use Hyde\Testing\TestsBladeViews;

class SidebarFooterTextViewTest extends TestCase
{
use TestsBladeViews;

public function testSidebarFooterTextViewWithDefaultConfig()
{
$view = $this->test(view('hyde::components.docs.sidebar-footer-text'));

$view->assertSeeHtml('<a href="index.html">Back to home page</a>');
}

public function testSidebarFooterTextViewWhenConfigOptionIsTrue()
{
Config::set('docs.sidebar.footer', true);

$view = $this->test(view('hyde::components.docs.sidebar-footer-text'));

$view->assertSeeHtml('<a href="index.html">Back to home page</a>');
}

public function testSidebarFooterTextViewWhenConfigOptionIsMarkdownString()
{
Config::set('docs.sidebar.footer', 'Your Markdown String Here');

$view = $this->test(view('hyde::components.docs.sidebar-footer-text'));

$view->assertSeeText('Your Markdown String Here');
}

public function testSidebarFooterTextViewWhenConfigOptionIsFalse()
{
// This state is handled earlier in the component by the sidebar component so we don't need to test it here.

$this->assertTrue(true);
}
}

0 comments on commit 59d0329

Please sign in to comment.