Update website
This commit is contained in:
parent
4413528994
commit
1d90fbf296
6865 changed files with 1091082 additions and 0 deletions
61
vendor/doctrine/rst-parser/tests/Parser/LineDataParserTest.php
vendored
Normal file
61
vendor/doctrine/rst-parser/tests/Parser/LineDataParserTest.php
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\Tests\RST\Parser;
|
||||
|
||||
use Doctrine\Common\EventManager;
|
||||
use Doctrine\RST\Parser;
|
||||
use Doctrine\RST\Parser\LineDataParser;
|
||||
use Doctrine\RST\Parser\Link;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class LineDataParserTest extends TestCase
|
||||
{
|
||||
/** @var Parser */
|
||||
private $parser;
|
||||
|
||||
/** @var LineDataParser */
|
||||
private $lineDataParser;
|
||||
|
||||
/** @var EventManager|MockObject $eventManager */
|
||||
private $eventManager;
|
||||
|
||||
/**
|
||||
* @param mixed $expected
|
||||
*
|
||||
* @dataProvider getTestLinks
|
||||
*/
|
||||
public function testParseLink(string $line, $expected): void
|
||||
{
|
||||
$this->eventManager->expects(self::exactly($expected instanceof Link ? 1 : 0))
|
||||
->method('dispatchEvent');
|
||||
|
||||
self::assertEquals($expected, $this->lineDataParser->parseLink($line));
|
||||
}
|
||||
|
||||
/** @return list<array{string, mixed}> */
|
||||
public function getTestLinks(): array
|
||||
{
|
||||
return [
|
||||
['', null],
|
||||
['test', null],
|
||||
['.. test', null],
|
||||
['.. _test', null],
|
||||
['.. _test: https://www.google.com', new Link('test', 'https://www.google.com', Link::TYPE_LINK)],
|
||||
['.. _`test`: https://www.google.com', new Link('test', 'https://www.google.com', Link::TYPE_LINK)],
|
||||
['__ https://www.google.com', new Link('_', 'https://www.google.com', Link::TYPE_LINK)],
|
||||
['.. _anchor:', new Link('anchor', '#anchor', Link::TYPE_ANCHOR)],
|
||||
];
|
||||
}
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->parser = $this->createMock(Parser::class);
|
||||
|
||||
$this->eventManager = $this->createMock(EventManager::class);
|
||||
|
||||
$this->lineDataParser = new LineDataParser($this->parser, $this->eventManager);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue