Skip to content

Commit

Permalink
Merge pull request #1892 from hydephp/homepage-view-tests
Browse files Browse the repository at this point in the history
Internal: Add homepage view tests
  • Loading branch information
caendesilva authored Jul 24, 2024
2 parents e9db027 + 53dd947 commit f05a952
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions packages/framework/tests/Feature/HomepageViewTest.php
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');
}
}

0 comments on commit f05a952

Please sign in to comment.