File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -17,4 +17,35 @@ protected function tearDown(): void
1717 {
1818 unset($ this ->parsedownExtended );
1919 }
20+
21+ public function testReferencesEnabled ()
22+ {
23+ $ this ->parsedownExtended ->config ()->set ('references ' , true );
24+
25+ $ markdown = "[link text][ref] \n\n[ref]: https://example.com " ;
26+ $ html = $ this ->parsedownExtended ->text ($ markdown );
27+
28+ $ this ->assertStringContainsString ('<a href="https://example.com" ' , $ html );
29+ }
30+
31+ public function testReferencesDisabled ()
32+ {
33+ $ this ->parsedownExtended ->config ()->set ('references ' , false );
34+
35+ $ markdown = "[link text][ref] \n\n[ref]: https://example.com " ;
36+ $ html = $ this ->parsedownExtended ->text ($ markdown );
37+
38+ $ this ->assertStringContainsString ('[link text][ref] ' , $ html );
39+ }
40+
41+ public function testReferenceWithTitle ()
42+ {
43+ $ this ->parsedownExtended ->config ()->set ('references ' , true );
44+
45+ $ markdown = "[link text][ref] \n\n[ref]: https://example.com \"Example Title \"" ;
46+ $ html = $ this ->parsedownExtended ->text ($ markdown );
47+
48+ $ this ->assertStringContainsString ('href="https://example.com" ' , $ html );
49+ $ this ->assertStringContainsString ('title="Example Title" ' , $ html );
50+ }
2051}
You can’t perform that action at this time.
0 commit comments