Skip to content

Commit

Permalink
Merge pull request #13 from teaandcode/develop
Browse files Browse the repository at this point in the history
Merge Develop into Master
  • Loading branch information
knasher committed Oct 23, 2015
2 parents 6ff9655 + 046f074 commit 3ff1f67
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
28 changes: 28 additions & 0 deletions spec/Behat/GuzzleExtension/Context/GuzzleContextSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,4 +267,32 @@ public function it_has_i_call_command_but_response_contains_wrong_resource_count
'\Guzzle\Http\Exception\ClientErrorResponseException'
)->duringTheResponseContainsResourceWithTheFollowingData(1, $table);
}

public function it_should_retrieve_stored_values_by_key()
{
$client1 = $this->getMockedClient(
new Response(
200,
array(
'Content-Type' => 'application/json'
),
'[{"foo":"bar"},{"foo":"fu"}]'
)
);

$output = new TableNode(
array(
array('foo'),
array('bar'),
array('fu')
)
);

$this->setGuzzleClient($client1);
$this->iCallCommand('Mock');
$this->theResponseContainsResourceWithTheFollowingData(2, $output);
$this->theResponseIsStored('test');

$this->getStoredValue('test');
}
}
15 changes: 14 additions & 1 deletion src/Behat/GuzzleExtension/Context/GuzzleContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public function theResponseContainsTheFollowingValueFromJSON(
}

/**
*
*
* Example: Then the response contains 2 resources with the following data:
* | id | importance | username |
* | 27 | 3 | bruce.wayne |
Expand Down Expand Up @@ -386,6 +386,19 @@ public function theResponseIsStored($name)
$this->storedResult[$name] = $this->getGuzzleResult();
}

/**
* Get stored value
*
* @param string $name Name used when storing response
*
* @access public
* @return mixed
*/
public function getStoredValue($name)
{
return $this->storedResult[$name];
}

/**
* Cast value into type depending on content
*
Expand Down

0 comments on commit 3ff1f67

Please sign in to comment.