MagicConstTest.php 823 B

12345678910111213141516171819202122232425
  1. <?php declare(strict_types=1);
  2. namespace PhpParser\Node\Scalar;
  3. class MagicConstTest extends \PHPUnit\Framework\TestCase {
  4. /**
  5. * @dataProvider provideTestGetName
  6. */
  7. public function testGetName(MagicConst $magicConst, $name): void {
  8. $this->assertSame($name, $magicConst->getName());
  9. }
  10. public static function provideTestGetName() {
  11. return [
  12. [new MagicConst\Class_(), '__CLASS__'],
  13. [new MagicConst\Dir(), '__DIR__'],
  14. [new MagicConst\File(), '__FILE__'],
  15. [new MagicConst\Function_(), '__FUNCTION__'],
  16. [new MagicConst\Line(), '__LINE__'],
  17. [new MagicConst\Method(), '__METHOD__'],
  18. [new MagicConst\Namespace_(), '__NAMESPACE__'],
  19. [new MagicConst\Trait_(), '__TRAIT__'],
  20. ];
  21. }
  22. }