Yaffs site version 1.1
[yaffs-website] / vendor / psy / psysh / test / Psy / Test / Reflection / ReflectionConstantTest.php
1 <?php
2
3 /*
4  * This file is part of Psy Shell.
5  *
6  * (c) 2012-2017 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->assertTrue($class instanceof \ReflectionClass);
26         $this->assertEquals('Psy\Test\Reflection\ReflectionConstantTest', $class->getName());
27         $this->assertEquals('CONSTANT_ONE', $refl->getName());
28         $this->assertEquals('CONSTANT_ONE', (string) $refl);
29         $this->assertEquals('one', $refl->getValue());
30         $this->assertEquals(null, $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 array(
55             array('getStartLine'),
56             array('getEndLine'),
57             array('export'),
58         );
59     }
60 }