Skip to content

Commit

Permalink
Migrate to static data providers using rector/rector
Browse files Browse the repository at this point in the history
  • Loading branch information
OskarStark authored and nicolas-grekas committed Feb 14, 2023
1 parent 277aa51 commit e75960b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Tests/FilesystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ public function testMakePathRelative($endPath, $startPath, $expectedPath)
$this->assertEquals($expectedPath, $path);
}

public function providePathsForMakePathRelative()
public static function providePathsForMakePathRelative()
{
$paths = [
['/var/lib/symfony/src/Symfony/', '/var/lib/symfony/src/Symfony/Component', '../'],
Expand Down Expand Up @@ -1434,7 +1434,7 @@ public function testIsAbsolutePath($path, $expectedResult)
$this->assertEquals($expectedResult, $result);
}

public function providePathsForIsAbsolutePath()
public static function providePathsForIsAbsolutePath()
{
return [
['/var/lib', true],
Expand Down
30 changes: 15 additions & 15 deletions Tests/PathTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected function tearDown(): void
putenv('HOMEPATH='.$this->storedEnv['HOMEPATH']);
}

public function provideCanonicalizationTests(): \Generator
public static function provideCanonicalizationTests(): \Generator
{
// relative paths (forward slash)
yield ['css/./style.css', 'css/style.css'];
Expand Down Expand Up @@ -172,7 +172,7 @@ public function testCanonicalize(string $path, string $canonicalized)
$this->assertSame($canonicalized, Path::canonicalize($path));
}

public function provideGetDirectoryTests(): \Generator
public static function provideGetDirectoryTests(): \Generator
{
yield ['/webmozart/symfony/style.css', '/webmozart/symfony'];
yield ['/webmozart/symfony', '/webmozart'];
Expand Down Expand Up @@ -235,7 +235,7 @@ public function testGetDirectory(string $path, string $directory)
$this->assertSame($directory, Path::getDirectory($path));
}

public function provideGetFilenameWithoutExtensionTests(): \Generator
public static function provideGetFilenameWithoutExtensionTests(): \Generator
{
yield ['/webmozart/symfony/style.css.twig', null, 'style.css'];
yield ['/webmozart/symfony/style.css.', null, 'style.css'];
Expand Down Expand Up @@ -266,7 +266,7 @@ public function testGetFilenameWithoutExtension(string $path, ?string $extension
$this->assertSame($filename, Path::getFilenameWithoutExtension($path, $extension));
}

public function provideGetExtensionTests(): \Generator
public static function provideGetExtensionTests(): \Generator
{
yield ['/webmozart/symfony/style.css.twig', false, 'twig'];
yield ['/webmozart/symfony/style.css', false, 'css'];
Expand All @@ -291,7 +291,7 @@ public function testGetExtension(string $path, bool $forceLowerCase, string $ext
$this->assertSame($extension, Path::getExtension($path, $forceLowerCase));
}

public function provideHasExtensionTests(): \Generator
public static function provideHasExtensionTests(): \Generator
{
yield [true, '/webmozart/symfony/style.css.twig', null, false];
yield [true, '/webmozart/symfony/style.css', null, false];
Expand Down Expand Up @@ -338,7 +338,7 @@ public function testHasExtension(bool $hasExtension, string $path, $extension, b
$this->assertSame($hasExtension, Path::hasExtension($path, $extension, $ignoreCase));
}

public function provideChangeExtensionTests(): \Generator
public static function provideChangeExtensionTests(): \Generator
{
yield ['/webmozart/symfony/style.css.twig', 'html', '/webmozart/symfony/style.css.html'];
yield ['/webmozart/symfony/style.css', 'sass', '/webmozart/symfony/style.sass'];
Expand All @@ -362,7 +362,7 @@ public function testChangeExtension(string $path, string $extension, string $pat
$this->assertSame($pathExpected, Path::changeExtension($path, $extension));
}

public function provideIsAbsolutePathTests(): \Generator
public static function provideIsAbsolutePathTests(): \Generator
{
yield ['/css/style.css', true];
yield ['/', true];
Expand Down Expand Up @@ -405,7 +405,7 @@ public function testIsRelative(string $path, bool $isAbsolute)
$this->assertSame(!$isAbsolute, Path::isRelative($path));
}

public function provideGetRootTests(): \Generator
public static function provideGetRootTests(): \Generator
{
yield ['/css/style.css', '/'];
yield ['/', '/'];
Expand Down Expand Up @@ -460,7 +460,7 @@ private static function getPathTests(): \Generator
];
}

public function provideMakeAbsoluteTests(): \Generator
public static function provideMakeAbsoluteTests(): \Generator
{
yield from self::getPathTests();

Expand Down Expand Up @@ -551,7 +551,7 @@ public function testMakeAbsoluteFailsIfBasePathEmpty()
Path::makeAbsolute('css/style.css', '');
}

public function provideAbsolutePathsWithDifferentRoots(): \Generator
public static function provideAbsolutePathsWithDifferentRoots(): \Generator
{
yield ['C:/css/style.css', '/webmozart/symfony'];
yield ['C:/css/style.css', '\\webmozart\\symfony'];
Expand Down Expand Up @@ -587,7 +587,7 @@ public function testMakeAbsoluteDoesNotFailIfDifferentRoot(string $basePath, str
$this->assertSame(Path::canonicalize($absolutePath), Path::makeAbsolute($absolutePath, $basePath));
}

public function provideMakeRelativeTests(): \Generator
public static function provideMakeRelativeTests(): \Generator
{
foreach (self::getPathTests() as $set) {
yield [$set[2], $set[1], $set[0]];
Expand Down Expand Up @@ -713,7 +713,7 @@ public function testMakeRelativeFailsIfDifferentRoot(string $absolutePath, strin
Path::makeRelative($absolutePath, $basePath);
}

public function provideIsLocalTests(): \Generator
public static function provideIsLocalTests(): \Generator
{
yield ['/bg.png', true];
yield ['bg.png', true];
Expand All @@ -730,7 +730,7 @@ public function testIsLocal(string $path, bool $isLocal)
$this->assertSame($isLocal, Path::isLocal($path));
}

public function provideGetLongestCommonBasePathTests(): \Generator
public static function provideGetLongestCommonBasePathTests(): \Generator
{
// same paths
yield [['/base/path', '/base/path'], '/base/path'];
Expand Down Expand Up @@ -850,7 +850,7 @@ public function testGetLongestCommonBasePath(array $paths, ?string $basePath)
$this->assertSame($basePath, Path::getLongestCommonBasePath(...$paths));
}

public function provideIsBasePathTests(): \Generator
public static function provideIsBasePathTests(): \Generator
{
// same paths
yield ['/base/path', '/base/path', true];
Expand Down Expand Up @@ -939,7 +939,7 @@ public function testIsBasePath(string $path, string $ofPath, bool $result)
$this->assertSame($result, Path::isBasePath($path, $ofPath));
}

public function provideJoinTests(): \Generator
public static function provideJoinTests(): \Generator
{
yield [['', ''], ''];
yield [['/path/to/test', ''], '/path/to/test'];
Expand Down

0 comments on commit e75960b

Please sign in to comment.