1<?php declare(strict_types=1);
2
3namespace PhpParser\Node\Stmt;
4
5use PhpParser\Node;
6use PhpParser\Node\Scalar\String_;
7
8class InterfaceTest extends \PHPUnit\Framework\TestCase {
9    public function testGetMethods(): void {
10        $methods = [
11            new ClassMethod('foo'),
12            new ClassMethod('bar'),
13        ];
14        $interface = new Interface_('Foo', [
15            'stmts' => [
16                new Node\Stmt\ClassConst([new Node\Const_('C1', new Node\Scalar\String_('C1'))]),
17                $methods[0],
18                new Node\Stmt\ClassConst([new Node\Const_('C2', new Node\Scalar\String_('C2'))]),
19                $methods[1],
20                new Node\Stmt\ClassConst([new Node\Const_('C3', new Node\Scalar\String_('C3'))]),
21            ]
22        ]);
23
24        $this->assertSame($methods, $interface->getMethods());
25    }
26
27    public function testGetConstants(): void {
28        $constants = [
29            new ClassConst([new \PhpParser\Node\Const_('foo', new String_('foo_value'))]),
30            new ClassConst([new \PhpParser\Node\Const_('bar', new String_('bar_value'))]),
31        ];
32        $class = new Interface_('Foo', [
33            'stmts' => [
34                new TraitUse([]),
35                $constants[0],
36                new ClassMethod('fooBar'),
37                $constants[1],
38            ]
39        ]);
40
41        $this->assertSame($constants, $class->getConstants());
42    }
43}
44