Issues (112)

tests/Geo6/PoiTest.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Tests\Geo6;
4
5
use Bpost\BpostApiClient\Geo6\Poi;
6
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...
7
8
class PoiTest extends PHPUnit_Framework_TestCase
9
{
10
    /**
11
     * Tests Poi::createFromXml()
12
     */
13
    public function testCreateFromXml()
14
    {
15
        $xml = simplexml_load_string($this->getXml());
16
17
        $poi = Poi::createFromXML($xml);
18
19
        $this->assertSame('220000', $poi->getId());
20
        $this->assertSame('1', $poi->getType());
21
        $this->assertSame('GENT CENTRUM', $poi->getOffice());
22
        $this->assertSame('Lange Kruisstraat', $poi->getStreet());
23
        $this->assertSame('55', $poi->getNr());
24
        $this->assertSame('9000', $poi->getZip());
25
        $this->assertSame('Gent', $poi->getCity());
26
        $this->assertSame(104918, $poi->getX());
27
        $this->assertSame(193708, $poi->getY());
28
        $this->assertSame(3.72581, $poi->getLongitude());
29
        $this->assertSame(51.05178, $poi->getLatitude());
30
        $this->assertNotNull($poi->getHours());
31
32
        $hours = $poi->getHours();
33
        $this->assertCount(7, $hours);
34
        $this->assertArrayHasKey(1, $hours); // Monday
35
36
        $this->assertSame('9:00', $hours[1]->getAmOpen());
37
        $this->assertNull($hours[1]->getAmClose());
38
        $this->assertNull($hours[1]->getPmOpen());
39
        $this->assertSame('18:00', $hours[1]->getPmClose());
40
41
        $this->assertNull($poi->getClosedFrom());
42
        $this->assertNull($poi->getClosedTo());
43
        $this->assertNull($poi->getNote());
44
45
        $this->assertSame(
46
            'https://taxipost.geo6.be/Locator?Function=page&Partner=999999&Id=220000&Type=1&Language=NL',
47
            $poi->getPage()
48
        );
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    private function getXml()
55
    {
56
        return <<< XML
57
<Poi>
58
  <Record>
59
    <ID>220000</ID>
60
    <Type>1</Type>
61
    <OFFICE>GENT CENTRUM</OFFICE>
62
    <STREET>Lange Kruisstraat</STREET>
63
    <NR>55</NR>
64
    <ZIP>9000</ZIP>
65
    <CITY>Gent</CITY>
66
    <X>104918</X>
67
    <Y>193708</Y>
68
    <Longitude>3.72581</Longitude>
69
    <Latitude>51.05178</Latitude>
70
    <Services>
71
      <Service category="2" flag="10">Loket met Bancontact/Mistercash</Service>
72
    </Services>
73
    <Hours>
74
      <Monday>
75
        <AMOpen>9:00</AMOpen>
76
        <AMClose></AMClose>
77
        <PMOpen></PMOpen>
78
        <PMClose>18:00</PMClose>
79
      </Monday>
80
      <Tuesday>
81
        <AMOpen>9:00</AMOpen>
82
        <AMClose></AMClose>
83
        <PMOpen></PMOpen>
84
        <PMClose>18:00</PMClose>
85
      </Tuesday>
86
      <Wednesday>
87
        <AMOpen>9:00</AMOpen>
88
        <AMClose></AMClose>
89
        <PMOpen></PMOpen>
90
        <PMClose>18:00</PMClose>
91
      </Wednesday>
92
      <Thursday>
93
        <AMOpen>9:00</AMOpen>
94
        <AMClose></AMClose>
95
        <PMOpen></PMOpen>
96
        <PMClose>18:00</PMClose>
97
      </Thursday>
98
      <Friday>
99
        <AMOpen>9:00</AMOpen>
100
        <AMClose></AMClose>
101
        <PMOpen></PMOpen>
102
        <PMClose>18:00</PMClose>
103
      </Friday>
104
      <Saturday>
105
        <AMOpen>9:00</AMOpen>
106
        <AMClose></AMClose>
107
        <PMOpen></PMOpen>
108
        <PMClose>15:00</PMClose>
109
      </Saturday>
110
      <Sunday>
111
        <AMOpen></AMOpen>
112
        <AMClose></AMClose>
113
        <PMOpen></PMOpen>
114
        <PMClose></PMClose>
115
      </Sunday>
116
    </Hours>
117
    <ClosedFrom></ClosedFrom>
118
    <ClosedTo></ClosedTo>
119
    <NOTE></NOTE>
120
  </Record>
121
  <Page ServiceRef="https://taxipost.geo6.be/Locator?Function=page&amp;Partner=999999&amp;Id=220000&amp;Type=1&amp;Language=NL"/>
122
</Poi>
123
XML;
124
    }
125
}
126