Skip to content

Commit e0e8460

Browse files
committed
Fix tests
1 parent 3744be6 commit e0e8460

50 files changed

Lines changed: 467 additions & 434 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

libs/phpdoc/tests/DocBlock/Description/DescriptionTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ public function constructorStoresValue(): void
1616
{
1717
$description = new Description('Some text');
1818

19-
$this->assertSame('Some text', $description->value);
19+
self::assertSame('Some text', $description->value);
2020
}
2121

2222
#[Test]
2323
public function valueDefaultsToEmptyString(): void
2424
{
25-
$this->assertSame('', new Description()->value);
25+
self::assertSame('', new Description()->value);
2626
}
2727

2828
#[Test]
2929
public function implementsDescriptionInterface(): void
3030
{
31-
$this->assertInstanceOf(DescriptionInterface::class, new Description());
31+
self::assertInstanceOf(DescriptionInterface::class, new Description());
3232
}
3333
}

libs/phpdoc/tests/DocBlock/Description/TaggedDescriptionTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ public function constructorStoresComponentsAsList(): void
2121

2222
$description = new TaggedDescription([5 => $first, 9 => $second]);
2323

24-
$this->assertSame([$first, $second], $description->components);
24+
self::assertSame([$first, $second], $description->components);
2525
}
2626

2727
#[Test]
2828
public function componentsDefaultToEmptyList(): void
2929
{
30-
$this->assertSame([], new TaggedDescription()->components);
30+
self::assertSame([], new TaggedDescription()->components);
3131
}
3232

3333
#[Test]
@@ -37,7 +37,7 @@ public function constructorAcceptsTraversable(): void
3737

3838
$description = new TaggedDescription(new \ArrayIterator([$tag]));
3939

40-
$this->assertSame([$tag], $description->components);
40+
self::assertSame([$tag], $description->components);
4141
}
4242

4343
#[Test]
@@ -51,15 +51,15 @@ public function tagsContainsOnlyTagComponents(): void
5151
new Description(' more'),
5252
]);
5353

54-
$this->assertSame([$tag], $description->tags);
54+
self::assertSame([$tag], $description->tags);
5555
}
5656

5757
#[Test]
5858
public function tagsIsEmptyWithoutTagComponents(): void
5959
{
6060
$description = new TaggedDescription([new Description('only text')]);
6161

62-
$this->assertSame([], $description->tags);
62+
self::assertSame([], $description->tags);
6363
}
6464

6565
#[Test]
@@ -71,16 +71,16 @@ public function countReturnsNumberOfComponents(): void
7171
new Description('b'),
7272
]);
7373

74-
$this->assertCount(3, $description);
74+
self::assertCount(3, $description);
7575
}
7676

7777
#[Test]
7878
public function offsetExistsReflectsComponentPresence(): void
7979
{
8080
$description = new TaggedDescription([new Description('a')]);
8181

82-
$this->assertTrue(isset($description[0]));
83-
$this->assertFalse(isset($description[1]));
82+
self::assertTrue(isset($description[0]));
83+
self::assertFalse(isset($description[1]));
8484
}
8585

8686
#[Test]
@@ -89,13 +89,13 @@ public function offsetGetReturnsComponent(): void
8989
$component = new Description('a');
9090
$description = new TaggedDescription([$component]);
9191

92-
$this->assertSame($component, $description[0]);
92+
self::assertSame($component, $description[0]);
9393
}
9494

9595
#[Test]
9696
public function offsetGetReturnsNullForMissingOffset(): void
9797
{
98-
$this->assertNull(new TaggedDescription()[42]);
98+
self::assertNull(new TaggedDescription()[42]);
9999
}
100100

101101
#[Test]
@@ -124,14 +124,14 @@ public function iteratorYieldsAllComponentsInOrder(): void
124124
$components = [new Description('a'), new Tag('see'), new Description('b')];
125125
$description = new TaggedDescription($components);
126126

127-
$this->assertSame($components, \iterator_to_array($description, false));
127+
self::assertSame($components, \iterator_to_array($description, false));
128128
}
129129

