SetupPyControllerTest   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 9
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 61
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testConstructor() 0 4 1
A testGetName() 0 4 1
A testGetVersion() 0 4 1
A testGetLicense() 0 4 1
A testGetPackages() 0 4 1
A testGetUrl() 0 4 1
A testGetAuthor() 0 4 1
A testGetAuthorEmail() 0 4 1
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);
0 ignored issues
show
Documentation introduced by
null is of type null, but the function expects a object<yii\base\Module>.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
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