-
-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from thephpleague/fix-multibyte-bugs
Fix multibyte bugs
- Loading branch information
Showing
7 changed files
with
176 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
namespace League\CommonMark\Tests\Inline\Parser; | ||
|
||
use League\CommonMark\Cursor; | ||
use League\CommonMark\Inline\Element\Code; | ||
use League\CommonMark\InlineParserContext; | ||
use League\CommonMark\Inline\Parser\BacktickParser; | ||
|
||
class BacktickParserTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @param $string | ||
* @param $expectedContents | ||
* | ||
* @dataProvider dataForTestParse | ||
*/ | ||
public function testParse($string, $expectedContents) | ||
{ | ||
$cursor = new Cursor($string); | ||
|
||
// Move to just before the first backtick | ||
$firstBacktickPos = mb_strpos($string, '`', null, 'utf-8'); | ||
$cursor->advanceBy($firstBacktickPos); | ||
|
||
$inlineContext = new InlineParserContext($cursor); | ||
$contextStub = $this->getMock('League\CommonMark\ContextInterface'); | ||
|
||
$parser = new BacktickParser(); | ||
|
||
$parser->parse($contextStub, $inlineContext); | ||
|
||
$inlines = $inlineContext->getInlines(); | ||
$this->assertCount(1, $inlines); | ||
$this->assertTrue($inlines->first() instanceof Code); | ||
/** @var Code $code */ | ||
$code = $inlines->first(); | ||
$this->assertEquals($expectedContents, $code->getContent()); | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function dataForTestParse() | ||
{ | ||
return array( | ||
array('This is `just` a test', 'just'), | ||
array('Из: твоя `feature` ветка', 'feature'), | ||
array('Из: твоя `тест` ветка', 'тест'), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters