-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
70 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Tests\RST; | ||
|
||
use Doctrine\RST\Builder; | ||
use PHPUnit\Framework\TestCase; | ||
use function file_exists; | ||
use function file_get_contents; | ||
use function shell_exec; | ||
|
||
/** | ||
* Unit testing build with ".. include::" directive | ||
*/ | ||
class BuilderIncludeTest extends TestCase | ||
{ | ||
public function testTocTreeGlob() : void | ||
{ | ||
shell_exec('rm -rf ' . $this->targetFile()); | ||
$builder = new Builder(); | ||
$builder->setUseRelativeUrls(true); | ||
$builder->build($this->sourceFile(), $this->targetFile(), false); | ||
|
||
self::assertTrue(file_exists($this->targetFile('index.html'))); | ||
self::assertContains('This file is included', file_get_contents($this->targetFile('index.html'))); | ||
|
||
foreach ($builder->getDocuments() as $document) { | ||
foreach ($document->getEnvironment()->getMetas()->getAll() as $meta) { | ||
foreach ($meta->getTocs() as $toc) { | ||
self::assertNotContains('include.inc', $toc); | ||
} | ||
} | ||
} | ||
} | ||
|
||
private function sourceFile(string $file = '') : string | ||
{ | ||
return __DIR__ . '/builder-include/input/' . $file; | ||
} | ||
|
||
private function targetFile(string $file = '') : string | ||
{ | ||
return __DIR__ . '/builder-include/output/' . $file; | ||
} | ||
} |
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 @@ | ||
output |
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,4 @@ | ||
File | ||
==== | ||
|
||
a file |
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 @@ | ||
This file is included |
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,9 @@ | ||
Test include | ||
============ | ||
|
||
.. include:: include.rst.inc | ||
|
||
.. toctree:: | ||
:glob: | ||
|
||
* |