|
8 | 8 | use ClassWithMethodsAndTraitMethods; |
9 | 9 | use Closure; |
10 | 10 | use ExtendedClassWithMethodsAndTraitMethods; |
| 11 | +use Php4StyleCaseInsensitiveConstruct; |
| 12 | +use Php4StyleConstruct; |
11 | 13 | use PHPUnit\Framework\TestCase; |
12 | 14 | use Reflection; |
13 | 15 | use ReflectionClass; |
|
36 | 38 | use Roave\BetterReflectionTest\Fixture\ExampleClass; |
37 | 39 | use Roave\BetterReflectionTest\Fixture\InterfaceWithMethod; |
38 | 40 | use Roave\BetterReflectionTest\Fixture\Methods; |
| 41 | +use Roave\BetterReflectionTest\Fixture\Php4StyleConstructInNamespace; |
39 | 42 | use Roave\BetterReflectionTest\Fixture\TraitWithStaticMethod; |
40 | 43 | use Roave\BetterReflectionTest\Fixture\TraitWithStaticMethodToUse; |
41 | 44 | use Roave\BetterReflectionTest\Fixture\UpperCaseConstructDestruct; |
@@ -161,6 +164,33 @@ public function testIsConstructorDestructorIsCaseInsensitive(): void |
161 | 164 | self::assertTrue($method->isDestructor()); |
162 | 165 | } |
163 | 166 |
|
| 167 | + public function testIsConstructorWhenPhp4Style(): void |
| 168 | + { |
| 169 | + $reflector = new DefaultReflector(new SingleFileSourceLocator(__DIR__ . '/../Fixture/Php4StyleConstruct.php', $this->astLocator)); |
| 170 | + $classInfo = $reflector->reflectClass(Php4StyleConstruct::class); |
| 171 | + |
| 172 | + $method = $classInfo->getMethod('Php4StyleConstruct'); |
| 173 | + self::assertTrue($method->isConstructor()); |
| 174 | + } |
| 175 | + |
| 176 | + public function testsIsConstructorWhenPhp4StyleInNamespace(): void |
| 177 | + { |
| 178 | + $reflector = new DefaultReflector(new SingleFileSourceLocator(__DIR__ . '/../Fixture/Php4StyleConstructInNamespace.php', $this->astLocator)); |
| 179 | + $classInfo = $reflector->reflectClass(Php4StyleConstructInNamespace::class); |
| 180 | + |
| 181 | + $method = $classInfo->getMethod('Php4StyleConstructInNamespace'); |
| 182 | + self::assertFalse($method->isConstructor()); |
| 183 | + } |
| 184 | + |
| 185 | + public function testIsConstructorWhenPhp4StyleCaseInsensitive(): void |
| 186 | + { |
| 187 | + $reflector = new DefaultReflector(new SingleFileSourceLocator(__DIR__ . '/../Fixture/Php4StyleCaseInsensitiveConstruct.php', $this->astLocator)); |
| 188 | + $classInfo = $reflector->reflectClass(Php4StyleCaseInsensitiveConstruct::class); |
| 189 | + |
| 190 | + $method = $classInfo->getMethod('PHP4STYLECASEINSENSITIVECONSTRUCT'); |
| 191 | + self::assertTrue($method->isConstructor()); |
| 192 | + } |
| 193 | + |
164 | 194 | public function testGetParameters(): void |
165 | 195 | { |
166 | 196 | $classInfo = $this->reflector->reflectClass(Methods::class); |
|
0 commit comments