Removed modules/contrib/media module to allow update to the core media module
[yaffs-website] / vendor / cebe / markdown / tests / GithubMarkdownTest.php
1 <?php
2 /**
3  * @copyright Copyright (c) 2014 Carsten Brandt
4  * @license https://github.com/cebe/markdown/blob/master/LICENSE
5  * @link https://github.com/cebe/markdown#readme
6  */
7
8 namespace cebe\markdown\tests;
9
10 use cebe\markdown\GithubMarkdown;
11
12 /**
13  * Test case for the github flavored markdown.
14  *
15  * @author Carsten Brandt <mail@cebe.cc>
16  * @group github
17  */
18 class GithubMarkdownTest extends BaseMarkdownTest
19 {
20         public function createMarkdown()
21         {
22                 return new GithubMarkdown();
23         }
24
25         public function getDataPaths()
26         {
27                 return [
28                         'markdown-data' => __DIR__ . '/markdown-data',
29                         'github-data' => __DIR__ . '/github-data',
30                 ];
31         }
32
33         public function testNewlines()
34         {
35                 $markdown = $this->createMarkdown();
36                 $this->assertEquals("This is text<br />\nnewline\nnewline.", $markdown->parseParagraph("This is text  \nnewline\nnewline."));
37                 $markdown->enableNewlines = true;
38                 $this->assertEquals("This is text<br />\nnewline<br />\nnewline.", $markdown->parseParagraph("This is text  \nnewline\nnewline."));
39
40                 $this->assertEquals("<p>This is text</p>\n<p>newline<br />\nnewline.</p>\n", $markdown->parse("This is text\n\nnewline\nnewline."));
41         }
42
43         public function dataFiles()
44         {
45                 $files = parent::dataFiles();
46                 foreach($files as $i => $f) {
47                         // skip files that are different in github MD
48                         if ($f[0] === 'markdown-data' && (
49                                         $f[1] === 'list-marker-in-paragraph' ||
50                                         $f[1] === 'dense-block-markers'
51                                 )) {
52                                 unset($files[$i]);
53                         }
54                 }
55                 return $files;
56         }
57 }