Sha256: b577c4ff2d1c2f02d2b5a07cc421a1ea702bac63145acd8a681572bc49248c6a

Contents?: true

Size: 1.68 KB

Versions: 77

Compression:

Stored size: 1.68 KB

Contents

<?php

require 'markdown.php';

class MarkdownTest extends \PHPUnit_Framework_TestCase
{
    public function testParsingParagraph()
    {
        $this->assertEquals('<p>This will be a paragraph</p>', parseMarkdown('This will be a paragraph'));
    }

    public function testParsingItalics()
    {
        $this->assertEquals('<p><i>This will be italic</i></p>', parseMarkdown('_This will be italic_'));
    }

    public function testParsingBoldText()
    {
        $this->assertEquals('<p><em>This will be bold</em></p>', parseMarkdown('__This will be bold__'));
    }

    public function testMixedNormalItalicsAndBoldText()
    {
        $this->assertEquals('<p>This will <i>be</i> <em>mixed</em></p>', parseMarkdown('This will _be_ __mixed__'));
    }

    public function testWithH1Headerlevel()
    {
        $this->assertEquals('<h1>This will be an h1</h1>', parseMarkdown('# This will be an h1'));
    }

    public function testWithH2Headerlevel()
    {
        $this->assertEquals('<h2>This will be an h2</h2>', parseMarkdown('## This will be an h2'));
    }

    public function testWithH6Headerlevel()
    {
        $this->assertEquals('<h6>This will be an h6</h6>', parseMarkdown('###### This will be an h6'));
    }

    public function testUnorderedLists()
    {
        $this->assertEquals(
            '<ul><li><p>Item 1</p></li><li><p>Item 2</p></li></ul>',
            parseMarkdown("* Item 1\n* Item 2")
        );
    }

    public function testWithALittleBitOfEverything()
    {
        $this->assertEquals(
            '<h1>Header!</h1><ul><li><em>Bold Item</em></li><li><i>Italic Item</i></li></ul>',
            parseMarkdown("# Header!\n* __Bold Item__\n* _Italic Item_")
        );
    }
}

Version data entries

77 entries across 77 versions & 1 rubygems

Version Path
trackler-2.0.6.40 tracks/php/exercises/markdown/markdown_test.php
trackler-2.0.6.39 tracks/php/exercises/markdown/markdown_test.php
trackler-2.0.6.38 tracks/php/exercises/markdown/markdown_test.php
trackler-2.0.6.37 tracks/php/exercises/markdown/markdown_test.php
trackler-2.0.6.36 tracks/php/exercises/markdown/markdown_test.php
trackler-2.0.6.35 tracks/php/exercises/markdown/markdown_test.php
trackler-2.0.6.34 tracks/php/exercises/markdown/markdown_test.php
trackler-2.0.6.33 tracks/php/exercises/markdown/markdown_test.php
trackler-2.0.6.32 tracks/php/exercises/markdown/markdown_test.php
trackler-2.0.6.31 tracks/php/exercises/markdown/markdown_test.php
trackler-2.0.6.30 tracks/php/exercises/markdown/markdown_test.php
trackler-2.0.6.29 tracks/php/exercises/markdown/markdown_test.php
trackler-2.0.6.28 tracks/php/exercises/markdown/markdown_test.php
trackler-2.0.6.27 tracks/php/exercises/markdown/markdown_test.php
trackler-2.0.6.26 tracks/php/exercises/markdown/markdown_test.php
trackler-2.0.6.25 tracks/php/exercises/markdown/markdown_test.php
trackler-2.0.6.24 tracks/php/exercises/markdown/markdown_test.php
trackler-2.0.6.23 tracks/php/exercises/markdown/markdown_test.php
trackler-2.0.6.22 tracks/php/exercises/markdown/markdown_test.php
trackler-2.0.6.21 tracks/php/exercises/markdown/markdown_test.php