1<?php declare(strict_types=1); 2 3namespace PhpParser\Node; 4 5class IdentifierTest extends \PHPUnit\Framework\TestCase { 6 public function testConstructorThrows(): void { 7 self::expectException(\InvalidArgumentException::class); 8 new Identifier(''); 9 } 10 11 public function testToString(): void { 12 $identifier = new Identifier('Foo'); 13 14 $this->assertSame('Foo', (string) $identifier); 15 $this->assertSame('Foo', $identifier->toString()); 16 $this->assertSame('foo', $identifier->toLowerString()); 17 } 18 19 /** @dataProvider provideTestIsSpecialClassName */ 20 public function testIsSpecialClassName($identifier, $expected): void { 21 $identifier = new Identifier($identifier); 22 $this->assertSame($expected, $identifier->isSpecialClassName()); 23 } 24 25 public static function provideTestIsSpecialClassName() { 26 return [ 27 ['self', true], 28 ['PARENT', true], 29 ['Static', true], 30 ['other', false], 31 ]; 32 } 33} 34