713a7e33720194dfc13e8d61a27f4c766712c631
[yaffs-website] / vendor / psy / psysh / test / Reflection / ReflectionConstantTest.php
1 <?php
2
3 /*
4  * This file is part of Psy Shell.
5  *
6  * (c) 2012-2018 Justin Hileman
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Psy\Test\Reflection;
13
14 use Psy\Reflection\ReflectionConstant;
15
16 class ReflectionConstantTest extends \PHPUnit\Framework\TestCase
17 {
18     const CONSTANT_ONE = 'one';
19
20     public function testConstruction()
21     {
22         $refl  = new ReflectionConstant($this, 'CONSTANT_ONE');
23         $class = $refl->getDeclaringClass();
24
25         $this->assertInstanceOf('ReflectionClass', $class);
26         $this->assertSame('Psy\Test\Reflection\ReflectionConstantTest', $class->getName());
27         $this->assertSame('CONSTANT_ONE', $refl->getName());
28         $this->assertSame('CONSTANT_ONE', (string) $refl);
29         $this->assertSame('one', $refl->getValue());
30         $this->assertNull($refl->getFileName());
31         $this->assertFalse($refl->getDocComment());
32     }
33
34     /**
35      * @expectedException \InvalidArgumentException
36      */
37     public function testUnknownConstantThrowsException()
38     {
39         new ReflectionConstant($this, 'UNKNOWN_CONSTANT');
40     }
41
42     /**
43      * @expectedException \RuntimeException
44      * @dataProvider notYetImplemented
45      */
46     public function testNotYetImplemented($method)
47     {
48         $refl = new ReflectionConstant($this, 'CONSTANT_ONE');
49         $refl->$method();
50     }
51
52     public function notYetImplemented()
53     {
54         return [
55             ['getStartLine'],
56             ['getEndLine'],
57             ['export'],
58         ];
59     }
60 }