-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OXDEV-7555 Change SettingType validation exception to isSupported field
Signed-off-by: Anton Fedurtsya <[email protected]>
- Loading branch information
Showing
6 changed files
with
153 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
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,45 @@ | ||
<?php | ||
|
||
namespace OxidEsales\GraphQL\ConfigurationAccess\Tests\Unit\DataType; | ||
|
||
use OxidEsales\GraphQL\ConfigurationAccess\Setting\DataType\SettingType; | ||
use OxidEsales\GraphQL\ConfigurationAccess\Setting\Enum\FieldType; | ||
use PHPUnit\Framework\TestCase; | ||
use TheCodingMachine\GraphQLite\Types\ID; | ||
|
||
/** | ||
* @covers \OxidEsales\GraphQL\ConfigurationAccess\Setting\DataType\SettingType | ||
*/ | ||
class SettingTypeTest extends TestCase | ||
{ | ||
public function testGetters(): void | ||
{ | ||
$settingIdentifier = new ID('someSettingName'); | ||
$settingType = 'someRandomType'; | ||
|
||
$sut = new SettingType( | ||
$settingIdentifier, | ||
$settingType | ||
); | ||
|
||
$this->assertEquals($settingIdentifier, $sut->getName()); | ||
$this->assertEquals($settingType, $sut->getType()); | ||
} | ||
|
||
/** @dataProvider isSupportedDataProvider */ | ||
public function testIsSupported(string $settingType, bool $expectation): void | ||
{ | ||
$sut = new SettingType( | ||
new ID('someSettingName'), | ||
$settingType | ||
); | ||
|
||
$this->assertSame($expectation, $sut->isSupported()); | ||
} | ||
|
||
public function isSupportedDataProvider(): \Generator | ||
{ | ||
yield 'not supported case' => ['settingType' => 'someRandomSettingId', 'expectation' => false]; | ||
yield 'supported case' => ['settingType' => FieldType::ARRAY, 'expectation' => true]; | ||
} | ||
} |