aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/michelf/php-markdown/test/unit/MarkdownExtraTest.php
blob: 42d7b8a614f47a3ad04b46434550b33e3c0994a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php

class MarkdownExtraTest extends \PHPUnit\Framework\TestCase
{
	public function testSetupOfPredefinedAttributes()
	{
		$obj = new \Michelf\MarkdownExtra();

		// Allows custom expansions of arreviations to their full version with the abbr tag
		$obj->predef_abbr = array(
			'foo' => 'foobar-test',
		);
		$result = $obj->transform('**Hello world, foo**');

		$this->assertSame(
			'<p><strong>Hello world, <abbr title="foobar-test">foo</abbr></strong></p>',
			trim($result)
		);
	}

	public function testSetupOfMultiplePredefinedAttributes()
	{
		$obj = new \Michelf\MarkdownExtra();

		// Allows custom expansions of arreviations to their full version with the abbr tag
		$obj->predef_abbr = array(
			'foo' => 'foobar-test',
			'ISP' => 'Internet Service Provider',
		);
		$result = $obj->transform('**I get internet from an ISP. foo.**');

		$this->assertSame(
			'<p><strong>I get internet from an <abbr title="Internet Service Provider">ISP' .
			'</abbr>. <abbr title="foobar-test">foo</abbr>.</strong></p>',
			trim($result)
		);
	}

	public function testTransformWithNoMarkup()
	{
		$obj = new \Michelf\MarkdownExtra();
		$obj->no_markup = true;

		$result = $obj->transform('This is a <strong class="custom">no markup</strong> test.');

		$this->assertSame(
			'<p>This is a &lt;strong class="custom">no markup&lt;/strong> test.</p>',
			trim($result)
		);
	}
}