-
-
Notifications
You must be signed in to change notification settings - Fork 2
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 #1962 from hydephp/test-cleanup
Internal: Test code refactors and cleanup hydephp/develop@7e4b929
- Loading branch information
github-actions
committed
Sep 10, 2024
1 parent
a50d074
commit a8ed755
Showing
3 changed files
with
80 additions
and
99 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,64 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Hyde\Framework\Testing\Unit; | ||
|
||
use Hyde\Facades\Meta; | ||
use Hyde\Framework\Features\Metadata\GlobalMetadataBag; | ||
use Hyde\Testing\UnitTestCase; | ||
|
||
/** | ||
* @covers \Hyde\Facades\Meta | ||
*/ | ||
class MetaFacadeTest extends UnitTestCase | ||
{ | ||
protected static bool $needsKernel = true; | ||
protected static bool $needsConfig = true; | ||
protected static bool $needsRender = true; | ||
|
||
public function testNameMethodReturnsAValidHtmlMetaString() | ||
{ | ||
$this->assertSame('<meta name="foo" content="bar">', (string) Meta::name('foo', 'bar')); | ||
} | ||
|
||
public function testPropertyMethodReturnsAValidHtmlMetaString() | ||
{ | ||
$this->assertSame('<meta property="og:foo" content="bar">', (string) Meta::property('foo', 'bar')); | ||
} | ||
|
||
public function testPropertyMethodAcceptsPropertyWithOgPrefix() | ||
{ | ||
$this->assertSame('<meta property="og:foo" content="bar">', (string) Meta::property('og:foo', 'bar')); | ||
} | ||
|
||
public function testPropertyMethodAcceptsPropertyWithoutOgPrefix() | ||
{ | ||
$this->assertSame('<meta property="og:foo" content="bar">', (string) Meta::property('foo', 'bar')); | ||
} | ||
|
||
public function testLinkMethodReturnsAValidHtmlLinkString() | ||
{ | ||
$this->assertSame('<link rel="foo" href="bar">', (string) Meta::link('foo', 'bar')); | ||
} | ||
|
||
public function testLinkMethodReturnsAValidHtmlLinkStringWithAttributes() | ||
{ | ||
$this->assertSame('<link rel="foo" href="bar" title="baz">', (string) Meta::link('foo', 'bar', ['title' => 'baz'])); | ||
} | ||
|
||
public function testLinkMethodReturnsAValidHtmlLinkStringWithMultipleAttributes() | ||
{ | ||
$this->assertSame('<link rel="foo" href="bar" title="baz" type="text/css">', (string) Meta::link('foo', 'bar', ['title' => 'baz', 'type' => 'text/css'])); | ||
} | ||
|
||
public function testGetMethodReturnsGlobalMetadataBag() | ||
{ | ||
$this->assertEquals(Meta::get(), GlobalMetadataBag::make()); | ||
} | ||
|
||
public function testRenderMethodRendersGlobalMetadataBag() | ||
{ | ||
$this->assertSame(Meta::render(), GlobalMetadataBag::make()->render()); | ||
} | ||
} |
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