菜谱项目

MagicConstTest.php 813B

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