Issues (112)

tests/Bpack247/CustomerPackStationTest.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Tests\Bpack247;
4
5
use Bpost\BpostApiClient\Bpack247\CustomerPackStation;
6
use DOMDocument;
7
use PHPUnit_Framework_TestCase;
0 ignored issues
show
The type PHPUnit_Framework_TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
9
class CustomerPackStationTest extends PHPUnit_Framework_TestCase
10
{
11
    /**
12
     * Create a generic DOM Document
13
     *
14
     * @return DOMDocument
15
     */
16
    private static function createDomDocument()
17
    {
18
        $document = new DOMDocument('1.0', 'utf-8');
19
        $document->preserveWhiteSpace = false;
20
        $document->formatOutput = true;
21
22
        return $document;
23
    }
24
25
    /**
26
     * Tests CustomerPackStation->toXML
27
     */
28
    public function testCreateFromXML()
29
    {
30
        $data = array(
31
            'CustomLabel' => 'CustomLabel',
32
            'OrderNumber' => '1',
33
            'PackstationID' => '14472',
34
        );
35
36
        $document = self::createDomDocument();
37
        $customerPackStationElement = $document->createElement('CustomerPackStation');
38
        foreach ($data as $key => $value) {
39
            $customerPackStationElement->appendChild(
40
                $document->createElement($key, $value)
41
            );
42
        }
43
        $document->appendChild($customerPackStationElement);
44
45
        $customerPackStation = CustomerPackStation::createFromXML(
46
            simplexml_load_string(
47
                $document->saveXML()
48
            )
49
        );
50
51
        $this->assertSame($data['CustomLabel'], $customerPackStation->getCustomLabel());
52
        $this->assertSame($data['OrderNumber'], $customerPackStation->getOrderNumber());
53
        $this->assertSame($data['PackstationID'], $customerPackStation->getPackstationId());
54
    }
55
}
56