Skip to content

Commit

Permalink
- Removed commented out code
Browse files Browse the repository at this point in the history
- Removed extraneous padding
- Incremented version to 0.3.3
  • Loading branch information
knasher committed Apr 13, 2015
1 parent 919f636 commit 301fe7a
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 217 deletions.
210 changes: 4 additions & 206 deletions spec/Behat/GuzzleExtension/Context/GuzzleContextSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ protected function getMockedClient(Response $response)
{
$operation = new Operation(
array(
'name' => 'Mock',
'httpMethod' => 'GET'
'httpMethod' => 'GET',
'name' => 'Mock'
)
);

Expand Down Expand Up @@ -58,7 +58,7 @@ public function it_has_i_authenticate_as()
new Client(
array(
'baseUrl' => 'foo',
'config' => array()
'config' => array()
)
)
);
Expand Down Expand Up @@ -115,7 +115,7 @@ public function it_has_i_call_command_with_value()
array(
array('bar', 'false'),
array('foo', '3'),
array('fu', 'true')
array('fu', 'true')
)
);

Expand Down Expand Up @@ -247,206 +247,4 @@ public function it_has_i_call_command_but_response_contains_wrong_resource_count
'\Guzzle\Http\Exception\ClientErrorResponseException'
)->duringTheResponseContainsResourceWithTheFollowingData(1, $table);
}
/*
public function it_has_i_get_a_response_with_status_code_of_404_for_200()
{
$client = new Client('http://httpbin.org');
$client->setDescription(
ServiceDescription::factory(
__DIR__ . '/test.json'
)
);
$table = new TableNode(
array(
array('code', 200),
)
);
$this->setGuzzleClient($client);
$this->iCallCommandWithValue('GetStatus', $table);
$this->shouldThrow(
'\Guzzle\Http\Exception\ClientErrorResponseException'
)->duringIGetAResponseWithAStatusCodeOf(404);
}
public function it_has_i_get_a_response_with_status_code_of()
{
$client = new Client('http://httpbin.org');
$client->setDescription(
ServiceDescription::factory(
__DIR__ . '/test.json'
)
);
$table = new TableNode(
array(
array('code', 200),
)
);
$this->setGuzzleClient($client);
$this->iCallCommandWithValue('GetStatus', $table);
$this->iGetAResponseWithAStatusCodeOf(200);
}
public function it_has_i_get_a_successful_response_when_unsuccessful()
{
$client = new Client('http://httpbin.org');
$client->setDescription(
ServiceDescription::factory(
__DIR__ . '/test.json'
)
);
$table = new TableNode(
array(
array('code', 404),
)
);
$this->setGuzzleClient($client);
$this->iCallCommandWithValue('GetStatus', $table);
$this->shouldThrow(
'\Guzzle\Http\Exception\ClientErrorResponseException'
)->duringIGetASuccessfulResponse();
}
public function it_has_i_get_a_successful_response()
{
$client = new Client('http://httpbin.org');
$client->setDescription(
ServiceDescription::factory(
__DIR__ . '/test.json'
)
);
$table = new TableNode(
array(
array('code', 200),
)
);
$this->setGuzzleClient($client);
$this->iCallCommandWithValue('GetStatus', $table);
$this->iGetASuccessfulResponse();
}
public function it_has_i_get_an_unsuccessful_response_with_status_code_of_when_successful()
{
$client = new Client('http://httpbin.org');
$client->setDescription(
ServiceDescription::factory(
__DIR__ . '/test.json'
)
);
$table = new TableNode(
array(
array('code', 200),
)
);
$this->setGuzzleClient($client);
$this->iCallCommandWithValue('GetStatus', $table);
$this->shouldThrow(
'\Guzzle\Http\Exception\ClientErrorResponseException'
)->duringIGetAnUnsuccessfulResponseWithAStatusCodeOf(404);
}
public function it_has_i_get_an_unsuccessful_response_with_status_code_of()
{
$client = new Client('http://httpbin.org');
$client->setDescription(
ServiceDescription::factory(
__DIR__ . '/test.json'
)
);
$table = new TableNode(
array(
array('code', 404),
)
);
$this->setGuzzleClient($client);
$this->iCallCommandWithValue('GetStatus', $table);
$this->iGetAnUnsuccessfulResponseWithAStatusCodeOf(404);
}
public function it_has_the_response_contains_the_following_value()
{
$client = new Client('http://httpbin.org');
$client->setDescription(
ServiceDescription::factory(
__DIR__ . '/test.json'
)
);
$table = new TableNode(array(array('url', 'http://httpbin.org/get')));
$this->setGuzzleClient($client);
$this->iCallCommand('Get');
$this->theResponseContainsTheFollowingValue($table);
}
public function it_has_the_response_contains_resource_with_the_following_data_when_count_is_wrong()
{
$client = new Client('http://httpbin.org');
$client->setDescription(
ServiceDescription::factory(
__DIR__ . '/test.json'
)
);
$table = new TableNode(array());
$this->setGuzzleClient($client);
$this->iCallCommand('Get');
$this->shouldThrow(
'\Guzzle\Http\Exception\ClientErrorResponseException'
)->duringTheResponseContainsResourceWithTheFollowingData(2, $table);
}
public function it_has_the_response_contains_resource_with_the_following_data()
{
$client = new Client('http://httpbin.org');
$client->setDescription(
ServiceDescription::factory(
__DIR__ . '/test.json'
)
);
$input = new TableNode(
array(
array('count', 5),
)
);
$output = new TableNode(
array(
array('Host', 'httpbin.org'),
)
);
$this->setGuzzleClient($client);
$this->iCallCommandWithValue('GetLines', $input);
$this->theResponseContainsResourceWithTheFollowingData(5, $output);
}
*/
/*
public function it_compares_values()
{
$a = array(
'fu' => array(
'foo' => 'bar'
)
);
$b = array(
'fu' => array(
'foo' => 'boo'
)
);
$this->shouldThrow('\Exception')->duringCompareValues($a, $b);
}*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function let(Client $client)
$this->beConstructedWith(
$client,
array(
'base_url' => 'https://api.travis-ci.org',
'base_url' => 'https://api.travis-ci.org',
'service_descriptions' => 'config/service.json'
)
);
Expand All @@ -39,7 +39,7 @@ public function it_injects_client_and_parameters_in_guzzle_aware_contexts(
{
$context->setGuzzleClient($client)->shouldBeCalled();
$context->setGuzzleParameters(array(
'base_url' => 'https://api.travis-ci.org',
'base_url' => 'https://api.travis-ci.org',
'service_descriptions' => 'config/service.json'
))->shouldBeCalled();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function it_adds_and_removes_a_guzzle_header()
{
$client = new Client(array(
'baseUrl' => 'foo',
'config' => array()
'config' => array()
));

$this->setGuzzleClient($client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public function it_is_a_testwork_extension()
}

public function it_has_specific_configuration(
ArrayNodeDefinition $builder,
NodeBuilder $nodeBuilder,
ArrayNodeDefinition $builder,
NodeBuilder $nodeBuilder,
ScalarNodeDefinition $node
) {
$builder->addDefaultsIfNotSet()
Expand Down Expand Up @@ -94,7 +94,7 @@ public function it_loads_a_config(ContainerBuilder $container)
'Guzzle\Service\Client',
array(
'baseUrl' => null,
'config' => null
'config' => null
)
)
)->shouldBeCalled();
Expand Down
2 changes: 1 addition & 1 deletion src/Behat/GuzzleExtension/Context/GuzzleContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public function iCallCommandWithValue($command, TableNode $table)
* @When /^I call "(\S+)" with the following value(s?) from JSON:$/
*/
public function iCallCommandWithValueFromJSON(
$command,
$command,
PyStringNode $string
) {
$this->executeCommand(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class GuzzleAwareInitializer implements ContextInitializer
*/
public function __construct(Client $client, array $parameters)
{
$this->client = $client;
$this->client = $client;
$this->parameters = $parameters;

if (!empty($parameters['service_descriptions'])) {
Expand Down
4 changes: 2 additions & 2 deletions src/Behat/GuzzleExtension/Context/RawGuzzleContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class RawGuzzleContext implements GuzzleAwareContext
/**
* @var string
*/
const GUZZLE_EXTENSION_VERSION = '0.3.2';
const GUZZLE_EXTENSION_VERSION = '0.3.3';

/**
* @var Client
Expand Down Expand Up @@ -94,7 +94,7 @@ public function executeCommand($command, array $data = array())
}

$this->response = $command->getResponse();
$this->result = $result;
$this->result = $result;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private function loadClient(ContainerBuilder $container)
'Guzzle\Service\Client',
array(
'baseUrl' => $container->getParameter('guzzle.base_url'),
'config' => $container->getParameter('guzzle.parameters')
'config' => $container->getParameter('guzzle.parameters')
)
)
);
Expand Down

0 comments on commit 301fe7a

Please sign in to comment.