1<?php declare(strict_types=1);
2
3namespace PhpParser\Node\Stmt;
4
5use PhpParser\Modifiers;
6
7class ClassConstTest extends \PHPUnit\Framework\TestCase {
8    /**
9     * @dataProvider provideModifiers
10     */
11    public function testModifiers($modifier): void {
12        $node = new ClassConst(
13            [], // invalid
14            constant(Modifiers::class . '::' . strtoupper($modifier))
15        );
16
17        $this->assertTrue($node->{'is' . $modifier}());
18    }
19
20    public function testNoModifiers(): void {
21        $node = new ClassConst([], 0);
22
23        $this->assertTrue($node->isPublic());
24        $this->assertFalse($node->isProtected());
25        $this->assertFalse($node->isPrivate());
26        $this->assertFalse($node->isFinal());
27    }
28
29    public static function provideModifiers() {
30        return [
31            ['public'],
32            ['protected'],
33            ['private'],
34            ['final'],
35        ];
36    }
37}
38