From dd274004f144dd994eeed5d47e8e29321fd94b83 Mon Sep 17 00:00:00 2001 From: "Paul M. Jones" Date: Wed, 27 Sep 2023 12:39:00 -0500 Subject: [PATCH] attempt to soothe windows --- tests/Assertions.php | 14 ++++++++++ tests/Helper/Html/CheckboxFieldsTest.php | 6 ++--- tests/Helper/Html/DlTest.php | 4 +-- tests/Helper/Html/HtmlHelperTestCase.php | 3 +++ tests/Helper/Html/ItemsTest.php | 2 +- tests/Helper/Html/OlTest.php | 4 +-- tests/Helper/Html/RadioFieldsTest.php | 2 +- tests/Helper/Html/SelectTest.php | 4 +-- tests/Helper/Html/UlTest.php | 4 +-- tests/TemplateTest.php | 33 +++++++++++++++--------- 10 files changed, 51 insertions(+), 25 deletions(-) create mode 100644 tests/Assertions.php diff --git a/tests/Assertions.php b/tests/Assertions.php new file mode 100644 index 0000000..edb873c --- /dev/null +++ b/tests/Assertions.php @@ -0,0 +1,14 @@ +assertSame($expect, $actual); + } +} diff --git a/tests/Helper/Html/CheckboxFieldsTest.php b/tests/Helper/Html/CheckboxFieldsTest.php index 96cae99..1da7695 100644 --- a/tests/Helper/Html/CheckboxFieldsTest.php +++ b/tests/Helper/Html/CheckboxFieldsTest.php @@ -19,7 +19,7 @@ public function test() : void HTML; - $this->assertSame($expect, $actual); + $this->assertSameString($expect, $actual); } public function testSingleOption() : void @@ -36,7 +36,7 @@ public function testSingleOption() : void HTML; - $this->assertSame($expect, $actual); + $this->assertSameString($expect, $actual); } public function testScalarChecked() : void @@ -53,6 +53,6 @@ public function testScalarChecked() : void HTML; - $this->assertSame($expect, $actual); + $this->assertSameString($expect, $actual); } } diff --git a/tests/Helper/Html/DlTest.php b/tests/Helper/Html/DlTest.php index 1e80eb3..2802bc6 100644 --- a/tests/Helper/Html/DlTest.php +++ b/tests/Helper/Html/DlTest.php @@ -26,9 +26,9 @@ public function test() : void
Baz Def
HTML; - $this->assertSame($expect, $actual); + $this->assertSameString($expect, $actual); $actual = $this->helpers->dl([]); $expect = ''; - $this->assertSame($expect, $actual); + $this->assertSameString($expect, $actual); } } diff --git a/tests/Helper/Html/HtmlHelperTestCase.php b/tests/Helper/Html/HtmlHelperTestCase.php index b17b7d5..16f6cd3 100644 --- a/tests/Helper/Html/HtmlHelperTestCase.php +++ b/tests/Helper/Html/HtmlHelperTestCase.php @@ -1,11 +1,14 @@ >dib HTML; - $this->assertSame($expect, $actual); + $this->assertSameString($expect, $actual); } } diff --git a/tests/Helper/Html/OlTest.php b/tests/Helper/Html/OlTest.php index 53fa683..f9034db 100644 --- a/tests/Helper/Html/OlTest.php +++ b/tests/Helper/Html/OlTest.php @@ -15,9 +15,9 @@ public function test() : void
  • >dib
  • HTML; - $this->assertSame($expect, $actual); + $this->assertSameString($expect, $actual); $actual = $this->helpers->ol([]); $expect = ''; - $this->assertSame($expect, $actual); + $this->assertSameString($expect, $actual); } } diff --git a/tests/Helper/Html/RadioFieldsTest.php b/tests/Helper/Html/RadioFieldsTest.php index e4f89c8..92e10d6 100644 --- a/tests/Helper/Html/RadioFieldsTest.php +++ b/tests/Helper/Html/RadioFieldsTest.php @@ -19,6 +19,6 @@ public function test() : void HTML; - $this->assertSame($expect, $actual); + $this->assertSameString($expect, $actual); } } diff --git a/tests/Helper/Html/SelectTest.php b/tests/Helper/Html/SelectTest.php index de2e156..f512fbd 100644 --- a/tests/Helper/Html/SelectTest.php +++ b/tests/Helper/Html/SelectTest.php @@ -44,7 +44,7 @@ public function test() : void HTML; - $this->assertSame($expect, $actual); + $this->assertSameString($expect, $actual); } public function testMultiple() : void @@ -87,6 +87,6 @@ public function testMultiple() : void HTML; - $this->assertSame($expect, $actual); + $this->assertSameString($expect, $actual); } } diff --git a/tests/Helper/Html/UlTest.php b/tests/Helper/Html/UlTest.php index 4234214..9dcf60a 100644 --- a/tests/Helper/Html/UlTest.php +++ b/tests/Helper/Html/UlTest.php @@ -15,9 +15,9 @@ public function test() : void
  • >dib
  • HTML; - $this->assertSame($expect, $actual); + $this->assertSameString($expect, $actual); $actual = $this->helpers->ul([]); $expect = ''; - $this->assertSame($expect, $actual); + $this->assertSameString($expect, $actual); } } diff --git a/tests/TemplateTest.php b/tests/TemplateTest.php index fa21601..359841c 100644 --- a/tests/TemplateTest.php +++ b/tests/TemplateTest.php @@ -3,12 +3,15 @@ namespace Qiq; +use Qiq\Assertions; use Qiq\Compiler\NonCompiler; use Qiq\Compiler\QiqCompiler; use RuntimeException; class TemplateTest extends \PHPUnit\Framework\TestCase { + use Assertions; + protected HtmlTemplate $template; protected function setUp() : void @@ -94,14 +97,22 @@ public function testRelative() : void public function testRelativeFailure() : void { $this->template->setView('rel/foo/broken'); - $this->expectException(Exception\FileNotFound::class); - $this->expectExceptionMessage(<<template)(); + + try { + ($this->template)(); + } catch (Exception\FileNotFound $e) { + $expect = <<<'EXPECT' + Could not resolve dots in template name. + Original name: '../../../zim' + Resolved into: '../zim' + Probably too many '../' in the original name. + EXPECT; + $actual = $e->getMessage(); + $this->assertSameString(trim($expect), trim($actual)); + return; + } + + throw new RuntimeException('Should have thrown exception'); } public function testExtends() : void @@ -111,7 +122,6 @@ public function testExtends() : void $expect = <<template)(); - $this->assertSame($expect, $actual); + $actual = str_replace("\n\n", "\n", $actual); + $this->assertSameString(trim($expect), trim($actual)); } public function testInheritanceDocExample() : void