-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'b-7.1.x-phpmd_fixes_and_baseline-OXDEV-8315' into b-7.1.x
- Loading branch information
Showing
19 changed files
with
252 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\GraphQL\Base\Exception; | ||
|
||
class TokenUserBlocked extends Error | ||
{ | ||
protected const USER_BLOCKED_MESSAGE = 'User is blocked'; | ||
|
||
public function __construct(string $message = self::USER_BLOCKED_MESSAGE, array $extensions = []) | ||
{ | ||
parent::__construct( | ||
message: $message, | ||
extensions: $extensions | ||
); | ||
} | ||
|
||
public function getCategory(): string | ||
{ | ||
return ErrorCategories::PERMISSIONERRORS; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\GraphQL\Base\Exception; | ||
|
||
class UnableToParseToken extends Error | ||
{ | ||
protected const UNABLE_TO_PARSE_MESSAGE = 'Unable to parse token'; | ||
|
||
public function __construct(string $message = self::UNABLE_TO_PARSE_MESSAGE, array $extensions = []) | ||
{ | ||
parent::__construct( | ||
message: $message, | ||
extensions: $extensions | ||
); | ||
} | ||
|
||
public function getCategory(): string | ||
{ | ||
return ErrorCategories::PERMISSIONERRORS; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\GraphQL\Base\Exception; | ||
|
||
class UnknownToken extends Error | ||
{ | ||
protected const UNKNOWN_TOKEN_MESSAGE = 'The token is not registered'; | ||
|
||
public function __construct(string $message = self::UNKNOWN_TOKEN_MESSAGE, array $extensions = []) | ||
{ | ||
parent::__construct( | ||
message: $message, | ||
extensions: $extensions | ||
); | ||
} | ||
|
||
public function getCategory(): string | ||
{ | ||
return ErrorCategories::PERMISSIONERRORS; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0"?> | ||
<phpmd-baseline> | ||
<violation rule="PHPMD\Rule\CleanCode\StaticAccess" file="src/Component/Widget/GraphQL.php"/> | ||
<violation rule="PHPMD\Rule\CleanCode\StaticAccess" file="src/Controller/Token.php"/> | ||
<violation rule="PHPMD\Rule\CleanCode\StaticAccess" file="src/DataType/Token.php"/> | ||
<violation rule="PHPMD\Rule\CleanCode\StaticAccess" file="src/Framework/GraphQLQueryHandler.php"/> | ||
<violation rule="PHPMD\Rule\CleanCode\StaticAccess" file="src/Framework/RequestReader.php"/> | ||
<violation rule="PHPMD\Rule\CleanCode\StaticAccess" file="src/Infrastructure/Legacy.php"/> | ||
<violation rule="PHPMD\Rule\CleanCode\StaticAccess" file="src/Service/JwtConfigurationBuilder.php"/> | ||
<violation rule="PHPMD\Rule\CleanCode\StaticAccess" file="src/Service/ModuleConfiguration.php"/> | ||
<violation rule="PHPMD\Rule\CleanCode\StaticAccess" file="src/Service/Token.php"/> | ||
</phpmd-baseline> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\GraphQL\Base\Tests\Unit\Exception; | ||
|
||
use OxidEsales\GraphQL\Base\Exception\ErrorCategories; | ||
use OxidEsales\GraphQL\Base\Exception\TokenUserBlocked; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class TokenUserBlockedTest extends TestCase | ||
{ | ||
public function testExceptionCategory(): void | ||
{ | ||
$invalidTokenException = new TokenUserBlocked(); | ||
|
||
$this->assertSame(ErrorCategories::PERMISSIONERRORS, $invalidTokenException->getCategory()); | ||
} | ||
|
||
public function testIsClientSafe(): void | ||
{ | ||
$invalidTokenException = new TokenUserBlocked(); | ||
|
||
$this->assertTrue($invalidTokenException->isClientSafe()); | ||
} | ||
|
||
public function testUserBlocked(): void | ||
{ | ||
$invalidTokenException = new TokenUserBlocked(); | ||
|
||
$this->assertSame('User is blocked', $invalidTokenException->getMessage()); | ||
} | ||
} |
Oops, something went wrong.