Skip to content

Commit

Permalink
[shopsys] FE API: logout (#1788)
Browse files Browse the repository at this point in the history
  • Loading branch information
pesektomas authored Apr 23, 2020
2 parents f1a4c50 + 10f2f1d commit ae787ca
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 12 deletions.
2 changes: 1 addition & 1 deletion tests/FrontendApiBundle/Functional/Login/LoginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function testInvalidTokenInHeader()
/**
* @return string
*/
private function getLoginQuery(): string
public static function getLoginQuery(): string
{
return '
mutation {
Expand Down
38 changes: 38 additions & 0 deletions tests/FrontendApiBundle/Functional/Logout/LogoutTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

declare(strict_types=1);

namespace Tests\FrontendApiBundle\Functional\Logout;

use Tests\FrontendApiBundle\Functional\Login\LoginTest;
use Tests\FrontendApiBundle\Test\GraphQlTestCase;

class LogoutTest extends GraphQlTestCase
{
public function testLogoutMutation()
{
$isLogoutSuccess = $this->getResponseContentForQuery($this->getLogoutQuery(), [], ['HTTP_Authorization' => sprintf('Bearer %s', $this->getAccessToken())])['data']['Logout'];
$this->assertTrue($isLogoutSuccess);
}

/**
* @return string
*/
private function getAccessToken(): string
{
$responseData = $this->getResponseContentForQuery(LoginTest::getLoginQuery())['data']['Login'];
return $responseData['accessToken'];
}

/**
* @return string
*/
private function getLogoutQuery(): string
{
return '
mutation {
Logout
}
';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ mutation {
products: [
{
uuid: "___UUID_PRODUCT___",
price: {
unitPrice: {
priceWithVat: "139.96",
priceWithoutVat: "115.67",
vatAmount: "24.29"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ mutation {
products: [
{
uuid: "___UUID_PRODUCT___",
price: {
unitPrice: {
priceWithVat: "139.96",
priceWithoutVat: "115.67",
vatAmount: "24.29"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ mutation {
products: [
{
uuid: "___UUID_PRODUCT___",
price: {
unitPrice: {
priceWithVat: "139.96",
priceWithoutVat: "115.67",
vatAmount: "24.29"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ mutation {
products: [
{
uuid: "___UUID_PRODUCT___",
price: {
unitPrice: {
priceWithVat: "139.96",
priceWithoutVat: "115.67",
vatAmount: "24.29"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ mutation {
products: [
{
uuid: "___UUID_PRODUCT___",
price: {
unitPrice: {
priceWithVat: "139.96",
priceWithoutVat: "115.67",
vatAmount: "24.29"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ mutation {
products: [
{
uuid: "___UUID_PRODUCT___",
price: {
unitPrice: {
priceWithVat: "139.96",
priceWithoutVat: "115.67",
vatAmount: "24.29"
Expand All @@ -49,7 +49,7 @@ mutation {
},
{
uuid: "___UUID_PRODUCT_2___",
price: {
unitPrice: {
priceWithVat: "4.84",
priceWithoutVat: "4.00",
vatAmount: "0.84"
Expand All @@ -58,7 +58,7 @@ mutation {
},
{
uuid: "___UUID_PRODUCT_3___",
price: {
unitPrice: {
priceWithVat: "300.03",
priceWithoutVat: "247.96",
vatAmount: "52.07"
Expand All @@ -67,7 +67,7 @@ mutation {
},
{
uuid: "___UUID_PRODUCT_4___",
price: {
unitPrice: {
priceWithVat: "309.71",
priceWithoutVat: "255.96",
vatAmount: "53.75"
Expand All @@ -76,7 +76,7 @@ mutation {
},
{
uuid: "___UUID_PRODUCT_5___",
price: {
unitPrice: {
priceWithVat: "193.55",
priceWithoutVat: "159.96",
vatAmount: "33.59"
Expand All @@ -85,7 +85,7 @@ mutation {
},
{
uuid: "___UUID_PRODUCT_6___",
price: {
unitPrice: {
priceWithVat: "395.60",
priceWithoutVat: "326.94",
vatAmount: "68.66"
Expand Down

0 comments on commit ae787ca

Please sign in to comment.