|
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-2015 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 Mockery as m; |
|
16
|
|
|
use phpDocumentor\Reflection\DocBlock; |
|
17
|
|
|
use phpDocumentor\Reflection\Fqsen; |
|
18
|
|
|
use PHPUnit\Framework\TestCase; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Tests the functionality for the Interface_ class. |
|
22
|
|
|
* @coversDefaultClass phpDocumentor\Reflection\Php\Interface_ |
|
23
|
|
|
*/ |
|
24
|
|
|
// @codingStandardsIgnoreStart |
|
25
|
|
|
class Interface_Test extends TestCase |
|
26
|
|
|
// @codingStandardsIgnoreEnd |
|
27
|
|
|
{ |
|
28
|
|
|
/** @var Interface_ $fixture */ |
|
29
|
|
|
private $fixture; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @var Fqsen |
|
33
|
|
|
*/ |
|
34
|
|
|
private $fqsen; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @var DocBlock |
|
38
|
|
|
*/ |
|
39
|
|
|
private $docBlock; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Creates a new (empty) fixture object. |
|
43
|
|
|
*/ |
|
44
|
|
|
protected function setUp() |
|
45
|
|
|
{ |
|
46
|
|
|
$this->fqsen = new Fqsen('\MySpace\MyInterface'); |
|
47
|
|
|
$this->docBlock = new DocBlock(''); |
|
48
|
|
|
$this->fixture = new Interface_($this->fqsen, array(), $this->docBlock); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
protected function tearDown() |
|
52
|
|
|
{ |
|
53
|
|
|
m::close(); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @covers ::__construct |
|
58
|
|
|
* @covers ::getFqsen |
|
59
|
|
|
*/ |
|
60
|
|
|
public function testGetFqsen() |
|
61
|
|
|
{ |
|
62
|
|
|
$this->assertSame($this->fqsen, $this->fixture->getFqsen()); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @covers ::__construct |
|
67
|
|
|
* @covers ::getDocBlock |
|
68
|
|
|
*/ |
|
69
|
|
|
public function testGetDocblock() |
|
70
|
|
|
{ |
|
71
|
|
|
$this->assertSame($this->docBlock, $this->fixture->getDocBlock()); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @covers ::addConstant |
|
76
|
|
|
* @covers ::getConstants |
|
77
|
|
|
*/ |
|
78
|
|
|
public function testSettingAndGettingConstants() |
|
79
|
|
|
{ |
|
80
|
|
|
$this->assertEquals(array(), $this->fixture->getConstants()); |
|
81
|
|
|
|
|
82
|
|
|
$constant = new Constant(new Fqsen('\MySpace\MyInterface::MY_CONSTANT')); |
|
83
|
|
|
|
|
84
|
|
|
$this->fixture->addConstant($constant); |
|
85
|
|
|
|
|
86
|
|
|
$this->assertEquals(array('\MySpace\MyInterface::MY_CONSTANT' => $constant), $this->fixture->getConstants()); |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* @covers ::addMethod |
|
91
|
|
|
* @covers ::getMethods |
|
92
|
|
|
*/ |
|
93
|
|
|
public function testSettingAndGettingMethods() |
|
94
|
|
|
{ |
|
95
|
|
|
$this->assertEquals(array(), $this->fixture->getMethods()); |
|
96
|
|
|
|
|
97
|
|
|
$method = new Method(new Fqsen('\MySpace\MyInterface::myMethod()')); |
|
98
|
|
|
|
|
99
|
|
|
$this->fixture->addMethod($method); |
|
100
|
|
|
|
|
101
|
|
|
$this->assertEquals(array('\MySpace\MyInterface::myMethod()' => $method), $this->fixture->getMethods()); |
|
102
|
|
|
} |
|
103
|
|
|
} |
|
104
|
|
|
|