-
-
Notifications
You must be signed in to change notification settings - Fork 15
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 #867 from phpDocumentor/task/ignore-domain
[TASK] Ignore domains with unknows directives and textroles
- Loading branch information
Showing
12 changed files
with
140 additions
and
14 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
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
53 changes: 53 additions & 0 deletions
53
packages/guides-restructured-text/tests/unit/TextRoles/GenericTextRoleTest.php
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,53 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of phpDocumentor. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @link https://phpdoc.org | ||
*/ | ||
|
||
namespace phpDocumentor\Guides\RestructuredText\TextRoles; | ||
|
||
use phpDocumentor\Guides\Nodes\Inline\GenericTextRoleInlineNode; | ||
use phpDocumentor\Guides\Nodes\Inline\PlainTextInlineNode; | ||
use phpDocumentor\Guides\RestructuredText\Parser\DocumentParserContext; | ||
use phpDocumentor\Guides\Settings\ProjectSettings; | ||
use phpDocumentor\Guides\Settings\SettingsManager; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class GenericTextRoleTest extends TestCase | ||
{ | ||
private SettingsManager $settingsManager; | ||
private ProjectSettings $projectSettings; | ||
private GenericTextRole $subject; | ||
private DocumentParserContext $documentParserContext; | ||
|
||
public function setUp(): void | ||
{ | ||
$this->projectSettings = new ProjectSettings(); | ||
$this->settingsManager = new SettingsManager($this->projectSettings); | ||
$this->documentParserContext = self::createMock(DocumentParserContext::class); | ||
$this->subject = new GenericTextRole( | ||
$this->settingsManager, | ||
); | ||
} | ||
|
||
public function testIgnoredDomainReturnsPlainTextInlineNode(): void | ||
{ | ||
$this->projectSettings->setIgnoredDomains(['ignored', 'alsoignored']); | ||
$inline = $this->subject->processNode($this->documentParserContext, 'ignored:role', '', ''); | ||
self::assertInstanceOf(PlainTextInlineNode::class, $inline); | ||
} | ||
|
||
public function testUnknownDomainReturnsGenericTextRoleInlineNode(): void | ||
{ | ||
$this->projectSettings->setIgnoredDomains(['ignored', 'alsoignored']); | ||
$inline = $this->subject->processNode($this->documentParserContext, 'notignored:role', '', ''); | ||
self::assertInstanceOf(GenericTextRoleInlineNode::class, $inline); | ||
} | ||
} |
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