File tree Expand file tree Collapse file tree 2 files changed +42
-1
lines changed
spec/Behat/GuzzleExtension/Context
src/Behat/GuzzleExtension/Context Expand file tree Collapse file tree 2 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -267,4 +267,32 @@ public function it_has_i_call_command_but_response_contains_wrong_resource_count
267267 '\Guzzle\Http\Exception\ClientErrorResponseException '
268268 )->duringTheResponseContainsResourceWithTheFollowingData (1 , $ table );
269269 }
270+
271+ public function it_should_retrieve_stored_values_by_key ()
272+ {
273+ $ client1 = $ this ->getMockedClient (
274+ new Response (
275+ 200 ,
276+ array (
277+ 'Content-Type ' => 'application/json '
278+ ),
279+ '[{"foo":"bar"},{"foo":"fu"}] '
280+ )
281+ );
282+
283+ $ output = new TableNode (
284+ array (
285+ array ('foo ' ),
286+ array ('bar ' ),
287+ array ('fu ' )
288+ )
289+ );
290+
291+ $ this ->setGuzzleClient ($ client1 );
292+ $ this ->iCallCommand ('Mock ' );
293+ $ this ->theResponseContainsResourceWithTheFollowingData (2 , $ output );
294+ $ this ->theResponseIsStored ('test ' );
295+
296+ $ this ->getStoredValue ('test ' );
297+ }
270298}
Original file line number Diff line number Diff line change @@ -336,7 +336,7 @@ public function theResponseContainsTheFollowingValueFromJSON(
336336 }
337337
338338 /**
339- *
339+ *
340340 * Example: Then the response contains 2 resources with the following data:
341341 * | id | importance | username |
342342 * | 27 | 3 | bruce.wayne |
@@ -386,6 +386,19 @@ public function theResponseIsStored($name)
386386 $ this ->storedResult [$ name ] = $ this ->getGuzzleResult ();
387387 }
388388
389+ /**
390+ * Get stored value
391+ *
392+ * @param string $name Name used when storing response
393+ *
394+ * @access public
395+ * @return mixed
396+ */
397+ public function getStoredValue ($ name )
398+ {
399+ return $ this ->storedResult [$ name ];
400+ }
401+
389402 /**
390403 * Cast value into type depending on content
391404 *
You can’t perform that action at this time.
0 commit comments