BarcodeTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 11
dl 0
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testCreateFromXML() 0 6 1
A getBarcodeXml() 0 3 1
1
<?php
2
3
namespace Tests\Bpost\Label;
4
5
use Bpost\BpostApiClient\Bpost\Label\Barcode;
6
use PHPUnit_Framework_TestCase;
0 ignored issues
show
Bug introduced by
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...
7
use SimpleXMLElement;
8
9
class BarcodeTest extends PHPUnit_Framework_TestCase
10
{
11
    private function getBarcodeXml()
12
    {
13
        return <<<XML
14
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
15
<barcodeWithReference xmlns="http://schema.post.be/shm/deepintegration/v3/" xmlns:ns2="http://schema.post.be/shm/deepintegration/v3/common" xmlns:ns3="http://schema.post.be/shm/deepintegration/v3/national" xmlns:ns4="http://schema.post.be/shm/deepintegration/v3/international">
16
  <barcode>323299901059912015292030</barcode>
17
  <reference>test_barcode_with_reference</reference>
18
</barcodeWithReference>
19
XML;
20
    }
21
22
    public function testCreateFromXML()
23
    {
24
        $self = Barcode::createFromXML(new SimpleXMLElement($this->getBarcodeXml()));
25
26
        $this->assertSame('323299901059912015292030', $self->getBarcode());
27
        $this->assertSame('test_barcode_with_reference', $self->getReference());
28
    }
29
}
30