Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Solve Deprecations in unit tests #990

Merged
merged 2 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static function simpleNonAnnotationProvider(): array
public function testAnnotationNodeFromLinesIterator(
string $input,
AnnotationListNode $node,
string|null $nextLine = null,
string|null $remaining = null,
bool $nextLiteral = false,
): void {
$blockParser = $this->createContext($input);
Expand All @@ -83,7 +83,7 @@ public function testAnnotationNodeFromLinesIterator(
$result,
);

self::assertSame($nextLine, $blockParser->getDocumentIterator()->getNextLine());
self::assertSame($remaining, $blockParser->getDocumentIterator()->getNextLine());
self::assertSame($nextLiteral, $blockParser->getDocumentParserContext()->nextIndentedBlockShouldBeALiteralBlock);
}

Expand All @@ -93,27 +93,27 @@ public static function annotationProvider(): array
return [
'single line citation' => [
'input' => '.. [name] Some Citation',
'output' => new AnnotationListNode([new CitationNode([InlineCompoundNode::getPlainTextInlineNode('Some Citation')], 'name')], 'citation-list'),
'node' => new AnnotationListNode([new CitationNode([InlineCompoundNode::getPlainTextInlineNode('Some Citation')], 'name')], 'citation-list'),
],
'single line Anonymous numbered footnote' => [
'input' => '.. [#] Anonymous numbered footnote',
'output' => new AnnotationListNode([new FootnoteNode([InlineCompoundNode::getPlainTextInlineNode('Anonymous numbered footnote')], '#', 0)], 'footer-list'),
'node' => new AnnotationListNode([new FootnoteNode([InlineCompoundNode::getPlainTextInlineNode('Anonymous numbered footnote')], '#', 0)], 'footer-list'),
],
'single line Numbered footnote' => [
'input' => '.. [42] Numbered footnote',
'output' => new AnnotationListNode([new FootnoteNode([InlineCompoundNode::getPlainTextInlineNode('Numbered footnote')], '', 42)], 'footer-list'),
'node' => new AnnotationListNode([new FootnoteNode([InlineCompoundNode::getPlainTextInlineNode('Numbered footnote')], '', 42)], 'footer-list'),
],
'single line named footnote' => [
'input' => '.. [#somename] Named footnote',
'output' => new AnnotationListNode([new FootnoteNode([InlineCompoundNode::getPlainTextInlineNode('Named footnote')], '#somename', 0)], 'footer-list'),
'node' => new AnnotationListNode([new FootnoteNode([InlineCompoundNode::getPlainTextInlineNode('Named footnote')], '#somename', 0)], 'footer-list'),
],
'multi line citation' => [
'input' => <<<'RST'
.. [name] some multiline
annotation
RST
,
'output' => new AnnotationListNode([
'node' => new AnnotationListNode([
new CitationNode(
[
InlineCompoundNode::getPlainTextInlineNode(
Expand All @@ -136,7 +136,7 @@ public static function annotationProvider(): array
This is a new paragraph
RST
,
'output' => new AnnotationListNode([
'node' => new AnnotationListNode([
new CitationNode(
[
InlineCompoundNode::getPlainTextInlineNode(
Expand All @@ -159,7 +159,7 @@ public static function annotationProvider(): array
This is a new paragraph
RST
,
'output' => new AnnotationListNode([
'node' => new AnnotationListNode([
new FootnoteNode(
[
InlineCompoundNode::getPlainTextInlineNode(
Expand All @@ -183,7 +183,7 @@ public static function annotationProvider(): array
This is a new paragraph
RST
,
'output' => new AnnotationListNode([
'node' => new AnnotationListNode([
new FootnoteNode(
[
InlineCompoundNode::getPlainTextInlineNode(
Expand All @@ -208,7 +208,7 @@ public static function annotationProvider(): array
This is a new paragraph
RST
,
'output' => new AnnotationListNode([
'node' => new AnnotationListNode([
new FootnoteNode(
[
InlineCompoundNode::getPlainTextInlineNode('Footnote 1'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ final class ParagraphRuleTest extends RuleTestCase
#[DataProvider('paragraphProvider')]
public function testParagraphNodeFromLinesIterator(
string $input,
ParagraphNode $node,
string|null $nextLine,
ParagraphNode $output,
string|null $remaining,
bool $nextLiteral = false,
): void {
$blockParser = $this->createContext($input);
Expand All @@ -43,11 +43,11 @@ public function testParagraphNodeFromLinesIterator(
self::assertTrue($rule->applies($blockParser));
$result = $rule->apply($blockParser);
self::assertEquals(
$node,
$output,
$result,
);

self::assertSame($nextLine, $blockParser->getDocumentIterator()->getNextLine());
self::assertSame($remaining, $blockParser->getDocumentIterator()->getNextLine());
self::assertSame($nextLiteral, $blockParser->getDocumentParserContext()->nextIndentedBlockShouldBeALiteralBlock);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ public function setUp(): void
#[DataProvider('referenceProvider')]
public function testReferenceIsParsedIntoRefReferenceNode(
string $span,
string $url,
string $referenceName,
string|null $text = null,
): void {
$result = $this->referenceTextRole->processNode($this->documentParserContext, 'doc', $span, $span);

self::assertInstanceOf(ReferenceNode::class, $result);
self::assertEquals($url, $result->getTargetReference(), 'ReferenceNames are different');
self::assertEquals($referenceName, $result->getTargetReference(), 'ReferenceNames are different');
self::assertEquals($text ?? '', $result->toString());
}

Expand Down
Loading