Update website
This commit is contained in:
parent
4413528994
commit
1d90fbf296
6865 changed files with 1091082 additions and 0 deletions
56
vendor/doctrine/rst-parser/tests/BaseBuilderTest.php
vendored
Normal file
56
vendor/doctrine/rst-parser/tests/BaseBuilderTest.php
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\Tests\RST;
|
||||
|
||||
use Doctrine\RST\Builder;
|
||||
use Exception;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use function file_get_contents;
|
||||
use function shell_exec;
|
||||
|
||||
abstract class BaseBuilderTest extends TestCase
|
||||
{
|
||||
/** @var Builder */
|
||||
protected $builder;
|
||||
|
||||
abstract protected function getFixturesDirectory(): string;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
shell_exec('rm -rf ' . $this->targetFile());
|
||||
|
||||
$this->builder = new Builder();
|
||||
$this->builder->getConfiguration()->setUseCachedMetas(false);
|
||||
$this->configureBuilder($this->builder);
|
||||
$this->builder->build($this->sourceFile(), $this->targetFile());
|
||||
}
|
||||
|
||||
protected function configureBuilder(Builder $builder): void
|
||||
{
|
||||
}
|
||||
|
||||
protected function sourceFile(string $file = ''): string
|
||||
{
|
||||
return __DIR__ . '/' . $this->getFixturesDirectory() . '/input/' . $file;
|
||||
}
|
||||
|
||||
protected function targetFile(string $file = ''): string
|
||||
{
|
||||
return __DIR__ . '/' . $this->getFixturesDirectory() . '/output/' . $file;
|
||||
}
|
||||
|
||||
/** @throws Exception */
|
||||
protected function getFileContents(string $path): string
|
||||
{
|
||||
$contents = file_get_contents($path);
|
||||
|
||||
if ($contents === false) {
|
||||
throw new Exception('Could not load file.');
|
||||
}
|
||||
|
||||
return $contents;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue