菜谱项目

InterfaceTest.php 807B

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