-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into publications-feature
- Loading branch information
Showing
3 changed files
with
92 additions
and
31 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
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
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,54 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Hyde\Framework\Testing\Unit; | ||
|
||
use Hyde\Pages\VirtualPage; | ||
use Hyde\Testing\TestCase; | ||
|
||
/** | ||
* @covers \Hyde\Pages\VirtualPage | ||
* | ||
* @see \Hyde\Framework\Testing\Unit\Pages\VirtualPageUnitTest | ||
*/ | ||
class VirtualPageTest extends TestCase | ||
{ | ||
public function testConstructWithContentsString() | ||
{ | ||
$this->assertInstanceOf(VirtualPage::class, new VirtualPage('foo', contents: 'bar')); | ||
} | ||
|
||
public function testMakeWithContentsString() | ||
{ | ||
$this->assertInstanceOf(VirtualPage::class, VirtualPage::make('foo', contents: 'bar')); | ||
$this->assertEquals(VirtualPage::make('foo', contents: 'bar'), new VirtualPage('foo', contents: 'bar')); | ||
} | ||
|
||
public function testContentsMethod() | ||
{ | ||
$this->assertSame('bar', (new VirtualPage('foo', contents: 'bar'))->getContents()); | ||
} | ||
|
||
public function testViewMethod() | ||
{ | ||
$this->assertSame('bar', (new VirtualPage('foo', view: 'bar'))->getBladeView()); | ||
} | ||
|
||
public function testCompileMethodUsesContentsProperty() | ||
{ | ||
$this->assertSame('bar', (new VirtualPage('foo', contents: 'bar'))->compile()); | ||
} | ||
|
||
public function testCompileMethodUsesViewProperty() | ||
{ | ||
$this->file('_pages/foo.blade.php', 'bar'); | ||
$this->assertSame('bar', (new VirtualPage('foo', view: 'foo'))->compile()); | ||
} | ||
|
||
public function testCompileMethodPrefersContentsPropertyOverView() | ||
{ | ||
$this->file('_pages/foo.blade.php', 'blade'); | ||
$this->assertSame('contents', (new VirtualPage('foo', contents: 'contents', view: 'foo'))->compile()); | ||
} | ||
} |