1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of phpDocumentor. |
4
|
|
|
* |
5
|
|
|
* For the full copyright and license information, please view the LICENSE |
6
|
|
|
* file that was distributed with this source code. |
7
|
|
|
* |
8
|
|
|
* @copyright 2010-2018 Mike van Riel<[email protected]> |
9
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php MIT |
10
|
|
|
* @link http://phpdoc.org |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace phpDocumentor\Reflection\Php; |
14
|
|
|
|
15
|
|
|
use phpDocumentor\Reflection\DocBlock; |
16
|
|
|
use phpDocumentor\Reflection\Fqsen; |
17
|
|
|
use PHPUnit\Framework\TestCase; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Tests the functionality for the Constant class. |
21
|
|
|
* @coversDefaultClass phpDocumentor\Reflection\Php\Constant |
22
|
|
|
*/ |
23
|
|
|
class ConstantTest extends TestCase |
24
|
|
|
{ |
25
|
|
|
/** @var Constant $fixture */ |
26
|
|
|
protected $fixture; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var Fqsen |
30
|
|
|
*/ |
31
|
|
|
private $fqsen; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var DocBlock |
35
|
|
|
*/ |
36
|
|
|
private $docBlock; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var string |
40
|
|
|
*/ |
41
|
|
|
private $value = 'Value'; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Creates a new (empty) fixture object. |
45
|
|
|
*/ |
46
|
|
|
protected function setUp() |
47
|
|
|
{ |
48
|
|
|
$this->fqsen = new Fqsen('\MySpace\CONSTANT'); |
49
|
|
|
$this->docBlock = new DocBlock(''); |
50
|
|
|
$this->fixture = new Constant($this->fqsen, $this->docBlock, $this->value); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @covers ::getValue |
55
|
|
|
* @covers ::__construct |
56
|
|
|
*/ |
57
|
|
|
public function testGetValue() |
58
|
|
|
{ |
59
|
|
|
$this->assertSame($this->value, $this->fixture->getValue()); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @covers ::__construct |
64
|
|
|
* @covers ::getFqsen |
65
|
|
|
* @covers ::getName |
66
|
|
|
*/ |
67
|
|
|
public function testGetFqsen() |
68
|
|
|
{ |
69
|
|
|
$this->assertSame($this->fqsen, $this->fixture->getFqsen()); |
70
|
|
|
$this->assertSame($this->fqsen->getName(), $this->fixture->getName()); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @covers ::__construct |
75
|
|
|
* @covers ::getDocBlock |
76
|
|
|
*/ |
77
|
|
|
public function testGetDocblock() |
78
|
|
|
{ |
79
|
|
|
$this->assertSame($this->docBlock, $this->fixture->getDocBlock()); |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|