Skip to content

Commit be782ce

Browse files
committed
Added tests for EnumMethodsClassReflectionExtension
1 parent 97c57e0 commit be782ce

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

tests/unit/EnumMethodReflectionTest.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ public function setUp(): void
3131
$this->reflectionExtension = new EnumMethodsClassReflectionExtension();
3232
}
3333

34+
public function testGetName(): void
35+
{
36+
$classReflection = $this->broker->getClass(VisibilityEnum::class);
37+
$methodReflection = $this->reflectionExtension->getMethod($classReflection, 'STR');
38+
39+
$this->assertSame('STR', $methodReflection->getName());
40+
}
41+
3442
public function testGetDeclaringClass(): void
3543
{
3644
$classReflection = $this->broker->getClass(VisibilityEnum::class);
@@ -63,6 +71,14 @@ public function testShouldBePublic(): void
6371
$this->assertTrue($methodReflection->isPublic());
6472
}
6573

74+
public function testGetPrototype(): void
75+
{
76+
$classReflection = $this->broker->getClass(VisibilityEnum::class);
77+
$methodReflection = $this->reflectionExtension->getMethod($classReflection, 'STR');
78+
79+
$this->assertSame($methodReflection, $methodReflection->getPrototype());
80+
}
81+
6682
public function testGetVariants(): void
6783
{
6884
$classReflection = $this->broker->getClass(VisibilityEnum::class);
@@ -107,4 +123,36 @@ public function testGetDeprecatedDescription(): void
107123
$this->assertSame('Test deprecated reflection', $deprecatedRefl->getDeprecatedDescription());
108124
$this->assertNull($notDeprecatedRefl->getDeprecatedDescription());
109125
}
126+
127+
public function testIsFinal(): void
128+
{
129+
$classReflection = $this->broker->getClass(DeprecatedEnum::class);
130+
$methodReflection = $this->reflectionExtension->getMethod($classReflection, 'STR');
131+
132+
$this->assertTrue($methodReflection->isFinal()->no());
133+
}
134+
135+
public function testIsInternal(): void
136+
{
137+
$classReflection = $this->broker->getClass(DeprecatedEnum::class);
138+
$methodReflection = $this->reflectionExtension->getMethod($classReflection, 'STR');
139+
140+
$this->assertTrue($methodReflection->isInternal()->no());
141+
}
142+
143+
public function testGetThrowType(): void
144+
{
145+
$classReflection = $this->broker->getClass(DeprecatedEnum::class);
146+
$methodReflection = $this->reflectionExtension->getMethod($classReflection, 'STR');
147+
148+
$this->assertNull($methodReflection->getThrowType());
149+
}
150+
151+
public function testHasSideEffects(): void
152+
{
153+
$classReflection = $this->broker->getClass(DeprecatedEnum::class);
154+
$methodReflection = $this->reflectionExtension->getMethod($classReflection, 'STR');
155+
156+
$this->assertTrue($methodReflection->hasSideEffects()->no());
157+
}
110158
}

0 commit comments

Comments
 (0)