Skip to content

Commit

Permalink
OXDEV-8295: Style fixes; Add Changelog entry;
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelOxid committed May 13, 2024
1 parent eac9b97 commit 8e1bd3a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-v9.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added
- Missing type signatures in
- `Exception\InvalidArgumentMultiplePossible` class
- `Infrastructure\Legacy` class
- `Service\Authorization::isAllowed` method
- `Service\Token::getTokenClaim` method
Expand Down
5 changes: 3 additions & 2 deletions src/Exception/InvalidArgumentMultiplePossible.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@

class InvalidArgumentMultiplePossible extends Error
{
public function __construct(string $field, array $validValues, string $invalidValue) {
$message = '"'.$field.'" is only allowed to be one of "' .
public function __construct(string $field, array $validValues, string $invalidValue)
{
$message = '"' . $field . '" is only allowed to be one of "' .
implode(', ', $validValues) . '", was "' . $invalidValue . '"';

parent::__construct($message);
Expand Down
7 changes: 4 additions & 3 deletions tests/Unit/Exception/InvalidArgumentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@
use OxidEsales\GraphQL\Base\Exception\InvalidArgumentMultiplePossible;
use PHPUnit\Framework\TestCase;


final class InvalidArgumentTest extends TestCase
{
public function testExceptionCategory(): void
{
$invalidArgumentException = new InvalidArgumentMultiplePossible('field', ['VALID', 'EQUALS'], 'INVALID_EQUALS');

$this->assertSame(ErrorCategories::REQUESTERROR, $invalidArgumentException->getCategory());
$this->assertSame($invalidArgumentException->getMessage(),
'"field" is only allowed to be one of "VALID, EQUALS", was "INVALID_EQUALS"');
$this->assertSame(
$invalidArgumentException->getMessage(),
'"field" is only allowed to be one of "VALID, EQUALS", was "INVALID_EQUALS"'
);
}
}

0 comments on commit 8e1bd3a

Please sign in to comment.