You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.5 KiB
61 lines
1.5 KiB
<?php |
|
/** |
|
* @link http://www.yiiframework.com/ |
|
* @copyright Copyright (c) 2008 Yii Software LLC |
|
* @license http://www.yiiframework.com/license/ |
|
*/ |
|
|
|
namespace yiiunit\framework\helpers; |
|
|
|
use yii\helpers\Markdown; |
|
use yiiunit\TestCase; |
|
|
|
/** |
|
* Description of MarkdownTest. |
|
* |
|
* @author Misbahul D Munir <misbahuldmunir@gmail.com> |
|
* @group helpers |
|
*/ |
|
class MarkdownTest extends TestCase |
|
{ |
|
protected function setUp() |
|
{ |
|
parent::setUp(); |
|
|
|
// destroy application, Helper must work without Yii::$app |
|
$this->destroyApplication(); |
|
} |
|
|
|
public function testOriginalFlavor() |
|
{ |
|
$text = <<<'TEXT' |
|
html |
|
new line 1 |
|
|
|
new line 2 |
|
TEXT; |
|
|
|
Markdown::$defaultFlavor = 'original'; |
|
$this->assertEquals(Markdown::process($text), Markdown::process($text, 'original')); |
|
|
|
Markdown::$defaultFlavor = 'gfm-comment'; |
|
$this->assertNotEquals(Markdown::process($text), Markdown::process($text, 'original')); |
|
$this->assertEquals(Markdown::process($text), Markdown::process($text, 'gfm-comment')); |
|
} |
|
|
|
/** |
|
* @expectedException \yii\base\InvalidParamException |
|
* @expectedExceptionMessage Markdown flavor 'undefined' is not defined. |
|
*/ |
|
public function testProcessInvalidParamException() |
|
{ |
|
Markdown::process('foo', 'undefined'); |
|
} |
|
|
|
public function testProcessParagraph() |
|
{ |
|
$actual = Markdown::processParagraph('foo'); |
|
$expected = 'foo'; |
|
$this->assertEquals($expected, $actual); |
|
} |
|
}
|
|
|