1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* phpDocumentor |
4
|
|
|
* |
5
|
|
|
* PHP Version 5.3 |
6
|
|
|
* |
7
|
|
|
* @copyright 2010-2013 Mike van Riel / Naenius (http://www.naenius.com) |
8
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php MIT |
9
|
|
|
* @link http://phpdoc.org |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace phpDocumentor\Descriptor; |
13
|
|
|
|
14
|
|
|
use \Mockery as m; |
15
|
|
|
use phpDocumentor\Reflection\Types\String_; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @coversDefaultClass \phpDocumentor\Descriptor\FunctionDescriptor |
19
|
|
|
*/ |
20
|
|
|
class FunctionDescriptorTest extends \Mockery\Adapter\Phpunit\MockeryTestCase |
21
|
|
|
{ |
22
|
|
|
/** @var FunctionDescriptor $fixture */ |
23
|
|
|
protected $fixture; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Creates a new (emoty) fixture object. |
27
|
|
|
*/ |
28
|
|
|
protected function setUp() |
29
|
|
|
{ |
30
|
|
|
$this->fixture = new FunctionDescriptor(); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @covers ::__construct |
35
|
|
|
*/ |
36
|
|
|
public function testInitialize() |
37
|
|
|
{ |
38
|
|
|
$this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'arguments', $this->fixture); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @covers ::setArguments |
43
|
|
|
* @covers ::getArguments |
44
|
|
|
*/ |
45
|
|
|
public function testSettingAndGettingArguments() |
46
|
|
|
{ |
47
|
|
|
$this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getArguments()); |
48
|
|
|
|
49
|
|
|
$mockInstance = m::mock('phpDocumentor\Descriptor\Collection'); |
50
|
|
|
$mock = &$mockInstance; |
51
|
|
|
|
52
|
|
|
$this->fixture->setArguments($mock); |
53
|
|
|
|
54
|
|
|
$this->assertSame($mockInstance, $this->fixture->getArguments()); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @covers ::getResponse |
59
|
|
|
* @covers ::setReturnType |
60
|
|
|
*/ |
61
|
|
|
public function testSettingAndGettingReturnType() |
62
|
|
|
{ |
63
|
|
|
$stringType = new String_(); |
64
|
|
|
$this->fixture->setReturnType($stringType); |
65
|
|
|
|
66
|
|
|
$this->assertSame('return', $this->fixture->getResponse()->getName()); |
67
|
|
|
$this->assertSame($stringType, $this->fixture->getResponse()->getTypes()); |
68
|
|
|
} |
69
|
|
|
} |
70
|
|
|
|