@@ 26-36 (lines=11) @@ | ||
23 | $this->assertEquals(19.56, $loc->getCoordinates()->getLong()); |
|
24 | } |
|
25 | ||
26 | public function testMissingNameFields() |
|
27 | { |
|
28 | $this->setExpectedException('Symfony\Component\OptionsResolver\Exception\MissingOptionsException'); |
|
29 | $options = [ |
|
30 | "coordinates" => [ |
|
31 | "lat" => 21.12, |
|
32 | "long" => 19.56 |
|
33 | ] |
|
34 | ]; |
|
35 | new Location($options); |
|
36 | } |
|
37 | ||
38 | public function testMissingCoordinatesField() |
|
39 | { |
|
@@ 47-57 (lines=11) @@ | ||
44 | new Location($options); |
|
45 | } |
|
46 | ||
47 | public function testMissingLatField() |
|
48 | { |
|
49 | $this->setExpectedException('Symfony\Component\OptionsResolver\Exception\MissingOptionsException'); |
|
50 | $options = [ |
|
51 | "name" => "Eiffel Tower", |
|
52 | "coordinates" => [ |
|
53 | "lat" => 21.12, |
|
54 | ] |
|
55 | ]; |
|
56 | new Location($options); |
|
57 | } |
|
58 | ||
59 | public function testNameWrongType() |
|
60 | { |
|
@@ 59-70 (lines=12) @@ | ||
56 | new Location($options); |
|
57 | } |
|
58 | ||
59 | public function testNameWrongType() |
|
60 | { |
|
61 | $this->setExpectedException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); |
|
62 | $options = [ |
|
63 | "name" => [], |
|
64 | "coordinates" => [ |
|
65 | "lat" => 21.12, |
|
66 | "long" => 19.56 |
|
67 | ] |
|
68 | ]; |
|
69 | new Location($options); |
|
70 | } |
|
71 | ||
72 | public function testCoordinatesWrongType() |
|
73 | { |
|
@@ 82-93 (lines=12) @@ | ||
79 | new Location($options); |
|
80 | } |
|
81 | ||
82 | public function testLatWrongType() |
|
83 | { |
|
84 | $this->setExpectedException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); |
|
85 | $options = [ |
|
86 | "name" => 'Eiffel Tower', |
|
87 | "coordinates" => [ |
|
88 | 'lat' => [], |
|
89 | 'long' => 19.56, |
|
90 | ] |
|
91 | ]; |
|
92 | new Location($options); |
|
93 | } |
|
94 | ||
95 | public function testLongWrongType() |
|
96 | { |
|
@@ 95-106 (lines=12) @@ | ||
92 | new Location($options); |
|
93 | } |
|
94 | ||
95 | public function testLongWrongType() |
|
96 | { |
|
97 | $this->setExpectedException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); |
|
98 | $options = [ |
|
99 | "name" => 'Eiffel Tower', |
|
100 | "coordinates" => [ |
|
101 | 'lat' => 19.56, |
|
102 | 'long' => "", |
|
103 | ] |
|
104 | ]; |
|
105 | new Location($options); |
|
106 | } |
|
107 | } |
|
108 |