Issues (133)

tests/Bpost/HttpRequestBuilder/FetchOrderTest.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Tests\Bpost\HttpRequestBuilder;
4
5
use Bpost\BpostApiClient\Bpost\HttpRequestBuilder\FetchOrder;
6
use PHPUnit_Framework_TestCase;
7
8
class FetchOrderTest extends PHPUnit_Framework_TestCase
9
{
10
    /**
11
     * @param array  $input
12
     * @param string $url
13
     * @param string $xml
14
     * @param string $method
15
     * @param bool   $isExpectXml
16
     * @param array  $headers
17
     *
18
     * @return void
19
     *
20
     * @dataProvider dataResults
21
     */
22
    public function testResults(array $input, $url, $xml, $headers, $method, $isExpectXml)
23
    {
24
        $builder = new FetchOrder($input[0]);
25
26
        $this->assertSame($url, $builder->getUrl());
27
        $this->assertSame($method, $builder->getMethod());
28
        $this->assertSame($xml, $builder->getXml());
0 ignored issues
show
Are you sure the usage of $builder->getXml() targeting Bpost\BpostApiClient\Bpo...er\FetchOrder::getXml() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
29
        $this->assertSame($isExpectXml, $builder->isExpectXml());
30
        $this->assertSame($headers, $builder->getHeaders());
31
    }
32
33
    public function dataResults()
34
    {
35
        return array(
36
            array(
37
                'input' => array('123'),
38
                'url' => '/orders/123',
39
                'xml' => null,
40
                'headers' => array('Accept: application/vnd.bpost.shm-order-v3.3+XML'),
41
                'method' => 'GET',
42
                'isExpectXml' => true,
43
            ),
44
        );
45
    }
46
}
47