From 3edd771244ade407a92d8d19e9cceea568868a26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Isaert?= Date: Wed, 21 Jun 2023 12:21:22 +0200 Subject: [PATCH] Chore: Remove Zend Diactoros (#3) --- .travis.yml | 13 +++---- README.md | 4 --- composer.json | 4 +-- src/Adapter/ZendDiactorosAdapter.php | 42 ---------------------- src/UriFactory.php | 4 +-- tests/Adapter/ZendDiactorosAdapterTest.php | 39 -------------------- tests/UriFactoryTest.php | 2 -- 7 files changed, 6 insertions(+), 102 deletions(-) delete mode 100644 src/Adapter/ZendDiactorosAdapter.php delete mode 100644 tests/Adapter/ZendDiactorosAdapterTest.php diff --git a/.travis.yml b/.travis.yml index 5bba298..74f8b48 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,27 +29,22 @@ script: - mkdir -p build/logs && ./vendor/bin/phpunit --coverage-clover build/logs/clover.xml # League/Uri isolated factory test - - composer rem --dev league/uri nyholm/psr7 guzzlehttp/psr7 zendframework/zend-diactoros ringcentral/psr7 + - composer rem --dev league/uri nyholm/psr7 guzzlehttp/psr7 ringcentral/psr7 - composer req --dev --prefer-dist league/uri:^5.0 - ./vendor/bin/phpunit tests/UriFactoryTest.php - # Zend Diactoros isolated ffactory test - - composer rem --dev league/uri nyholm/psr7 guzzlehttp/psr7 zendframework/zend-diactoros ringcentral/psr7 - - composer req --dev --prefer-dist zendframework/zend-diactoros - - ./vendor/bin/phpunit tests/UriFactoryTest.php - # Guzzle PSR-7 isolated ffactory test - - composer rem --dev league/uri nyholm/psr7 guzzlehttp/psr7 zendframework/zend-diactoros ringcentral/psr7 + - composer rem --dev league/uri nyholm/psr7 guzzlehttp/psr7 ringcentral/psr7 - composer req --dev --prefer-dist guzzlehttp/psr7 - ./vendor/bin/phpunit tests/UriFactoryTest.php # Nyholm PSR-7 isolated ffactory test - - composer rem --dev league/uri nyholm/psr7 guzzlehttp/psr7 zendframework/zend-diactoros ringcentral/psr7 + - composer rem --dev league/uri nyholm/psr7 guzzlehttp/psr7 ringcentral/psr7 - composer req --dev --prefer-dist nyholm/psr7 - ./vendor/bin/phpunit tests/UriFactoryTest.php # Nyholm PSR-7 isolated ffactory test - - composer rem --dev league/uri nyholm/psr7 guzzlehttp/psr7 zendframework/zend-diactoros ringcentral/psr7 + - composer rem --dev league/uri nyholm/psr7 guzzlehttp/psr7 ringcentral/psr7 - composer req --dev --prefer-dist ringcentral/psr7 - ./vendor/bin/phpunit tests/UriFactoryTest.php diff --git a/README.md b/README.md index d183461..a435a21 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,6 @@ There are several PSR-7 libraries on packagist but each one has its own factory Supported libraries so far: * `guzzlehttp/psr7` -* `zendframework/zend-diactoros` * `league/uri` * `nyholm/psr7` * `ringcentral/psr7` @@ -39,17 +38,14 @@ You can specify which library to use, by using the corresponding adapter: ```php use BenTools\UriFactory\Adapter\GuzzleAdapter; use BenTools\UriFactory\Adapter\LeagueUriAdapter; -use BenTools\UriFactory\Adapter\ZendDiactorosAdapter; use function BenTools\UriFactory\Helper\current_location; use function BenTools\UriFactory\Helper\uri; $uri = uri('http://www.example.net', GuzzleAdapter::factory()); $uri = uri('http://www.example.net', LeagueUriAdapter::factory()); -$uri = uri('http://www.example.net', ZendDiactorosAdapter::factory()); $uri = current_location(GuzzleAdapter::factory()); $uri = current_location(LeagueUriAdapter::factory()); -$uri = current_location(ZendDiactorosAdapter::factory()); ``` ## Canonicalizer diff --git a/composer.json b/composer.json index c0d05dc..e10d23f 100644 --- a/composer.json +++ b/composer.json @@ -25,8 +25,7 @@ "phpunit/phpunit": "~6.0|~7.0", "ringcentral/psr7": "^1.3", "squizlabs/php_codesniffer": "@stable", - "symfony/var-dumper": "^3.3", - "zendframework/zend-diactoros": "^1.6" + "symfony/var-dumper": "^3.3" }, "autoload": { "psr-4": { @@ -46,7 +45,6 @@ }, "suggest": { "league/uri": "URI manipulation Library", - "zendframework/zend-diactoros": "PSR-7 HTTP Message implementation", "guzzlehttp/psr7": "PSR-7 HTTP message library", "nyholm/psr7": "PSR-7 HTTP message library", "ringcentral/psr7": "PSR-7 HTTP message library" diff --git a/src/Adapter/ZendDiactorosAdapter.php b/src/Adapter/ZendDiactorosAdapter.php deleted file mode 100644 index cf3219c..0000000 --- a/src/Adapter/ZendDiactorosAdapter.php +++ /dev/null @@ -1,42 +0,0 @@ -assertEquals(class_exists('Zend\Diactoros\Uri'), ZendDiactorosAdapter::isInstalled()); - } - - public function testFactory() - { - $factory = ZendDiactorosAdapter::factory(); - $this->assertInstanceOf(ZendDiactorosAdapter::class, $factory); - } - - public function testUri() - { - $factory = ZendDiactorosAdapter::factory(); - $uri = $factory->createUri('http://www.example.net'); - $this->assertInstanceOf(UriInterface::class, $uri); - } - - public function testInFactory() - { - $_SERVER['HTTP_HOST'] = 'localhost'; - $_SERVER['REQUEST_URI'] = '/foo/bar?foo=bar&baz=bat'; - $uri = current_location(ZendDiactorosAdapter::factory()); - $this->assertInstanceOf('Zend\Diactoros\Uri', $uri); - unset($_SERVER['REQUEST_URI'], $_SERVER['HTTP_HOST']); - } -} diff --git a/tests/UriFactoryTest.php b/tests/UriFactoryTest.php index aeea11b..f4ff796 100644 --- a/tests/UriFactoryTest.php +++ b/tests/UriFactoryTest.php @@ -4,7 +4,6 @@ use BenTools\UriFactory\Adapter\GuzzleAdapter; use BenTools\UriFactory\Adapter\LeagueUriAdapter; -use BenTools\UriFactory\Adapter\ZendDiactorosAdapter; use BenTools\UriFactory\UriFactory; use GuzzleHttp\Psr7\Uri as GuzzleUri; use League\Uri\Http as LeagueUri; @@ -12,7 +11,6 @@ use Psr\Http\Message\UriInterface; use function BenTools\UriFactory\Helper\current_location; use function BenTools\UriFactory\Helper\uri; -use Zend\Diactoros\Uri as ZendUri; class UriFactoryTest extends TestCase {