annotate vendor/psy/psysh/test/Reflection/ReflectionConstantTest.php @ 13:5fb285c0d0e3
Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've
been lucky to get away with this so far, as we don't support self-registration
which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5
was vulnerable to.
author |
Chris Cannam |
date |
Mon, 23 Apr 2018 09:33:26 +0100 |
parents |
|
children |
c2387f117808 |
rev |
line source |
Chris@13
|
1 <?php
|
Chris@13
|
2
|
Chris@13
|
3 /*
|
Chris@13
|
4 * This file is part of Psy Shell.
|
Chris@13
|
5 *
|
Chris@13
|
6 * (c) 2012-2018 Justin Hileman
|
Chris@13
|
7 *
|
Chris@13
|
8 * For the full copyright and license information, please view the LICENSE
|
Chris@13
|
9 * file that was distributed with this source code.
|
Chris@13
|
10 */
|
Chris@13
|
11
|
Chris@13
|
12 namespace Psy\Test\Reflection;
|
Chris@13
|
13
|
Chris@13
|
14 use Psy\Reflection\ReflectionConstant;
|
Chris@13
|
15
|
Chris@13
|
16 class ReflectionConstantTest extends \PHPUnit\Framework\TestCase
|
Chris@13
|
17 {
|
Chris@13
|
18 const CONSTANT_ONE = 'one';
|
Chris@13
|
19
|
Chris@13
|
20 public function testConstruction()
|
Chris@13
|
21 {
|
Chris@13
|
22 $refl = new ReflectionConstant($this, 'CONSTANT_ONE');
|
Chris@13
|
23 $class = $refl->getDeclaringClass();
|
Chris@13
|
24
|
Chris@13
|
25 $this->assertInstanceOf('ReflectionClass', $class);
|
Chris@13
|
26 $this->assertSame('Psy\Test\Reflection\ReflectionConstantTest', $class->getName());
|
Chris@13
|
27 $this->assertSame('CONSTANT_ONE', $refl->getName());
|
Chris@13
|
28 $this->assertSame('CONSTANT_ONE', (string) $refl);
|
Chris@13
|
29 $this->assertSame('one', $refl->getValue());
|
Chris@13
|
30 $this->assertNull($refl->getFileName());
|
Chris@13
|
31 $this->assertFalse($refl->getDocComment());
|
Chris@13
|
32 }
|
Chris@13
|
33
|
Chris@13
|
34 /**
|
Chris@13
|
35 * @expectedException \InvalidArgumentException
|
Chris@13
|
36 */
|
Chris@13
|
37 public function testUnknownConstantThrowsException()
|
Chris@13
|
38 {
|
Chris@13
|
39 new ReflectionConstant($this, 'UNKNOWN_CONSTANT');
|
Chris@13
|
40 }
|
Chris@13
|
41
|
Chris@13
|
42 /**
|
Chris@13
|
43 * @expectedException \RuntimeException
|
Chris@13
|
44 * @dataProvider notYetImplemented
|
Chris@13
|
45 */
|
Chris@13
|
46 public function testNotYetImplemented($method)
|
Chris@13
|
47 {
|
Chris@13
|
48 $refl = new ReflectionConstant($this, 'CONSTANT_ONE');
|
Chris@13
|
49 $refl->$method();
|
Chris@13
|
50 }
|
Chris@13
|
51
|
Chris@13
|
52 public function notYetImplemented()
|
Chris@13
|
53 {
|
Chris@13
|
54 return [
|
Chris@13
|
55 ['getStartLine'],
|
Chris@13
|
56 ['getEndLine'],
|
Chris@13
|
57 ['export'],
|
Chris@13
|
58 ];
|
Chris@13
|
59 }
|
Chris@13
|
60 }
|