Skip to content

Commit 85cc072

Browse files
committed
OXDEV-9641 Fix deprecations
1 parent 2ee504d commit 85cc072

13 files changed

Lines changed: 35 additions & 78 deletions

tests/Integration/Infrastructure/LegacyTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use OxidEsales\GraphQL\Base\Exception\InvalidLogin;
1717
use OxidEsales\GraphQL\Base\Infrastructure\Legacy;
1818
use OxidEsales\GraphQL\Base\Tests\Integration\TestCase;
19+
use PHPUnit\Framework\Attributes\DataProvider;
1920

2021
class LegacyTest extends TestCase
2122
{
@@ -50,9 +51,7 @@ public function testInvalidLogin(): void
5051
);
5152
}
5253

53-
/**
54-
* @dataProvider loginResponseTestDataProvider
55-
*/
54+
#[DataProvider('loginResponseTestDataProvider')]
5655
public function testLoginResponseIsAnonymousOnLoginMissing(
5756
?string $login,
5857
?string $password,

tests/Integration/Infrastructure/RepositoryTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@
1414
use OxidEsales\GraphQL\Base\DataType\Pagination\Pagination;
1515
use OxidEsales\GraphQL\Base\DataType\Sorting\Sorting as BaseSorting;
1616
use OxidEsales\GraphQL\Base\Infrastructure\Repository;
17+
use PHPUnit\Framework\Attributes\CoversClass;
1718
use PHPUnit\Framework\TestCase;
1819

19-
/**
20-
* @covers OxidEsales\GraphQL\Base\Infrastructure\Repository
21-
*/
20+
#[CoversClass(\OxidEsales\GraphQL\Base\Infrastructure\Repository::class)]
2221
final class RepositoryTest extends TestCase
2322
{
2423
public function testFatalErrorOnWrongClassById(): void

tests/Integration/TestCase.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ protected function uploadFile(
213213
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
214214

215215
$response = curl_exec($ch);
216-
curl_close($ch);
217216

218217
return json_decode($response, true) ?: [];
219218
}

tests/Unit/DataType/Filter/BoolFilterTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use InvalidArgumentException;
1414
use OxidEsales\GraphQL\Base\DataType\Filter\BoolFilter;
1515
use OxidEsales\GraphQL\Base\Tests\Unit\DataType\DataTypeTestCase;
16+
use PHPUnit\Framework\Attributes\DataProvider;
1617

1718
class BoolFilterTest extends DataTypeTestCase
1819
{
@@ -21,9 +22,7 @@ public function testReturnsTrueOnEmptyInitialization(): void
2122
$this->assertTrue((new BoolFilter())->equals());
2223
}
2324

24-
/**
25-
* @dataProvider boolDataProvider
26-
*/
25+
#[DataProvider('boolDataProvider')]
2726
public function testReturnsGivenEqualValue(bool $userInput, bool $returnValue): void
2827
{
2928
$this->assertSame(
@@ -49,9 +48,7 @@ public function testAddQueryPartWithNoFrom(): void
4948
$filter->addToQuery($queryBuilder, 'db_field');
5049
}
5150

52-
/**
53-
* @dataProvider addQueryPartProvider
54-
*/
51+
#[DataProvider('addQueryPartProvider')]
5552
public function testAddQueryPart(bool $filterValue): void
5653
{
5754
$queryBuilder = $this->createQueryBuilderMock();

tests/Unit/DataType/Filter/DateFilterTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use OutOfBoundsException;
1919
use OxidEsales\GraphQL\Base\DataType\Filter\DateFilter;
2020
use OxidEsales\GraphQL\Base\Tests\Unit\DataType\DataTypeTestCase;
21+
use PHPUnit\Framework\Attributes\DataProvider;
2122

2223
class DateFilterTest extends DataTypeTestCase
2324
{
@@ -48,9 +49,7 @@ public static function invalidBetweens(): array
4849
];
4950
}
5051

51-
/**
52-
* @dataProvider invalidBetweens
53-
*/
52+
#[DataProvider('invalidBetweens')]
5453
public function testThrowsExceptionOnInvalidBetween(
5554
array $between
5655
): void {
@@ -180,7 +179,7 @@ public function testAddQueryPartWithAlias(): void
180179
$this->assertEquals('db_table_alias.DB_FIELD = :db_field_eq', (string)$where);
181180
}
182181

183-
/** @dataProvider matchesDataProvider */
182+
#[DataProvider('matchesDataProvider')]
184183
public function testMatches(
185184
DateTimeInterface $trueCase,
186185
mixed $falseCase,

tests/Unit/DataType/Filter/FloatFilterTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use InvalidArgumentException;
1515
use OxidEsales\GraphQL\Base\DataType\Filter\FloatFilter;
1616
use OxidEsales\GraphQL\Base\Tests\Unit\DataType\DataTypeTestCase;
17+
use PHPUnit\Framework\Attributes\DataProvider;
1718

1819
class FloatFilterTest extends DataTypeTestCase
1920
{
@@ -110,9 +111,7 @@ public static function invalidBetweens(): array
110111
];
111112
}
112113

113-
/**
114-
* @dataProvider invalidBetweens
115-
*/
114+
#[DataProvider('invalidBetweens')]
116115
public function testThrowsExceptionOnInvalidBetween(
117116
array $between
118117
): void {
@@ -227,7 +226,7 @@ public function testAddQueryPartWithAlias(): void
227226
$this->assertEquals('db_table_alias.DB_FIELD = :db_field_eq', (string)$where);
228227
}
229228

230-
/** @dataProvider matchesDataProvider */
229+
#[DataProvider('matchesDataProvider')]
231230
public function testMatches(
232231
float $trueCase,
233232
mixed $falseCase,

tests/Unit/DataType/Filter/IDFilterTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use InvalidArgumentException;
1616
use OxidEsales\GraphQL\Base\DataType\Filter\IDFilter;
1717
use OxidEsales\GraphQL\Base\Tests\Unit\DataType\DataTypeTestCase;
18+
use PHPUnit\Framework\Attributes\DataProvider;
1819
use TheCodingMachine\GraphQLite\Types\ID;
1920

2021
class IDFilterTest extends DataTypeTestCase
@@ -79,7 +80,7 @@ public function testAddQueryPartWithAlias(): void
7980
$this->assertEquals('db_table_alias.DB_FIELD = :db_field', (string)$where);
8081
}
8182

82-
/** @dataProvider matchesDataProvider */
83+
#[DataProvider('matchesDataProvider')]
8384
public function testMatches(mixed $value, IDFilter $filter, bool $result): void
8485
{
8586
$this->assertSame(

tests/Unit/DataType/Filter/IntegerFilterTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use InvalidArgumentException;
1515
use OxidEsales\GraphQL\Base\DataType\Filter\IntegerFilter;
1616
use OxidEsales\GraphQL\Base\Tests\Unit\DataType\DataTypeTestCase;
17+
use PHPUnit\Framework\Attributes\DataProvider;
1718

1819
class IntegerFilterTest extends DataTypeTestCase
1920
{
@@ -110,9 +111,7 @@ public static function invalidBetweens(): array
110111
];
111112
}
112113

113-
/**
114-
* @dataProvider invalidBetweens
115-
*/
114+
#[DataProvider('invalidBetweens')]
116115
public function testThrowsExceptionOnInvalidBetween(
117116
array $between
118117
): void {
@@ -191,7 +190,7 @@ public function testAddQueryPartWithAlias(): void
191190
$this->assertEquals('db_table_alias.DB_FIELD = :db_field_eq', (string)$where);
192191
}
193192

194-
/** @dataProvider matchesDataProvider */
193+
#[DataProvider('matchesDataProvider')]
195194
public function testMatches(
196195
int $trueCase,
197196
mixed $falseCase,

tests/Unit/DataType/Filter/StringFilterTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use InvalidArgumentException;
1515
use OxidEsales\GraphQL\Base\DataType\Filter\StringFilter;
1616
use OxidEsales\GraphQL\Base\Tests\Unit\DataType\DataTypeTestCase;
17+
use PHPUnit\Framework\Attributes\DataProvider;
1718

1819
class StringFilterTest extends DataTypeTestCase
1920
{
@@ -145,7 +146,7 @@ public function testAddQueryPartWithAlias(): void
145146
$this->assertEquals('db_table_alias.DB_FIELD = :db_field_eq', (string)$where);
146147
}
147148

148-
/** @dataProvider matchesDataProvider */
149+
#[DataProvider('matchesDataProvider')]
149150
public function testMatches(
150151
string $trueCase,
151152
mixed $falseCase,

tests/Unit/DataType/Pagination/PaginationTest.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
use OxidEsales\GraphQL\Base\DataType\Pagination\Pagination;
1313
use OxidEsales\GraphQL\Base\Tests\Unit\DataType\DataTypeTestCase;
14+
use PHPUnit\Framework\Attributes\DataProvider;
1415

1516
class PaginationTest extends DataTypeTestCase
1617
{
@@ -55,12 +56,7 @@ public function testDefaultNamedConstructor(): void
5556
);
5657
}
5758

58-
/**
59-
* @dataProvider paginationDataProvider
60-
*
61-
* @param mixed $offset
62-
* @param mixed $limit
63-
*/
59+
#[DataProvider('paginationDataProvider')]
6460
public function testInvalidValuesOnPaginationFilter($offset, $limit): void
6561
{
6662
$this->expectExceptionMessage('PaginationFilter fields must be positive.');
@@ -80,9 +76,7 @@ public static function paginationDataProvider(): array
8076
];
8177
}
8278

83-
/**
84-
* @dataProvider addPaginationToQueryProvider
85-
*/
79+
#[DataProvider('addPaginationToQueryProvider')]
8680
public function testAddPaginationToQuery(int $offset, ?int $limit): void
8781
{
8882
$queryBuilder = $this->createQueryBuilderMock();

0 commit comments

Comments
 (0)