1 | <?php |
||
8 | class XmlContext extends BaseContext |
||
9 | { |
||
10 | /** |
||
11 | * Checks that the response is correct XML |
||
12 | * |
||
13 | * @Then the response should be in XML |
||
14 | */ |
||
15 | public function theResponseShouldBeInXml() |
||
19 | |||
20 | /** |
||
21 | * Checks that the response is not correct XML |
||
22 | * |
||
23 | * @Then the response should not be in XML |
||
24 | */ |
||
25 | public function theResponseShouldNotBeInXml() |
||
32 | |||
33 | /** |
||
34 | * Checks that the specified XML element exists |
||
35 | * |
||
36 | * @param string $element |
||
37 | * @throws \Exception |
||
38 | * @return \DomNodeList |
||
39 | * |
||
40 | * @Then the XML element :element should exist(s) |
||
41 | */ |
||
42 | public function theXmlElementShouldExist($element) |
||
53 | |||
54 | /** |
||
55 | * Checks that the specified XML element does not exist |
||
56 | * |
||
57 | * @Then the XML element :element should not exist(s) |
||
58 | */ |
||
59 | public function theXmlElementShouldNotExist($element) |
||
65 | |||
66 | /** |
||
67 | * Checks that the specified XML element is equal to the given value |
||
68 | * |
||
69 | * @Then the XML element :element should be equal to :text |
||
70 | */ |
||
71 | public function theXmlElementShouldBeEqualTo($element, $text) |
||
81 | |||
82 | /** |
||
83 | * Checks that the specified XML element is not equal to the given value |
||
84 | * |
||
85 | * @Then the XML element :element should not be equal to :text |
||
86 | */ |
||
87 | public function theXmlElementShouldNotBeEqualTo($element, $text) |
||
93 | |||
94 | /** |
||
95 | * Checks that the XML attribute on the specified element exists |
||
96 | * |
||
97 | * @Then the XML attribute :attribute on element :element should exist(s) |
||
98 | */ |
||
99 | public function theXmlAttributeShouldExist($attribute, $element) |
||
111 | |||
112 | /** |
||
113 | * Checks that the XML attribute on the specified element does not exist |
||
114 | * |
||
115 | * @Then the XML attribute :attribute on element :element should not exist(s) |
||
116 | */ |
||
117 | public function theXmlAttributeShouldNotExist($attribute, $element) |
||
121 | |||
122 | /** |
||
123 | * Checks that the XML attribute on the specified element is equal to the given value |
||
124 | * |
||
125 | * @Then the XML attribute :attribute on element :element should be equal to :text |
||
126 | */ |
||
127 | public function theXmlAttributeShouldBeEqualTo($attribute, $element, $text) |
||
135 | |||
136 | /** |
||
137 | * Checks that the XML attribute on the specified element is not equal to the given value |
||
138 | * |
||
139 | * @Then the XML attribute :attribute on element :element should not be equal to :text |
||
140 | */ |
||
141 | public function theXmlAttributeShouldNotBeEqualTo($attribute, $element, $text) |
||
149 | |||
150 | /** |
||
151 | * Checks that the given XML element has N child element(s) |
||
152 | * |
||
153 | * @Then the XML element :element should have :count element(s) |
||
154 | */ |
||
155 | public function theXmlElementShouldHaveNChildElements($element, $count) |
||
168 | |||
169 | /** |
||
170 | * Checks that the given XML element contains the given value |
||
171 | * |
||
172 | * @Then the XML element :element should contain :text |
||
173 | */ |
||
174 | public function theXmlElementShouldContain($element, $text) |
||
180 | |||
181 | /** |
||
182 | * Checks that the given XML element does not contain the given value |
||
183 | * |
||
184 | * @Then the XML element :element should not contain :text |
||
185 | */ |
||
186 | public function theXmlElementShouldNotContain($element, $text) |
||
192 | |||
193 | /** |
||
194 | * Checks that the XML uses the specified namespace |
||
195 | * |
||
196 | * @Then the XML should use the namespace :namespace |
||
197 | */ |
||
198 | public function theXmlShouldUseTheNamespace($namespace) |
||
207 | |||
208 | /** |
||
209 | * Checks that the XML does not use the specified namespace |
||
210 | * |
||
211 | * @Then the XML should not use the namespace :namespace |
||
212 | */ |
||
213 | public function theXmlShouldNotUseTheNamespace($namespace) |
||
222 | |||
223 | /** |
||
224 | * Optimistically (ignoring errors) attempt to pretty-print the last XML response |
||
225 | * |
||
226 | * @Then print last XML response |
||
227 | */ |
||
228 | public function printLastXmlResponse() |
||
232 | |||
233 | /** |
||
234 | * @BeforeScenario |
||
235 | */ |
||
236 | public function beforeScenario() |
||
241 | |||
242 | /** |
||
243 | * @Then the XML feed should be valid according to its DTD |
||
244 | */ |
||
245 | public function theXmlFeedShouldBeValidAccordingToItsDtd() |
||
254 | |||
255 | /** |
||
256 | * @Then the XML feed should be valid according to the XSD :filename |
||
257 | */ |
||
258 | public function theXmlFeedShouldBeValidAccordingToTheXsd($filename) |
||
269 | |||
270 | /** |
||
271 | * @Then the XML feed should be valid according to this XSD: |
||
272 | */ |
||
273 | public function theXmlFeedShouldBeValidAccordingToThisXsd(PyStringNode $xsd) |
||
278 | |||
279 | /** |
||
280 | * @Then the XML feed should be valid according to the relax NG schema :filename |
||
281 | */ |
||
282 | public function theXmlFeedShouldBeValidAccordingToTheRelaxNgSchema($filename) |
||
293 | |||
294 | /** |
||
295 | * @Then the XML feed should be valid according to this relax NG schema: |
||
296 | */ |
||
297 | public function theXmlFeedShouldBeValidAccordingToThisRelaxNgSchema(PyStringNode $ng) |
||
302 | |||
303 | /** |
||
304 | * @Then the atom feed should be valid |
||
305 | */ |
||
306 | public function theAtomFeedShouldBeValid() |
||
312 | |||
313 | /** |
||
314 | * @Then the RSS2 feed should be valid |
||
315 | */ |
||
316 | public function theRss2FeedShouldBeValid() |
||
322 | |||
323 | private function getDom() |
||
329 | } |
||
330 |