InterfaceTest.php 802 B

1234567891011121314151617181920212223242526
  1. <?php declare(strict_types=1);
  2. namespace PhpParser\Node\Stmt;
  3. use PhpParser\Node;
  4. class InterfaceTest extends \PHPUnit\Framework\TestCase
  5. {
  6. public function testGetMethods() {
  7. $methods = [
  8. new ClassMethod('foo'),
  9. new ClassMethod('bar'),
  10. ];
  11. $interface = new Class_('Foo', [
  12. 'stmts' => [
  13. new Node\Stmt\ClassConst([new Node\Const_('C1', new Node\Scalar\String_('C1'))]),
  14. $methods[0],
  15. new Node\Stmt\ClassConst([new Node\Const_('C2', new Node\Scalar\String_('C2'))]),
  16. $methods[1],
  17. new Node\Stmt\ClassConst([new Node\Const_('C3', new Node\Scalar\String_('C3'))]),
  18. ]
  19. ]);
  20. $this->assertSame($methods, $interface->getMethods());
  21. }
  22. }