Update website
This commit is contained in:
parent
4413528994
commit
1d90fbf296
6865 changed files with 1091082 additions and 0 deletions
55
vendor/doctrine/rst-parser/tests/Parser/DocumentParserTest.php
vendored
Normal file
55
vendor/doctrine/rst-parser/tests/Parser/DocumentParserTest.php
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\Tests\RST\Parser;
|
||||
|
||||
use Doctrine\Common\EventManager;
|
||||
use Doctrine\RST\Directives\Directive;
|
||||
use Doctrine\RST\Environment;
|
||||
use Doctrine\RST\ErrorManager;
|
||||
use Doctrine\RST\NodeFactory\NodeFactory;
|
||||
use Doctrine\RST\Parser;
|
||||
use Doctrine\RST\Parser\DocumentParser;
|
||||
use Exception;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class DocumentParserTest extends TestCase
|
||||
{
|
||||
public function testErrorWhenDirectiveThrowsException(): void
|
||||
{
|
||||
$parser = $this->createMock(Parser::class);
|
||||
$environment = $this->createMock(Environment::class);
|
||||
$nodeFactory = $this->createMock(NodeFactory::class);
|
||||
$eventManager = $this->createMock(EventManager::class);
|
||||
$codeBlockDirective = $this->createMock(Directive::class);
|
||||
$errorManager = $this->createMock(ErrorManager::class);
|
||||
|
||||
$docParser = new DocumentParser(
|
||||
$parser,
|
||||
$environment,
|
||||
$nodeFactory,
|
||||
$eventManager,
|
||||
['code-block' => $codeBlockDirective],
|
||||
true,
|
||||
__DIR__
|
||||
);
|
||||
|
||||
$codeBlockDirective->expects(self::once())
|
||||
->method('process')
|
||||
->willThrowException(new Exception('Invalid something something!'));
|
||||
$codeBlockDirective->expects(self::once())
|
||||
->method('getName')
|
||||
->willReturn('code-block-name');
|
||||
|
||||
$environment->expects(self::once())
|
||||
->method('getErrorManager')
|
||||
->willReturn($errorManager);
|
||||
|
||||
$errorManager->expects(self::once())
|
||||
->method('error')
|
||||
->with('Error while processing "code-block-name" directive: "Invalid something something!"');
|
||||
|
||||
$docParser->parse('.. code-block:: php');
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue