Skip to content

Commit

Permalink
OXDEV-7732: Fix named arguments for data providers; Remove phpintegra…
Browse files Browse the repository at this point in the history
…tion.xml;
  • Loading branch information
MarcelOxid committed Apr 26, 2024
1 parent c74262c commit 644e911
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,120 +245,120 @@ public static function wrongSettingsValueDataProvider(): \Generator
yield [
'method' => 'getInteger',
'type' => FieldType::NUMBER,
'value' => 'any',
'possibleValue' => 'any',
'expectedException' => WrongSettingValueException::class
];

yield [
'method' => 'getInteger',
'type' => FieldType::NUMBER,
'value' => null,
'possibleValue' => null,
'expectedException' => WrongSettingValueException::class
];

yield [
'method' => 'getInteger',
'type' => FieldType::NUMBER,
'value' => 1.123,
'possibleValue' => 1.123,
'expectedException' => WrongSettingValueException::class
];

yield [
'method' => 'getInteger',
'type' => FieldType::NUMBER,
'value' => '1.123',
'possibleValue' => '1.123',
'expectedException' => WrongSettingValueException::class
];

yield [
'method' => 'getFloat',
'type' => FieldType::NUMBER,
'value' => 'any',
'possibleValue' => 'any',
'expectedException' => WrongSettingValueException::class
];

yield 'false as the error result of unserialize' => [
'method' => 'getCollection',
'type' => FieldType::ARRAY,
'possibleValue' => false,
'expectedResult' => WrongSettingValueException::class
'expectedException' => WrongSettingValueException::class
];

yield 'empty string instead of collection' => [
'method' => 'getCollection',
'type' => FieldType::ARRAY,
'possibleValue' => '',
'expectedResult' => WrongSettingValueException::class
'expectedException' => WrongSettingValueException::class
];

yield 'string instead of collection' => [
'method' => 'getCollection',
'type' => FieldType::ARRAY,
'possibleValue' => 'some string',
'expectedResult' => WrongSettingValueException::class
'expectedException' => WrongSettingValueException::class
];

yield 'integer instead of collection' => [
'method' => 'getCollection',
'type' => FieldType::ARRAY,
'possibleValue' => 123,
'expectedResult' => WrongSettingValueException::class
'expectedException' => WrongSettingValueException::class
];

yield 'float instead of collection' => [
'method' => 'getCollection',
'type' => FieldType::ARRAY,
'possibleValue' => 1.23,
'expectedResult' => WrongSettingValueException::class
'expectedException' => WrongSettingValueException::class
];

yield 'null instead of collection' => [
'method' => 'getCollection',
'type' => FieldType::ARRAY,
'possibleValue' => false,
'expectedResult' => WrongSettingValueException::class
'expectedException' => WrongSettingValueException::class
];

yield 'empty string instead of assoc collection' => [
'method' => 'getAssocCollection',
'type' => FieldType::ASSOCIATIVE_ARRAY,
'possibleValue' => '',
'expectedResult' => WrongSettingValueException::class
'expectedException' => WrongSettingValueException::class
];

yield 'false as the error result of unserialize in assoc collection' => [
'method' => 'getAssocCollection',
'type' => FieldType::ASSOCIATIVE_ARRAY,
'possibleValue' => false,
'expectedResult' => WrongSettingValueException::class
'expectedException' => WrongSettingValueException::class
];

yield 'string instead of assoc collection' => [
'method' => 'getAssocCollection',
'type' => FieldType::ASSOCIATIVE_ARRAY,
'possibleValue' => 'some string',
'expectedResult' => WrongSettingValueException::class
'expectedException' => WrongSettingValueException::class
];

yield 'integer instead of assoc collection' => [
'method' => 'getAssocCollection',
'type' => FieldType::ASSOCIATIVE_ARRAY,
'possibleValue' => 123,
'expectedResult' => WrongSettingValueException::class
'expectedException' => WrongSettingValueException::class
];

yield 'float instead of assoc collection' => [
'method' => 'getAssocCollection',
'type' => FieldType::ASSOCIATIVE_ARRAY,
'possibleValue' => 1.23,
'expectedResult' => WrongSettingValueException::class
'expectedException' => WrongSettingValueException::class
];

yield 'null instead of assoc collection' => [
'method' => 'getAssocCollection',
'type' => FieldType::ASSOCIATIVE_ARRAY,
'possibleValue' => false,
'expectedResult' => WrongSettingValueException::class
'expectedException' => WrongSettingValueException::class
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ public static function jsonDecodeCollectionDataProvider(): \Generator
{
yield [
'value' => '',
'result' => []
'expectedResult' => []
];

yield [
'value' => '["apple","banana"]',
'result' => ["apple", "banana"]
'expectedResult' => ["apple", "banana"]
];

yield [
'value' => '{"name":"John","age":30}',
'result' => ["name" => "John", "age" => 30]
'expectedResult' => ["name" => "John", "age" => 30]
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ public function testGetShopSetting($method, $type, $possibleValue, $expectedResu
public function testGetShopSettingWrongData(
string $method,
string $type,
$value,
mixed $possibleValue,
string $expectedException
): void {
$shopSettingDaoStub = $this->createStub(ShopConfigurationSettingDaoInterface::class);
$shopSettingDaoStub->method('get')->willReturn(
$this->createConfiguredMock(ShopConfigurationSetting::class, [
'getType' => $type,
'getValue' => $value
'getValue' => $possibleValue
])
);

Expand All @@ -82,42 +82,42 @@ public static function wrongSettingsTypeDataProvider(): \Generator
yield [
'method' => 'getInteger',
'type' => 'wrong',
'value' => 'any',
'possibleValue' => 'any',
'expectedException' => WrongSettingTypeException::class
];

yield [
'method' => 'getFloat',
'type' => 'wrong',
'value' => 'any',
'possibleValue' => 'any',
'expectedException' => WrongSettingTypeException::class
];

yield [
'method' => 'getBoolean',
'type' => 'wrong',
'value' => 'any',
'possibleValue' => 'any',
'expectedException' => WrongSettingTypeException::class
];

yield [
'method' => 'getString',
'type' => 'wrong',
'value' => 'any',
'possibleValue' => 'any',
'expectedException' => WrongSettingTypeException::class
];

yield [
'method' => 'getSelect',
'type' => 'wrong',
'value' => 'any',
'possibleValue' => 'any',
'expectedException' => WrongSettingTypeException::class
];

yield [
'method' => 'getCollection',
'type' => 'wrong',
'value' => 'any',
'possibleValue' => 'any',
'expectedException' => WrongSettingTypeException::class
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use OxidEsales\EshopCommunity\Internal\Framework\Database\QueryBuilderFactoryInterface;
use OxidEsales\GraphQL\ConfigurationAccess\Shared\Enum\FieldType;
use OxidEsales\GraphQL\ConfigurationAccess\Theme\Exception\NoSettingsFoundForThemeException;
use TheCodingMachine\GraphQLite\Types\ID;

/**
* @covers \OxidEsales\GraphQL\ConfigurationAccess\Theme\Infrastructure\ThemeSettingRepository
Expand Down Expand Up @@ -48,7 +49,7 @@ public function testGetThemeSetting(string $method, string $type, mixed $possibl
public function testGetThemeSettingWrongData(
string $method,
string $type,
mixed $value,
mixed $possibleValue,
string $expectedException
): void {
$name = uniqid();
Expand All @@ -57,7 +58,7 @@ public function testGetThemeSettingWrongData(
$sut->expects($this->once())
->method('getSettingValue')
->with($name, $type, 'awesomeTheme')
->willReturn($value);
->willReturn($possibleValue);

$this->expectException($expectedException);
$sut->$method($name, 'awesomeTheme');
Expand All @@ -78,16 +79,13 @@ public function testGetNoThemeSetting(string $repositoryMethod): void

public static function noSettingExceptionDataProvider(): \Generator
{
yield 'getInteger' => ['repositoryMethod' => 'getInteger', 'fieldType' => FieldType::NUMBER];
yield 'getFloat' => ['repositoryMethod' => 'getFloat', 'fieldType' => FieldType::NUMBER];
yield 'getBoolean' => ['repositoryMethod' => 'getBoolean', 'fieldType' => FieldType::BOOLEAN];
yield 'getString' => ['repositoryMethod' => 'getString', 'fieldType' => FieldType::STRING];
yield 'getSelect' => ['repositoryMethod' => 'getSelect', 'fieldType' => FieldType::SELECT];
yield 'getCollection' => ['repositoryMethod' => 'getCollection', 'fieldType' => FieldType::ARRAY];
yield 'getAssocCollection' => [
'repositoryMethod' => 'getAssocCollection',
'fieldType' => FieldType::ASSOCIATIVE_ARRAY
];
yield 'getInteger' => ['repositoryMethod' => 'getInteger'];
yield 'getFloat' => ['repositoryMethod' => 'getFloat'];
yield 'getBoolean' => ['repositoryMethod' => 'getBoolean'];
yield 'getString' => ['repositoryMethod' => 'getString'];
yield 'getSelect' => ['repositoryMethod' => 'getSelect'];
yield 'getCollection' => ['repositoryMethod' => 'getCollection'];
yield 'getAssocCollection' => ['repositoryMethod' => 'getAssocCollection'];
}

public function testGetSettingsList(): void
Expand Down
29 changes: 0 additions & 29 deletions tests/phpintegration.xml

This file was deleted.

0 comments on commit 644e911

Please sign in to comment.