ClassConstTest.php 879 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace PhpParser\Node\Stmt;
  3. class ClassConstTest extends \PHPUnit_Framework_TestCase
  4. {
  5. /**
  6. * @dataProvider provideModifiers
  7. */
  8. public function testModifiers($modifier) {
  9. $node = new ClassConst(
  10. array(), // invalid
  11. constant('PhpParser\Node\Stmt\Class_::MODIFIER_' . strtoupper($modifier))
  12. );
  13. $this->assertTrue($node->{'is' . $modifier}());
  14. }
  15. public function testNoModifiers() {
  16. $node = new ClassConst(array(), 0);
  17. $this->assertTrue($node->isPublic());
  18. $this->assertFalse($node->isProtected());
  19. $this->assertFalse($node->isPrivate());
  20. $this->assertFalse($node->isStatic());
  21. }
  22. public function provideModifiers() {
  23. return array(
  24. array('public'),
  25. array('protected'),
  26. array('private'),
  27. );
  28. }
  29. }