Skip to content

Commit

Permalink
Fix phpunit deprecation: static data provider
Browse files Browse the repository at this point in the history
> 1) ClassMapTest::testClassMap
> Data Provider method ClassMapTest::classMapTestData() is not static
> tests/ClassMapTest.php:62
  • Loading branch information
cweiske committed Jul 17, 2024
1 parent e3025fc commit 4f401ab
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions tests/ClassMapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,17 @@ public function __invoke($class, $jvalue)
const CLASS_MAP_CLASS = 'JsonMapperTest_PlainObject';
const CLASS_MAP_DATA = '2016-04-14T23:15:42+02:00';

public function classMapTestData()
public static function classMapTestData()
{
$testCase = $this;

// classMap value
return [
'name' => ['DateTime'],
'function' => [function ($class, $jvalue) use ($testCase) {
'function' => [function ($class, $jvalue) {
// the class/interface to be mapped
$testCase->assertSame($testCase::CLASS_MAP_CLASS, $class);
$testCase->assertSame($testCase::CLASS_MAP_DATA, $jvalue);
static::assertSame(static::CLASS_MAP_CLASS, $class);
static::assertSame(static::CLASS_MAP_DATA, $jvalue);
return 'DateTime';
}],
'invoke' => [$this], // __invoke
}]
];
}

Expand Down

0 comments on commit 4f401ab

Please sign in to comment.