|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* PyPI plugin for HiDev |
|
5
|
|
|
* |
|
6
|
|
|
* @link https://github.com/hiqdev/hidev-pypi |
|
7
|
|
|
* @package hidev-pypi |
|
8
|
|
|
* @license BSD-3-Clause |
|
9
|
|
|
* @copyright Copyright (c) 2016, HiQDev (http://hiqdev.com/) |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace hidev\pypi\tests\unit\controllers; |
|
13
|
|
|
|
|
14
|
|
|
use hidev\pypi\controllers\SetupPyController; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Tests for SetupPyController. |
|
18
|
|
|
*/ |
|
19
|
|
|
class SetupPyControllerTest extends \PHPUnit_Framework_TestCase |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* @var SetupPyController |
|
23
|
|
|
*/ |
|
24
|
|
|
protected $object; |
|
25
|
|
|
|
|
26
|
|
|
private $ops = [ |
|
27
|
|
|
'name' => 'test', |
|
28
|
|
|
'version' => '0.0.0', |
|
29
|
|
|
'license' => 'MIT', |
|
30
|
|
|
'url' => 'http://url.url/url', |
|
31
|
|
|
'author' => 'Some Body', |
|
32
|
|
|
'author_email' => 'some@email', |
|
33
|
|
|
]; |
|
34
|
|
|
|
|
35
|
|
|
protected function setUp() |
|
36
|
|
|
{ |
|
37
|
|
|
$this->object = new SetupPyController('setup.py', null, $this->ops); |
|
|
|
|
|
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
public function testConstructor() |
|
41
|
|
|
{ |
|
42
|
|
|
$this->assertInstanceOf('hidev\base\Controller', $this->object); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function testGetName() |
|
46
|
|
|
{ |
|
47
|
|
|
$this->assertSame($this->ops['name'], $this->object->getName()); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function testGetVersion() |
|
51
|
|
|
{ |
|
52
|
|
|
$this->assertSame($this->ops['version'], $this->object->getVersion()); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function testGetLicense() |
|
56
|
|
|
{ |
|
57
|
|
|
$this->assertSame($this->ops['license'], $this->object->getLicense()); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function testGetPackages() |
|
61
|
|
|
{ |
|
62
|
|
|
$this->assertSame($this->ops['name'], $this->object->getPackages()); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
public function testGetUrl() |
|
66
|
|
|
{ |
|
67
|
|
|
$this->assertSame($this->ops['url'], $this->object->getUrl()); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
public function testGetAuthor() |
|
71
|
|
|
{ |
|
72
|
|
|
$this->assertSame($this->ops['author'], $this->object->getAuthor()); |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
public function testGetAuthorEmail() |
|
76
|
|
|
{ |
|
77
|
|
|
$this->assertSame($this->ops['author_email'], $this->object->getAuthorEmail()); |
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: