-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1892 from hydephp/homepage-view-tests
Internal: Add homepage view tests
- Loading branch information
Showing
1 changed file
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Hyde\Framework\Testing\Feature; | ||
|
||
use Hyde\Hyde; | ||
use Hyde\Pages\BladePage; | ||
use Hyde\Testing\TestCase; | ||
use Hyde\Pages\MarkdownPost; | ||
use Hyde\Testing\TestsBladeViews; | ||
|
||
/** | ||
* @coversNothing Test to ensure all homepages can be rendered | ||
*/ | ||
class HomepageViewTest extends TestCase | ||
{ | ||
use TestsBladeViews; | ||
|
||
public function testBlankHomepage() | ||
{ | ||
Hyde::shareViewData(new BladePage('index')); | ||
|
||
$view = $this->view(view('hyde::homepages.blank')); | ||
|
||
$view->assertSee('HydePHP') | ||
->assertSee('Hello World!'); | ||
} | ||
|
||
public function testWelcomeHomepage() | ||
{ | ||
Hyde::shareViewData(new BladePage('index')); | ||
|
||
$view = $this->view(view('hyde::homepages.welcome')); | ||
|
||
$view->assertSee('HydePHP') | ||
->assertSee('Welcome to HydePHP!'); | ||
} | ||
|
||
public function testPostFeedHomepage() | ||
{ | ||
Hyde::shareViewData(new BladePage('index')); | ||
|
||
$view = $this->view(view('hyde::homepages.post-feed')); | ||
|
||
$view->assertSee('HydePHP') | ||
->assertSee('Latest Posts') | ||
->assertSeeHtml('id="post-feed"'); | ||
} | ||
|
||
public function testPostFeedHomepageWithPosts() | ||
{ | ||
Hyde::shareViewData(new BladePage('index')); | ||
|
||
Hyde::pages()->add(new MarkdownPost('hello-world', ['author' => 'Mr Hyde'], 'Hello World!')); | ||
|
||
$view = $this->view(view('hyde::homepages.post-feed')); | ||
|
||
$view->assertSee('HydePHP') | ||
->assertSee('Latest Posts') | ||
->assertSeeHtml('id="post-feed"') | ||
->assertSeeHtml('<a href="posts/hello-world.html"') | ||
->assertSee('Hello World!') | ||
->assertSee('Mr Hyde'); | ||
} | ||
} |