diff --git a/packages/framework/tests/Unit/HeadingRendererUnitTest.php b/packages/framework/tests/Unit/HeadingRendererUnitTest.php index a2b5cf73f71..d544209027d 100644 --- a/packages/framework/tests/Unit/HeadingRendererUnitTest.php +++ b/packages/framework/tests/Unit/HeadingRendererUnitTest.php @@ -165,9 +165,8 @@ public function testCanAddPermalinkReturnsFalseForExistingPermalink(): void public function testCanAddPermalinkReturnsFalseForNotEnabledPageClass(): void { $renderer = new HeadingRenderer(MarkdownPage::class); - $result = $renderer->canAddPermalink('Test Content', 2); - $this->assertFalse($result); + $this->assertFalse($renderer->canAddPermalink('Test Content', 2)); } public function testCanAddPermalinkWithCustomPageClasses(): void @@ -177,15 +176,12 @@ public function testCanAddPermalinkWithCustomPageClasses(): void ]); $renderer = new HeadingRenderer(MarkdownPage::class); - $result = $renderer->canAddPermalink('Test Content', 2); - $this->assertTrue($result); + $this->assertTrue($renderer->canAddPermalink('Test Content', 2)); } public function testPostProcessMethodNormalizesInputToMatchCommonMark() { - $renderer = new HeadingRenderer(DocumentationPage::class); - // Actual HTML output returned from Blade $html = <<<'HTML'

@@ -197,53 +193,42 @@ public function testPostProcessMethodNormalizesInputToMatchCommonMark() // What CommonMark would generate from the same input Markdown $expected = '

Test Heading

'; - $processedHtml = $renderer->postProcess($html); - $this->assertSame($expected, $processedHtml); + $this->assertSame($expected, (new HeadingRenderer())->postProcess($html)); } public function testPostProcessRemovesSpacesCausedByNoExtraBladeAttributes() { - $renderer = new HeadingRenderer(); $html = "

Title

\n

Subtitle

"; - $processedHtml = $renderer->postProcess($html); - $this->assertSame('

Title

Subtitle

', $processedHtml); + $this->assertSame('

Title

Subtitle

', (new HeadingRenderer())->postProcess($html)); } public function testPostProcessRemovesSpacesCausedByNoExtraBladeAttributesButLeavesExtraAttributesAlone() { - $renderer = new HeadingRenderer(); $html = "

Title

\n

Subtitle

"; - $processedHtml = $renderer->postProcess($html); - $this->assertSame('

Title

Subtitle

', $processedHtml); + $this->assertSame('

Title

Subtitle

', (new HeadingRenderer())->postProcess($html)); } public function testPostProcessTrimsWhitespaceAndIndentationFromLines() { - $renderer = new HeadingRenderer(); $html = "

Title

\n

Subtitle

"; - $processedHtml = $renderer->postProcess($html); - $this->assertSame('

Title

Subtitle

', $processedHtml); + $this->assertSame('

Title

Subtitle

', (new HeadingRenderer())->postProcess($html)); } public function testPostProcessHandlesEmptyString() { - $renderer = new HeadingRenderer(); $html = ''; - $processedHtml = $renderer->postProcess($html); - $this->assertSame('', $processedHtml); + $this->assertSame('', (new HeadingRenderer())->postProcess($html)); } public function testPostProcessHandlesNoHeadingTags() { - $renderer = new HeadingRenderer(); $html = '

Paragraph

'; - $processedHtml = $renderer->postProcess($html); - $this->assertSame('

Paragraph

', $processedHtml); + $this->assertSame('

Paragraph

', (new HeadingRenderer())->postProcess($html)); } protected function createRealBladeCompilerEnvironment(): void