Skip to content

Commit

Permalink
Fixed & added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobTolkemit committed Jul 31, 2019
1 parent c2c28c3 commit b0940e7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
26 changes: 25 additions & 1 deletion tests/Controller/Customer/LoggedInCustomerDetailsActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function it_shows_currently_logged_in_customer_details(): void
$this->loadFixturesFromFiles(['channel.yml', 'customer.yml']);

$data =
<<<JSON
<<<JSON
{
"email": "oliver@queen.com",
"password": "123password"
Expand All @@ -37,4 +37,28 @@ public function it_shows_currently_logged_in_customer_details(): void
$response = $this->client->getResponse();
$this->assertResponse($response, 'customer/logged_in_customer_details_response', Response::HTTP_OK);
}

/**
* @test
*/
public function it_does_not_allow_to_show_customer_details_without_being_logged_in(): void
{
$this->loadFixturesFromFiles(['channel.yml', 'customer.yml']);

$data =
<<<JSON
{
"email": "oliver@queen.com",
"password": "123password"
}
JSON;

$this->client->request('GET', '/shop-api/me', [], [], [
'CONTENT_TYPE' => 'application/json',
'ACCEPT' => 'application/json',
]);

$response = $this->client->getResponse();
$this->assertResponseCode($response, Response::HTTP_UNAUTHORIZED);
}
}
2 changes: 1 addition & 1 deletion tests/Controller/Customer/UpdateCustomerApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function it_does_not_allow_to_update_customer_without_being_logged_in():
JSON;
$this->client->request('PUT', '/shop-api/me', [], [], self::CONTENT_TYPE_HEADER, $data);
$response = $this->client->getResponse();
$this->assertResponseCode($response, Response::HTTP_INTERNAL_SERVER_ERROR);
$this->assertResponseCode($response, Response::HTTP_UNAUTHORIZED);
}

/**
Expand Down

0 comments on commit b0940e7

Please sign in to comment.