We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fe06f97 commit 888670dCopy full SHA for 888670d
src/Block/HeaderBlock.php
@@ -16,4 +16,12 @@ public function __construct(
16
) {
17
parent::__construct($id);
18
}
19
+
20
+ /**
21
+ * This is a helper method to get the HTML tag for the header
22
+ */
23
+ public function getTag(): string
24
+ {
25
+ return sprintf('h%d', $this->level);
26
+ }
27
tests/Block/HeaderBlockTest.php
@@ -6,8 +6,16 @@
6
7
final class HeaderBlockTest extends BlockTestCase
8
{
9
- protected function getBlock(): Block
+ protected function getBlock(): HeaderBlock
10
11
return new HeaderBlock('id', 'Header', 1);
12
13
14
15
+ * @test
+ public function it_returns_tag(): void
+ self::assertSame('h1', $this->getBlock()->getTag());
0 commit comments