ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
MarkdownShapeTest Class Reference
+ Inheritance diagram for MarkdownShapeTest:
+ Collaboration diagram for MarkdownShapeTest:

Public Member Functions

 testToHTML (string $markdown_string, HTML $expected_html)
 
 testToPlainText (string $markdown_string, PlainText $expected_text)
 

Static Public Member Functions

static stringToHTMLDataProvider ()
 
static stringToPlainDataProvider ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

Markdown $markdown_shape
 

Detailed Description

Definition at line 27 of file MarkdownShapeTest.php.

Member Function Documentation

◆ setUp()

MarkdownShapeTest::setUp ( )
protected

Definition at line 31 of file MarkdownShapeTest.php.

31 : void
32 {
33 $language = $this->createMock(ilLanguage::class);
34 $data_factory = new Data\Factory();
35 $refinery = new ILIAS\Refinery\Factory($data_factory, $language);
36 $this->markdown_shape = new Markdown(new \ILIAS\Refinery\String\MarkdownFormattingToHTML());
37 }
Builds data types.
Definition: Factory.php:36
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

References ILIAS\UI\examples\Layout\Page\Standard\$refinery.

◆ stringToHTMLDataProvider()

static MarkdownShapeTest::stringToHTMLDataProvider ( )
static

Definition at line 39 of file MarkdownShapeTest.php.

39 : array
40 {
41 return [
42 ["lorem", new HTML("<p>lorem</p>\n")],
43 ["lorem **ipsum**", new HTML("<p>lorem <strong>ipsum</strong></p>\n")],
44 ["_lorem_ **ipsum**", new HTML("<p><em>lorem</em> <strong>ipsum</strong></p>\n")],
45 ["# Headline", new HTML("<h1>Headline</h1>\n")],
46 ["## Headline", new HTML("<h2>Headline</h2>\n")],
47 ["### Headline", new HTML("<h3>Headline</h3>\n")],
48 ["1. Lorem\n2. Ipsum", new HTML("<ol>\n<li>Lorem</li>\n<li>Ipsum</li>\n</ol>\n")],
49 ["- Lorem\n- Ipsum", new HTML("<ul>\n<li>Lorem</li>\n<li>Ipsum</li>\n</ul>\n")],
50 ["[Link Titel](https://www.ilias.de)", new HTML("<p><a href=\"https://www.ilias.de\">Link Titel</a></p>\n")]
51 ];
52 }
This class currently is a stub only.
Definition: HTML.php:28

◆ stringToPlainDataProvider()

static MarkdownShapeTest::stringToPlainDataProvider ( )
static

Definition at line 54 of file MarkdownShapeTest.php.

54 : array
55 {
56 return [
57 ["lorem", new PlainText("lorem")],
58 ["lorem **ipsum**", new PlainText("lorem **ipsum**")],
59 ["_lorem_ **ipsum**", new PlainText("_lorem_ **ipsum**")],
60 ["# Headline", new PlainText("# Headline")],
61 ["## Headline", new PlainText("## Headline")],
62 ["### Headline", new PlainText("### Headline")],
63 ["1. Lorem\n2. Ipsum", new PlainText("1. Lorem\n2. Ipsum")],
64 ["- Lorem\n- Ipsum", new PlainText("- Lorem\n- Ipsum")],
65 ["[Link Titel](https://www.ilias.de)", new PlainText("[Link Titel](https://www.ilias.de)")]
66 ];
67 }
This class currently is a stub only.
Definition: PlainText.php:28

◆ testToHTML()

MarkdownShapeTest::testToHTML ( string  $markdown_string,
HTML  $expected_html 
)

Definition at line 70 of file MarkdownShapeTest.php.

70 : void
71 {
72 $text = $this->markdown_shape->fromString($markdown_string);
73 $this->assertEquals($expected_html, $this->markdown_shape->toHTML($text));
74 }

◆ testToPlainText()

MarkdownShapeTest::testToPlainText ( string  $markdown_string,
PlainText  $expected_text 
)

Definition at line 77 of file MarkdownShapeTest.php.

77 : void
78 {
79 $text = $this->markdown_shape->fromString($markdown_string);
80 $this->assertEquals($expected_text, $this->markdown_shape->toPlainText($text));
81 }

Field Documentation

◆ $markdown_shape

Markdown MarkdownShapeTest::$markdown_shape
protected

Definition at line 29 of file MarkdownShapeTest.php.


The documentation for this class was generated from the following file: