Skip to content

Commit

Permalink
OXDEV-7732: Adjust tests for phpunit 10; Move logo a directory up;
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelOxid committed Apr 25, 2024
1 parent d11ff26 commit 9d6fac0
Show file tree
Hide file tree
Showing 22 changed files with 45 additions and 48 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [1.1.0] - Unreleased

### Changed
- Use PHPUnit 10 in composer.json
- Use PHPUnit 10
- Updated the structure to Codeception 5

### Removed
Expand Down
File renamed without changes
4 changes: 2 additions & 2 deletions metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
$aModule = [
'id' => 'oe_graphql_configuration_access',
'title' => 'GraphQL Configuration Access',
'description' => 'GraphQL Configuration Access',
'thumbnail' => 'pictures/logo.png',
'description' => 'GraphQL Configuration Access',
'thumbnail' => 'logo.png',
'version' => '1.0.0',
'author' => 'OXID eSales AG',
'url' => 'https://github.com/OXID-eSales/graphql-configuration-access',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function testGetterExceptionIfSettingNotExist(string $getterMethod): void
$sut->$getterMethod('NotExistant');
}

public function exceptionGetterDataProvider(): \Generator
public static function exceptionGetterDataProvider(): \Generator
{
yield ['getInteger'];
yield ['getFloat'];
Expand All @@ -89,7 +89,7 @@ public function testSetterExceptionIfSettingNotExist(string $setterMethod, mixed
$sut->$setterMethod('NotExistant', $value);
}

public function exceptionSetterDataProvider(): \Generator
public static function exceptionSetterDataProvider(): \Generator
{
yield [
'setterMethod' => 'saveIntegerSetting',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function testControllerProxiesParametersToServiceAndReturnsItsResult(
$this->assertSame($expectedValue, $settingController->$controllerMethod(...$params));
}

public function proxyTestDataProvider(): \Generator
public static function proxyTestDataProvider(): \Generator
{
$settingName = 'settingName';

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Shared/DataType/BooleanSettingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function testBooleanSetting(string $name, bool $value): void
$this->assertSame($value, $sut->getValue());
}

public function booleanSettingDataProvider(): \Generator
public static function booleanSettingDataProvider(): \Generator
{
yield [uniqid(), true];
yield [uniqid(), false];
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Shared/DataType/FloatSettingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function testFloatSetting(string $name, float $value): void
$this->assertSame($value, $sut->getValue());
}

public function floatSettingDataProvider(): \Generator
public static function floatSettingDataProvider(): \Generator
{
yield "random float" => [uniqid(), rand(1, 100) / 10];
yield "random integer" => [uniqid(), rand(1, 100)];
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Shared/DataType/IntegerSettingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function testIntegerSetting(string $name, int $value): void
$this->assertSame($value, $sut->getValue());
}

public function integerSettingDataProvider(): \Generator
public static function integerSettingDataProvider(): \Generator
{
yield "random integer" => [uniqid(), rand(1, 100)];
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Shared/DataType/SettingTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function testIsSupported(string $settingType, bool $expectation): void
$this->assertSame($expectation, $sut->isSupported());
}

public function isSupportedDataProvider(): \Generator
public static function isSupportedDataProvider(): \Generator
{
yield 'not supported case' => ['settingType' => 'someRandomSettingId', 'expectation' => false];
yield 'supported case' => ['settingType' => FieldType::ARRAY, 'expectation' => true];
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Shared/DataType/StringSettingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function testStringSetting(string $name, $value): void
$this->assertSame($value, $sut->getValue());
}

public function stringSettingDataProvider(): \Generator
public static function stringSettingDataProvider(): \Generator
{
yield "random strings" => [uniqid(), uniqid()];
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Shared/Enum/FieldTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function testGetEnums(string $type): void
$this->assertContains($type, $enums);
}

public function fieldTypesDataProvider(): \Generator
public static function fieldTypesDataProvider(): \Generator
{
yield [FieldType::ASSOCIATIVE_ARRAY];
yield [FieldType::NUMBER];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

abstract class AbstractDatabaseSettingsRepositoryTestCase extends UnitTestCase
{
public function possibleGetFloatValuesDataProvider(): \Generator
public static function possibleGetFloatValuesDataProvider(): \Generator
{
yield 'float regular' => [
'method' => 'getFloat',
Expand Down Expand Up @@ -43,7 +43,7 @@ public function possibleGetFloatValuesDataProvider(): \Generator
];
}

public function possibleGetAssocCollectionValuesDataProvider(): \Generator
public static function possibleGetAssocCollectionValuesDataProvider(): \Generator
{
yield 'empty array for assoc collection' => [
'method' => 'getAssocCollection',
Expand All @@ -67,7 +67,7 @@ public function possibleGetAssocCollectionValuesDataProvider(): \Generator
];
}

public function possibleGetSelectValuesDataProvider(): \Generator
public static function possibleGetSelectValuesDataProvider(): \Generator
{
yield [
'method' => 'getSelect',
Expand Down Expand Up @@ -107,7 +107,7 @@ public function possibleGetSelectValuesDataProvider(): \Generator
];
}

public function possibleGetBooleanValuesDataProvider(): \Generator
public static function possibleGetBooleanValuesDataProvider(): \Generator
{
yield 'boolean as positive int' => [
'method' => 'getBoolean',
Expand Down Expand Up @@ -159,7 +159,7 @@ public function possibleGetBooleanValuesDataProvider(): \Generator
];
}

public function possibleGetIntegerValuesDataProvider(): \Generator
public static function possibleGetIntegerValuesDataProvider(): \Generator
{
yield 'int regular' => [
'method' => 'getInteger',
Expand All @@ -176,7 +176,7 @@ public function possibleGetIntegerValuesDataProvider(): \Generator
];
}

public function possibleGetStringValuesDataProvider(): \Generator
public static function possibleGetStringValuesDataProvider(): \Generator
{
yield [
'method' => 'getString',
Expand Down Expand Up @@ -216,7 +216,7 @@ public function possibleGetStringValuesDataProvider(): \Generator
];
}

public function possibleGetCollectionValuesDataProvider(): \Generator
public static function possibleGetCollectionValuesDataProvider(): \Generator
{
yield 'empty array collection' => [
'method' => 'getCollection',
Expand All @@ -240,7 +240,7 @@ public function possibleGetCollectionValuesDataProvider(): \Generator
];
}

public function wrongSettingsValueDataProvider(): \Generator
public static function wrongSettingsValueDataProvider(): \Generator
{
yield [
'method' => 'getInteger',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testJsonDecodeCollection(string $value, array $expectedResult):
$this->assertEquals($expectedResult, $sut->decodeStringCollectionToArray($value));
}

public function jsonDecodeCollectionDataProvider(): \Generator
public static function jsonDecodeCollectionDataProvider(): \Generator
{
yield [
'value' => '',
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Shop/Controller/ShopSettingControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function testControllerProxiesParametersToServiceAndReturnsItsResult(
$this->assertSame($expectedValue, $settingController->$controllerMethod(...$params));
}

public function proxyTestDataProvider(): \Generator
public static function proxyTestDataProvider(): \Generator
{
$settingName = 'settingName';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function testGetShopSettingWrongData(
$sut->$method('settingName');
}

public function wrongSettingsTypeDataProvider(): \Generator
public static function wrongSettingsTypeDataProvider(): \Generator
{
yield [
'method' => 'getInteger',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function testSetShopIsNotCalledOnOriginalSettingTypeMissmatch(
$sut->$method($settingName, $settingValue);
}

public function shopSettingsSaveMethodsDataProvider(): \Generator
public static function shopSettingsSaveMethodsDataProvider(): \Generator
{
yield 'integer' => [
'method' => 'saveIntegerSetting',
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Shop/Service/ShopSettingServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testGetNotEncodableShopSetting(
$this->assertEquals($expectedResult, $sut->$serviceMethod($name));
}

public function getNotEncodableShopSettingDataProvider(): \Generator
public static function getNotEncodableShopSettingDataProvider(): \Generator
{
$name = 'settingName';

Expand Down Expand Up @@ -108,7 +108,7 @@ public function testGetEncodableShopSetting(
);
}

public function getEncodableShopSettingDataProvider(): \Generator
public static function getEncodableShopSettingDataProvider(): \Generator
{
yield 'getCollectionSetting' => [
'repositoryMethod' => 'getCollection',
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Theme/Controller/ThemeSettingControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function testControllerProxiesParametersToServiceAndReturnsItsResult(
$this->assertSame($expectedValue, $settingController->$controllerMethod(...$params));
}

public function proxyTestDataProvider(): \Generator
public static function proxyTestDataProvider(): \Generator
{
$name = 'settingName';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function testGetNoThemeSetting(string $repositoryMethod): void
$sut->$repositoryMethod('NotExistingSetting', 'awesomeTheme');
}

public function noSettingExceptionDataProvider(): \Generator
public static function noSettingExceptionDataProvider(): \Generator
{
yield 'getInteger' => ['repositoryMethod' => 'getInteger', 'fieldType' => FieldType::NUMBER];
yield 'getFloat' => ['repositoryMethod' => 'getFloat', 'fieldType' => FieldType::NUMBER];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function testSetterThrowsExceptionOnNotExistingSetting(
$sut->$repositoryMethod($name, $value, $themeId);
}

public function notExistingSettingCheckTriggerDataProvider(): \Generator
public static function notExistingSettingCheckTriggerDataProvider(): \Generator
{
yield "saveIntegerSetting" => [
'repositoryMethod' => 'saveIntegerSetting',
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Theme/Service/ThemeSettingServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ public function testChangeThemeSettingInvalidAssocCollection($value): void
$settingService->changeAssocCollectionSetting($name, $value, 'awesomeTheme');
}

public function invalidCollectionDataProvider(): array
public static function invalidCollectionDataProvider(): array
{
return [
['[2, "values"'],
Expand Down
33 changes: 15 additions & 18 deletions tests/phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="../../../../bootstrap.php"
colors="true"
backupGlobals="true"
backupStaticAttributes="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
forceCoversAnnotation="false"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
beStrictAboutTestsThatDoNotTestAnything="false"
verbose="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage includeUncoveredFiles="true" processUncoveredFiles="false">
<include>
<directory suffix=".php">../src</directory>
</include>
</coverage>
cacheDirectory=".phpunit.cache"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
displayDetailsOnTestsThatTriggerWarnings="true"
>
<testsuites>
<testsuite name="Unit">
<directory>Unit/</directory>
</testsuite>
<testsuite name="Integration">
<directory>Integration/</directory>
<directory>Integration</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">../src</directory>
</include>
<exclude>
<directory suffix=".php">../tests</directory>
</exclude>
</source>
</phpunit>

0 comments on commit 9d6fac0

Please sign in to comment.