130130
#[Test]
131131
public function tagComponentsAreTagInterfaceInstances(): void
132132
{
133133
$description = new TaggedDescription([new Tag('see')]);
134134

135-
$this->assertContainsOnlyInstancesOf(TagInterface::class, $description->tags);
135+
self::assertContainsOnlyInstancesOf(TagInterface::class, $description->tags);
136136
}
137137
}

libs/phpdoc/tests/DocBlock/DocBlockTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@ final class DocBlockTest extends TestCase
1515
#[Test]
1616
public function descriptionDefaultsToNull(): void
1717
{
18-
$this->assertNull(new DocBlock()->description);
18+
self::assertNull(new DocBlock()->description);
1919
}
2020

2121
#[Test]
2222
public function constructorKeepsExistingDescriptionInstance(): void
2323
{
2424
$description = new Description('Summary');
2525

26-
$this->assertSame($description, new DocBlock($description)->description);
26+
self::assertSame($description, new DocBlock($description)->description);
2727
}
2828

2929
#[Test]
3030
public function tagsDefaultToEmptyList(): void
3131
{
32-
$this->assertSame([], new DocBlock()->tags);
32+
self::assertSame([], new DocBlock()->tags);
3333
}
3434

3535
#[Test]
@@ -40,7 +40,7 @@ public function constructorStoresTagsAsList(): void
4040

4141
$docblock = new DocBlock(null, [3 => $first, 7 => $second]);
4242

43-
$this->assertSame([$first, $second], $docblock->tags);
43+
self::assertSame([$first, $second], $docblock->tags);
4444
}
4545

4646
#[Test]
@@ -50,24 +50,24 @@ public function constructorAcceptsTraversableTags(): void
5050

5151
$docblock = new DocBlock(null, new \ArrayIterator([$tag]));
5252

53-
$this->assertSame([$tag], $docblock->tags);
53+
self::assertSame([$tag], $docblock->tags);
5454
}
5555

5656
#[Test]
5757
public function countReturnsNumberOfTags(): void
5858
{
5959
$docblock = new DocBlock(null, [new Tag('param'), new Tag('return')]);
6060

61-
$this->assertCount(2, $docblock);
61+
self::assertCount(2, $docblock);
6262
}
6363

6464
#[Test]
6565
public function offsetExistsReflectsTagPresence(): void
6666
{
6767
$docblock = new DocBlock(null, [new Tag('param')]);
6868

69-
$this->assertTrue(isset($docblock[0]));
70-
$this->assertFalse(isset($docblock[1]));
69+
self::assertTrue(isset($docblock[0]));
70+
self::assertFalse(isset($docblock[1]));
7171
}
7272

7373
#[Test]
@@ -76,13 +76,13 @@ public function offsetGetReturnsTag(): void
7676
$tag = new Tag('param');
7777
$docblock = new DocBlock(null, [$tag]);
7878

79-
$this->assertSame($tag, $docblock[0]);
79+
self::assertSame($tag, $docblock[0]);
8080
}
8181

8282
#[Test]
8383
public function offsetGetReturnsNullForMissingOffset(): void
8484
{
85-
$this->assertNull(new DocBlock()[42]);
85+
self::assertNull(new DocBlock()[42]);
8686
}
8787

8888
#[Test]
@@ -111,6 +111,6 @@ public function iteratorYieldsAllTagsInOrder(): void
111111
$tags = [new Tag('param'), new Tag('return')];
112112
$docblock = new DocBlock(null, $tags);
113113

114-
$this->assertSame($tags, \iterator_to_array($docblock, false));
114+
self::assertSame($tags, \iterator_to_array($docblock, false));
115115
}
116116
}

libs/phpdoc/tests/DocBlock/Tag/InvalidTagTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function constructorStoresName(): void
1616
{
1717
$tag = new InvalidTag(new \RuntimeException(), 'param');
1818

19-
$this->assertSame('param', $tag->name);
19+
self::assertSame('param', $tag->name);
2020
}
2121

2222
#[Test]
@@ -25,20 +25,20 @@ public function constructorStoresReason(): void
2525
$reason = new \RuntimeException('broken');
2626
$tag = new InvalidTag($reason, 'param');
2727

28-
$this->assertSame($reason, $tag->reason);
28+
self::assertSame($reason, $tag->reason);
2929
}
3030

