Skip to content

Commit

Permalink
Refactor to use dataprovider attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Dec 7, 2024
1 parent c4e9e05 commit 9784937
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/framework/tests/Unit/HeadingRendererUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use League\CommonMark\Node\Node;
use League\CommonMark\Renderer\ChildNodeRendererInterface;
use Mockery;
use PHPUnit\Framework\Attributes\TestWith;

/**
* @covers \Hyde\Markdown\Processing\HeadingRenderer
Expand Down Expand Up @@ -234,13 +235,14 @@ public function testPostProcessHandlesNoHeadingTags()
$this->assertSame('<p>Paragraph</p>', (new HeadingRenderer())->postProcess($html));
}

public function testHeadingIdentifierGeneration()
#[TestWith(['hello world', 'hello-world'])]
#[TestWith(['hello-world', 'hello-world'])]
#[TestWith(['hello_world', 'hello-world'])]
#[TestWith(['user@host', 'user-at-host'])]
#[TestWith(['', ''])]
public function testHeadingIdentifierGeneration(string $input, string $expected): void
{
$this->assertSame('hello-world', HeadingRenderer::makeIdentifier('hello world'));
$this->assertSame('hello-world', HeadingRenderer::makeIdentifier('hello-world'));
$this->assertSame('hello-world', HeadingRenderer::makeIdentifier('hello_world'));
$this->assertSame('user-at-host', HeadingRenderer::makeIdentifier('user@host'));
$this->assertSame('', HeadingRenderer::makeIdentifier(''));
$this->assertSame($expected, HeadingRenderer::makeIdentifier($input));
}

protected function mockChildNodeRenderer(string $contents = 'Test Heading'): ChildNodeRendererInterface
Expand Down

0 comments on commit 9784937

Please sign in to comment.