From 07b6f71a07e245b02b7fca0cafdd0cc1dc38d4f3 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Sun, 15 Jan 2023 18:57:26 +0100 Subject: [PATCH 1/3] [Tests] New iteration of removing `$this` occurrences in future static data providers --- .../JsonManifestVersionStrategyTest.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Tests/VersionStrategy/JsonManifestVersionStrategyTest.php b/Tests/VersionStrategy/JsonManifestVersionStrategyTest.php index d3748bb..46c7d05 100644 --- a/Tests/VersionStrategy/JsonManifestVersionStrategyTest.php +++ b/Tests/VersionStrategy/JsonManifestVersionStrategyTest.php @@ -82,22 +82,22 @@ public function testRemoteManifestFileWithoutHttpClient() new JsonManifestVersionStrategy('https://cdn.example.com/manifest.json'); } - public function provideValidStrategies() + public static function provideValidStrategies(): \Generator { - yield from $this->provideStrategies('manifest-valid.json'); + yield from static::provideStrategies('manifest-valid.json'); } - public function provideInvalidStrategies() + public static function provideInvalidStrategies(): \Generator { - yield from $this->provideStrategies('manifest-invalid.json'); + yield from static::provideStrategies('manifest-invalid.json'); } - public function provideMissingStrategies() + public static function provideMissingStrategies(): \Generator { - yield from $this->provideStrategies('non-existent-file.json'); + yield from static::provideStrategies('non-existent-file.json'); } - public function provideStrategies(string $manifestPath) + public static function provideStrategies(string $manifestPath): \Generator { $httpClient = new MockHttpClient(function ($method, $url, $options) { $filename = __DIR__.'/../fixtures/'.basename($url); @@ -114,7 +114,7 @@ public function provideStrategies(string $manifestPath) yield [new JsonManifestVersionStrategy(__DIR__.'/../fixtures/'.$manifestPath)]; } - public function provideStrictStrategies() + public static function provideStrictStrategies(): \Generator { $strategy = new JsonManifestVersionStrategy(__DIR__.'/../fixtures/manifest-valid.json', null, true); From f85b093e27b49702692ff6780383660a28b788ce Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 24 Jan 2023 15:02:24 +0100 Subject: [PATCH 2/3] Update license years (last time) --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 0083704..0138f8f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2023 Fabien Potencier +Copyright (c) 2004-present Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 1504b6773c6b90118f9871e90a67833b5d1dca3c Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 14 Dec 2022 15:42:16 +0100 Subject: [PATCH 3/3] Migrate to `static` data providers using `rector/rector` --- Tests/PackageTest.php | 2 +- Tests/PathPackageTest.php | 4 ++-- Tests/UrlPackageTest.php | 6 +++--- Tests/VersionStrategy/StaticVersionStrategyTest.php | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Tests/PackageTest.php b/Tests/PackageTest.php index 8d7f7b8..45b0982 100644 --- a/Tests/PackageTest.php +++ b/Tests/PackageTest.php @@ -27,7 +27,7 @@ public function testGetUrl($version, $format, $path, $expected) $this->assertSame($expected, $package->getUrl($path)); } - public function getConfigs() + public static function getConfigs() { return [ ['v1', '', 'http://example.com/foo', 'http://example.com/foo'], diff --git a/Tests/PathPackageTest.php b/Tests/PathPackageTest.php index 57bb80b..0784ac6 100644 --- a/Tests/PathPackageTest.php +++ b/Tests/PathPackageTest.php @@ -28,7 +28,7 @@ public function testGetUrl($basePath, $format, $path, $expected) $this->assertSame($expected, $package->getUrl($path)); } - public function getConfigs() + public static function getConfigs() { return [ ['/foo', '', 'http://example.com/foo', 'http://example.com/foo'], @@ -60,7 +60,7 @@ public function testGetUrlWithContext($basePathRequest, $basePath, $format, $pat $this->assertSame($expected, $package->getUrl($path)); } - public function getContextConfigs() + public static function getContextConfigs() { return [ ['', '/foo', '', '/baz', '/baz?v1'], diff --git a/Tests/UrlPackageTest.php b/Tests/UrlPackageTest.php index 717c068..b6525d3 100644 --- a/Tests/UrlPackageTest.php +++ b/Tests/UrlPackageTest.php @@ -31,7 +31,7 @@ public function testGetUrl($baseUrls, $format, $path, $expected) $this->assertSame($expected, $package->getUrl($path)); } - public function getConfigs() + public static function getConfigs() { return [ ['http://example.net', '', 'http://example.com/foo', 'http://example.com/foo'], @@ -72,7 +72,7 @@ public function testGetUrlWithContext($secure, $baseUrls, $format, $path, $expec $this->assertSame($expected, $package->getUrl($path)); } - public function getContextConfigs() + public static function getContextConfigs() { return [ [false, 'http://example.com', '', 'foo', 'http://example.com/foo?v1'], @@ -114,7 +114,7 @@ public function testWrongBaseUrl($baseUrls) new UrlPackage($baseUrls, new EmptyVersionStrategy()); } - public function getWrongBaseUrlConfig() + public static function getWrongBaseUrlConfig() { return [ ['not-a-url'], diff --git a/Tests/VersionStrategy/StaticVersionStrategyTest.php b/Tests/VersionStrategy/StaticVersionStrategyTest.php index d054e84..ec06ba6 100644 --- a/Tests/VersionStrategy/StaticVersionStrategyTest.php +++ b/Tests/VersionStrategy/StaticVersionStrategyTest.php @@ -34,7 +34,7 @@ public function testApplyVersion($path, $version, $format) $this->assertSame($formatted, $staticVersionStrategy->applyVersion($path)); } - public function getConfigs() + public static function getConfigs() { return [ ['test-path', 'v1', null],