3131
#[Test]
3232
public function descriptionDefaultsToNull(): void
3333
{
34-
$this->assertNull(new InvalidTag(new \RuntimeException(), 'param')->description);
34+
self::assertNull(new InvalidTag(new \RuntimeException(), 'param')->description);
3535
}
3636

3737
#[Test]
3838
public function isAnInvalidTag(): void
3939
{
4040
$tag = new InvalidTag(new \RuntimeException(), 'param');
4141

42-
$this->assertInstanceOf(Tag::class, $tag);
42+
self::assertInstanceOf(Tag::class, $tag);
4343
}
4444
}

libs/phpdoc/tests/DocBlock/Tag/TagTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,26 @@ final class TagTest extends TestCase
1919
#[Test]
2020
public function constructorStoresName(): void
2121
{
22-
$this->assertSame('param', new Tag('param')->name);
22+
self::assertSame('param', new Tag('param')->name);
2323
}
2424

2525
#[Test]
2626
public function descriptionDefaultsToNull(): void
2727
{
28-
$this->assertNull(new Tag('param')->description);
28+
self::assertNull(new Tag('param')->description);
2929
}
3030

3131
#[Test]
3232
public function constructorKeepsExistingDescriptionInstance(): void
3333
{
3434
$description = new Description('int $a');
3535

36-
$this->assertSame($description, new Tag('param', $description)->description);
36+
self::assertSame($description, new Tag('param', $description)->description);
3737
}
3838

3939
#[Test]
4040
public function implementsTagInterface(): void
4141
{
42-
$this->assertInstanceOf(TagInterface::class, new Tag('param'));
42+
self::assertInstanceOf(TagInterface::class, new Tag('param'));
4343
}
4444
}

libs/types/src/Callable/CallableParameterNode.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ public function __construct(
1919
public bool $isOptional = false,
2020
public ?AttributeGroupListNode $attributes = null,
2121
) {
22-
assert($type !== null || $name !== null, new \TypeError(
22+
\assert($type !== null || $name !== null, new \TypeError(
2323
'Required indication of the type or name of the parameter (one of)',
2424
));
2525

26-
assert($isVariadic === false || $isOptional === false, new \TypeError(
26+
\assert($isVariadic === false || $isOptional === false, new \TypeError(
2727
'Parameter cannot be both variable and optional (variadic parameter is already optional)',
2828
));
2929
}

libs/types/src/Name.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function __construct(
6767
) {
6868
$segments = \iterator_to_array($segments, false);
6969

70-
assert($segments !== [], new \InvalidArgumentException('Name segments count can not be empty'));
70+
\assert($segments !== [], new \InvalidArgumentException('Name segments count can not be empty'));
7171

7272
$this->segments = $segments;
7373
}

libs/types/tests/Attribute/AttributeArgumentNodeTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ public function constructorStoresValue(): void
1919
$value = new NamedTypeNode(Name::createFromString('string'));
2020
$node = new AttributeArgumentNode($value);
2121

22-
$this->assertSame($value, $node->value);
22+
self::assertSame($value, $node->value);
2323
}
2424

2525
#[Test]
2626
public function attributesDefaultToNull(): void
2727
{
2828
$node = new AttributeArgumentNode(new NamedTypeNode(Name::createFromString('int')));
2929

30-
$this->assertNull($node->attributes);
30+
self::assertNull($node->attributes);
3131
}
3232

3333
#[Test]
@@ -37,14 +37,14 @@ public function constructorStoresAttributes(): void
3737
$value = new NamedTypeNode(Name::createFromString('int'));
3838
$node = new AttributeArgumentNode($value, $attrs);
3939

40-
$this->assertSame($attrs, $node->attributes);
40+
self::assertSame($attrs, $node->attributes);
4141
}
4242

4343
#[Test]
4444
public function defaultOffsetIsZero(): void
4545
{
4646
$node = new AttributeArgumentNode(new NamedTypeNode(Name::createFromString('int')));
4747

48-
$this->assertSame(0, $node->offset);
48+
self::assertSame(0, $node->offset);
4949
}
5050
}

0 commit comments

Comments
 (0)