From b0940e7ab2a20ffb48fb5460e50ef0bbf69184ff Mon Sep 17 00:00:00 2001 From: Jakob Tolkemit Date: Wed, 31 Jul 2019 12:35:45 +0200 Subject: [PATCH] Fixed & added tests --- .../LoggedInCustomerDetailsActionTest.php | 26 ++++++++++++++++++- .../Customer/UpdateCustomerApiTest.php | 2 +- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/tests/Controller/Customer/LoggedInCustomerDetailsActionTest.php b/tests/Controller/Customer/LoggedInCustomerDetailsActionTest.php index c2721a974..8d3b7762d 100644 --- a/tests/Controller/Customer/LoggedInCustomerDetailsActionTest.php +++ b/tests/Controller/Customer/LoggedInCustomerDetailsActionTest.php @@ -17,7 +17,7 @@ public function it_shows_currently_logged_in_customer_details(): void $this->loadFixturesFromFiles(['channel.yml', 'customer.yml']); $data = -<<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 = + <<client->request('GET', '/shop-api/me', [], [], [ + 'CONTENT_TYPE' => 'application/json', + 'ACCEPT' => 'application/json', + ]); + + $response = $this->client->getResponse(); + $this->assertResponseCode($response, Response::HTTP_UNAUTHORIZED); + } } diff --git a/tests/Controller/Customer/UpdateCustomerApiTest.php b/tests/Controller/Customer/UpdateCustomerApiTest.php index 4d2b215d4..2e43785d9 100644 --- a/tests/Controller/Customer/UpdateCustomerApiTest.php +++ b/tests/Controller/Customer/UpdateCustomerApiTest.php @@ -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); } /**