GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

DocumentLiteralWrapperTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 57
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A shouldWrapReturn() 0 9 1
B shouldNotWrapReturn() 0 28 1
1
<?php
2
use Mocks\MockClass;
3
use WSDL\DocumentLiteralWrapper;
4
5
class DocumentLiteralWrapperTest extends PHPUnit_Framework_TestCase
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
6
{
7
    private $_handler;
8
    private $_unwrapped;
9
10
    public function setUp()
11
    {
12
        parent::setUp();
13
        $this->_handler = new DocumentLiteralWrapper(new MockClass());
14
        $this->_unwrapped = new MockClass();
15
    }
16
17
    /**
18
     * @test
19
     */
20
    public function shouldWrapReturn()
21
    {
22
        //when
23
        $result = $this->_handler->arrayOfMockUser();
0 ignored issues
show
Documentation Bug introduced by
The method arrayOfMockUser does not exist on object<WSDL\DocumentLiteralWrapper>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
24
25
        //then
26
        $this->assertTrue(isset($result->mockUsers));
27
        $this->assertEquals($result->mockUsers, $this->_unwrapped->arrayOfMockUser());
28
    }
29
30
    /**
31
     * @test
32
     */
33
    public function shouldNotWrapReturn()
34
    {
35
        //when 1
36
        $params = new stdClass();
37
        $params->a = 1;
38
        $params->b = 1;
39
        $result = $this->_handler->sum($params);
0 ignored issues
show
Documentation Bug introduced by
The method sum does not exist on object<WSDL\DocumentLiteralWrapper>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
40
41
        //then 1
42
        $this->assertFalse(is_object($result));
43
        $this->assertEquals(2, $result);
44
45
        //when 2
46
        $params = new stdClass();
47
        $params->a = 1;
48
        $result = $this->_handler->noReturnFunction($params);
0 ignored issues
show
Documentation Bug introduced by
The method noReturnFunction does not exist on object<WSDL\DocumentLiteralWrapper>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
49
50
        //then 2
51
        $this->assertNull($result);
52
53
        //when 3
54
        $params = new stdClass();
55
        $params->a = 1;
56
        $result = $this->_handler->voidReturnFunction($params);
0 ignored issues
show
Documentation Bug introduced by
The method voidReturnFunction does not exist on object<WSDL\DocumentLiteralWrapper>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
57
58
        //then 3
59
        $this->assertNull($result);
60
    }
61
}
62