您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

58 行
1.4KB

  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. namespace cebe\markdown\tests;
  8. use cebe\markdown\GithubMarkdown;
  9. /**
  10. * Test case for the github flavored markdown.
  11. *
  12. * @author Carsten Brandt <mail@cebe.cc>
  13. * @group github
  14. */
  15. class GithubMarkdownTest extends BaseMarkdownTest
  16. {
  17. public function createMarkdown()
  18. {
  19. return new GithubMarkdown();
  20. }
  21. public function getDataPaths()
  22. {
  23. return [
  24. 'markdown-data' => __DIR__ . '/markdown-data',
  25. 'github-data' => __DIR__ . '/github-data',
  26. ];
  27. }
  28. public function testNewlines()
  29. {
  30. $markdown = $this->createMarkdown();
  31. $this->assertEquals("This is text<br />\nnewline\nnewline.", $markdown->parseParagraph("This is text \nnewline\nnewline."));
  32. $markdown->enableNewlines = true;
  33. $this->assertEquals("This is text<br />\nnewline<br />\nnewline.", $markdown->parseParagraph("This is text \nnewline\nnewline."));
  34. $this->assertEquals("<p>This is text</p>\n<p>newline<br />\nnewline.</p>\n", $markdown->parse("This is text\n\nnewline\nnewline."));
  35. }
  36. public function dataFiles()
  37. {
  38. $files = parent::dataFiles();
  39. foreach($files as $i => $f) {
  40. // skip files that are different in github MD
  41. if ($f[0] === 'markdown-data' && (
  42. $f[1] === 'list-marker-in-paragraph' ||
  43. $f[1] === 'dense-block-markers'
  44. )) {
  45. unset($files[$i]);
  46. }
  47. }
  48. return $files;
  49. }
  50. }