From db2b412f02217eed3f486e2ec68fd03c72ca739c Mon Sep 17 00:00:00 2001 From: Chris Kankiewicz Date: Sun, 16 Mar 2025 21:50:53 -0700 Subject: [PATCH] Test fixes --- phpunit.xml | 4 ++++ tests/Factories/TwigFactoryTest.php | 14 ++++++++++++-- tests/ViewFunctions/MarkdownTest.php | 4 ++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 0962525..f025817 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -25,4 +25,8 @@ + + + + diff --git a/tests/Factories/TwigFactoryTest.php b/tests/Factories/TwigFactoryTest.php index 0a65ca2..cae2c73 100644 --- a/tests/Factories/TwigFactoryTest.php +++ b/tests/Factories/TwigFactoryTest.php @@ -29,8 +29,8 @@ class TwigFactoryTest extends TestCase $twig = (new TwigFactory($this->config, $callableResolver))(); $this->assertInstanceOf( - ViewFunctions\Asset::class, - $twig->getEnvironment()->getFunction('asset')->getCallable() + ViewFunctions\Analytics::class, + $twig->getEnvironment()->getFunction('analytics')->getCallable() ); $this->assertInstanceOf( @@ -58,6 +58,11 @@ class TwigFactoryTest extends TestCase $twig->getEnvironment()->getFunction('markdown')->getCallable() ); + $this->assertInstanceOf( + ViewFunctions\ModifiedTime::class, + $twig->getEnvironment()->getFunction('modified_time')->getCallable() + ); + $this->assertInstanceOf( ViewFunctions\ParentUrl::class, $twig->getEnvironment()->getFunction('parent_url')->getCallable() @@ -78,6 +83,11 @@ class TwigFactoryTest extends TestCase $twig->getEnvironment()->getFunction('url')->getCallable() ); + $this->assertInstanceOf( + ViewFunctions\Vite::class, + $twig->getEnvironment()->getFunction('vite')->getCallable() + ); + $this->assertInstanceOf( ViewFunctions\ZipUrl::class, $twig->getEnvironment()->getFunction('zip_url')->getCallable() diff --git a/tests/ViewFunctions/MarkdownTest.php b/tests/ViewFunctions/MarkdownTest.php index 7831c9d..0f0aeeb 100644 --- a/tests/ViewFunctions/MarkdownTest.php +++ b/tests/ViewFunctions/MarkdownTest.php @@ -11,10 +11,10 @@ class MarkdownTest extends TestCase { public function test_it_can_parse_markdown_into_html(): void { - $markdown = new Markdown(new ParsedownExtra, $this->cache); + $markdown = $this->container->get(Markdown::class); $this->assertEquals( - '

Test markdown, please ignore

', + "

Test markdown, please ignore

\n", $markdown('**Test** `markdown`, ~~please~~ _ignore_') ); }