From 013e44ecfe2a46eaa8c78e3327035bd264af55f7 Mon Sep 17 00:00:00 2001 From: Louis Charette Date: Tue, 22 Dec 2020 21:02:51 -0500 Subject: [PATCH 1/8] Farewell Travis ! --- .github/workflows/Build.yml | 42 +++++++++++++++++++++++++++++++++++ .gitignore | 1 + .travis.yml | 23 ------------------- README.md | 10 ++++----- composer.json | 2 +- phpunit.xml | 4 ++++ tests/BuildingLocatorTest.php | 2 +- tests/ResourceTest.php | 2 +- 8 files changed, 55 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/Build.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml new file mode 100644 index 0000000..3a923b0 --- /dev/null +++ b/.github/workflows/Build.yml @@ -0,0 +1,42 @@ +name: Build + +on: + push: + branches: [master, develop] + pull_request: + branches: [master, develop] + schedule: + - cron: "0 0 * * 5" + +jobs: + PHPUnit: + + strategy: + fail-fast: false + matrix: + php_versions: ['7.1', '7.2', '7.3', '7.4'] + laravel: ['5.8.*'] + + name: PHPUnit Tests - ${{ matrix.php_versions }} - ${{ runner.os }} - ${{ matrix.laravel }} + runs-on: ['ubuntu-latest', 'windows-latest'] + + steps: + - uses: actions/checkout@v2 + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php_versions }} + extensions: mbstring, dom, fileinfo, gd + coverage: xdebug + tools: pecl + - name: Set Laravel version + run: composer require "illuminate/support:${{ matrix.laravel }}" --no-update + - name: Install Dependencies + run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist + - name: Execute tests via PHPUnit + run: vendor/bin/phpunit + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + file: ./_meta/coverage.xml + fail_ci_if_error: true diff --git a/.gitignore b/.gitignore index 8336ea0..9ef09f8 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ composer.lock .php_cs.cache .vscode _meta +.phpunit.result.cache diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e2d559e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -sudo: false -dist: trusty -language: php - -php: - - 7.1 - - 7.2 - - 7.3 - - 7.4 - -env: - - LARAVEL_VERSION=5.8.* - -before_script: - - travis_retry composer self-update - - if [ "$LARAVEL_VERSION" != "" ]; then composer require "illuminate/filesystem:${LARAVEL_VERSION}" --no-update; fi; - - travis_retry composer install --prefer-source --no-interaction - -script: - - vendor/bin/phpunit --coverage-clover=coverage.xml - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/README.md b/README.md index 6f928d9..d0ef7db 100644 --- a/README.md +++ b/README.md @@ -14,20 +14,20 @@ [UniformResourceLocator]: https://github.com/userfrosting/uniformresourcelocator [URI-develop]: https://github.com/userfrosting/uniformresourcelocator/tree/develop [URI-version]: https://img.shields.io/github/release/userfrosting/UniformResourceLocator.svg -[URI-master-build]: https://travis-ci.org/userfrosting/UniformResourceLocator.svg?branch=master +[URI-master-build]: https://github.com/userfrosting/UniformResourceLocator/workflows/Build/badge.svg?branch=master [URI-master-codecov]: https://codecov.io/gh/userfrosting/UniformResourceLocator/branch/master/graph/badge.svg -[URI-develop-build]: https://travis-ci.org/userfrosting/UniformResourceLocator.svg?branch=develop +[URI-develop-build]: https://github.com/userfrosting/UniformResourceLocator/workflows/Build/badge.svg?branch=develop [URI-develop-codecov]: https://codecov.io/gh/userfrosting/UniformResourceLocator/branch/develop/graph/badge.svg [URI-releases]: https://github.com/userfrosting/UniformResourceLocator/releases -[URI-travis]: https://travis-ci.org/userfrosting/UniformResourceLocator +[URI-travis]: https://github.com/userfrosting/UniformResourceLocator/actions?query=workflow%3ABuild [URI-codecov]: https://codecov.io/gh/userfrosting/UniformResourceLocator [URI-style-master]: https://github.styleci.io/repos/128138460/shield?branch=master&style=flat [URI-style-develop]: https://github.styleci.io/repos/128138460/shield?branch=develop&style=flat [URI-style]: https://github.styleci.io/repos/128138460 [URI-windows-master-build]: https://github.com/userfrosting/UniformResourceLocator/actions?query=branch%3Amaster [URI-windows-develop-build]: https://github.com/userfrosting/UniformResourceLocator/actions?query=branch%3Adevelop -[URI-windows-master]: https://img.shields.io/github/workflow/status/userfrosting/UniformResourceLocator/Windows%20Build -[URI-windows-develop]: https://img.shields.io/github/workflow/status/userfrosting/UniformResourceLocator/Windows%20Build/develop +[URI-windows-master]: https://github.com/userfrosting/UniformResourceLocator/workflows/Windows%20Build/badge.svg?branch=master +[URI-windows-develop]: https://github.com/userfrosting/UniformResourceLocator/workflows/Windows%20Build/badge.svg?branch=develop Louis Charette 2018 diff --git a/composer.json b/composer.json index 53113ee..1365786 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.13", - "phpunit/phpunit": "^7.5", + "phpunit/phpunit": "^7.5 | ^8.5", "victorjonsson/markdowndocs": "^1.3" }, "autoload": { diff --git a/phpunit.xml b/phpunit.xml index cee98c8..e6270c1 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -19,4 +19,8 @@ src/ + + + + \ No newline at end of file diff --git a/tests/BuildingLocatorTest.php b/tests/BuildingLocatorTest.php index 6204012..9329b69 100644 --- a/tests/BuildingLocatorTest.php +++ b/tests/BuildingLocatorTest.php @@ -69,7 +69,7 @@ class BuildingLocatorTest extends TestCase * - Floors/Floor1/test.json : Overwritten by Floor3 version * - Garage/files/blah.json : Should never be found, because the Garage is not part of the file:// search path */ - public function setUp() + public function setUp(): void { parent::setup(); diff --git a/tests/ResourceTest.php b/tests/ResourceTest.php index c757883..3a4b00e 100644 --- a/tests/ResourceTest.php +++ b/tests/ResourceTest.php @@ -36,7 +36,7 @@ class ResourceTest extends TestCase protected $locationName = 'bar'; protected $locationPath = 'bar/'; - public function setUp() + public function setUp(): void { parent::setup(); From 3a52e626a46bb78a1444e65ba0afe85afb42c2bd Mon Sep 17 00:00:00 2001 From: Louis Charette Date: Tue, 22 Dec 2020 21:06:38 -0500 Subject: [PATCH 2/8] Fix build syntaxt --- .github/workflows/Build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 3a923b0..1c2ed38 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -17,8 +17,8 @@ jobs: php_versions: ['7.1', '7.2', '7.3', '7.4'] laravel: ['5.8.*'] + runs-on: [ubuntu-latest, windows-latest] name: PHPUnit Tests - ${{ matrix.php_versions }} - ${{ runner.os }} - ${{ matrix.laravel }} - runs-on: ['ubuntu-latest', 'windows-latest'] steps: - uses: actions/checkout@v2 From 879eb91898f39ed4572fcfc94802e475cafbc68c Mon Sep 17 00:00:00 2001 From: Louis Charette Date: Tue, 22 Dec 2020 21:12:53 -0500 Subject: [PATCH 3/8] Build whould work now --- .github/workflows/Build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 1c2ed38..53ccd98 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -16,9 +16,10 @@ jobs: matrix: php_versions: ['7.1', '7.2', '7.3', '7.4'] laravel: ['5.8.*'] + os: [ubuntu-latest, windows-latest] - runs-on: [ubuntu-latest, windows-latest] - name: PHPUnit Tests - ${{ matrix.php_versions }} - ${{ runner.os }} - ${{ matrix.laravel }} + runs-on: ${{ matrix.os }} + name: PHPUnit Tests - ${{ matrix.php_versions }} - ${{ matrix.os }} - ${{ matrix.laravel }} steps: - uses: actions/checkout@v2 From 759afa5ed34670c45d05d96c947f24bb9071be2d Mon Sep 17 00:00:00 2001 From: Louis Charette Date: Tue, 22 Dec 2020 21:15:19 -0500 Subject: [PATCH 4/8] Windows build has been merged to main Build file --- .github/workflows/windows.yml | 36 ----------------------------------- README.md | 8 ++------ 2 files changed, 2 insertions(+), 42 deletions(-) delete mode 100644 .github/workflows/windows.yml diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml deleted file mode 100644 index 9e381f8..0000000 --- a/.github/workflows/windows.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Windows Build -on: [push, pull_request] -jobs: - UniformResourceLocator: - name: PHP ${{ matrix.php-versions }} - runs-on: windows-latest - strategy: - fail-fast: false - matrix: - php-versions: ['7.1', '7.2', '7.3', '7.4'] - steps: - - name: Checkout - uses: actions/checkout@v1 - - name: Setup PHP, with composer and extensions - uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php - with: - php-version: ${{ matrix.php-versions }} - extensions: mbstring, dom, fileinfo - coverage: xdebug #optional - - name: Get composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - name: Cache composer dependencies - uses: actions/cache@v1 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-composer- - - name: Install Composer dependencies - run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader - - name: Test with phpunit - run: vendor/bin/phpunit --coverage-clover=coverage.xml - - name: Codecov - uses: codecov/codecov-action@v1.0.5 - with: - token: ${{ secrets.CODECOV_TOKEN }} #required diff --git a/README.md b/README.md index d0ef7db..608503f 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ | Branch | Build | Windows Build | Coverage | Style | | ------ |:-----:|:-------------:|:--------:|:-----:| -| [master][UniformResourceLocator] | [![][URI-master-build]][URI-travis] | [![][URI-windows-master]][URI-windows-master-build] | [![][URI-master-codecov]][URI-codecov] | [![][URI-style-master]][URI-style] | -| [develop][URI-develop] | [![][URI-develop-build]][URI-travis] | [![][URI-windows-develop]][URI-windows-develop-build] | [![][URI-develop-codecov]][URI-codecov] | [![][URI-style-develop]][URI-style] | +| [master][UniformResourceLocator] | [![][URI-master-build]][URI-travis] | [![][URI-master-codecov]][URI-codecov] | [![][URI-style-master]][URI-style] | +| [develop][URI-develop] | [![][URI-develop-build]][URI-travis] | [![][URI-develop-codecov]][URI-codecov] | [![][URI-style-develop]][URI-style] | [UniformResourceLocator]: https://github.com/userfrosting/uniformresourcelocator @@ -24,10 +24,6 @@ [URI-style-master]: https://github.styleci.io/repos/128138460/shield?branch=master&style=flat [URI-style-develop]: https://github.styleci.io/repos/128138460/shield?branch=develop&style=flat [URI-style]: https://github.styleci.io/repos/128138460 -[URI-windows-master-build]: https://github.com/userfrosting/UniformResourceLocator/actions?query=branch%3Amaster -[URI-windows-develop-build]: https://github.com/userfrosting/UniformResourceLocator/actions?query=branch%3Adevelop -[URI-windows-master]: https://github.com/userfrosting/UniformResourceLocator/workflows/Windows%20Build/badge.svg?branch=master -[URI-windows-develop]: https://github.com/userfrosting/UniformResourceLocator/workflows/Windows%20Build/badge.svg?branch=develop Louis Charette 2018 From 46e8e1eabb4aaee8db2a963db7efe83f02b856c6 Mon Sep 17 00:00:00 2001 From: Louis Charette Date: Tue, 22 Dec 2020 21:19:29 -0500 Subject: [PATCH 5/8] New RC Badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 608503f..658bf5a 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Latest Version](https://img.shields.io/github/release/userfrosting/UniformResourceLocator.svg)](https://github.com/userfrosting/UniformResourceLocator/releases) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE.md) -[![Join the chat at https://chat.userfrosting.com/channel/support](https://demo.rocket.chat/images/join-chat.svg)](https://chat.userfrosting.com/channel/support) +[![Join the chat at https://chat.userfrosting.com/channel/support](https://chat.userfrosting.com/api/v1/shield.svg?name=UserFrosting)](https://chat.userfrosting.com/channel/support) [![Donate](https://img.shields.io/badge/Open%20Collective-Donate-blue.svg)](https://opencollective.com/userfrosting#backer) | Branch | Build | Windows Build | Coverage | Style | From 669099b90b802253a2eeaf5c677c245da05238c2 Mon Sep 17 00:00:00 2001 From: Louis Charette Date: Wed, 23 Dec 2020 10:28:44 -0500 Subject: [PATCH 6/8] Upgrade deprecation in tests --- README.md | 4 ++-- tests/BuildingLocatorTest.php | 32 +++++++++++--------------------- tests/ResourceLocatorTest.php | 28 +++++++++++++++------------- 3 files changed, 28 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 658bf5a..6c946e2 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ [![Join the chat at https://chat.userfrosting.com/channel/support](https://chat.userfrosting.com/api/v1/shield.svg?name=UserFrosting)](https://chat.userfrosting.com/channel/support) [![Donate](https://img.shields.io/badge/Open%20Collective-Donate-blue.svg)](https://opencollective.com/userfrosting#backer) -| Branch | Build | Windows Build | Coverage | Style | -| ------ |:-----:|:-------------:|:--------:|:-----:| +| Branch | Build | Coverage | Style | +| ------ |:-----:|:--------:|:-----:| | [master][UniformResourceLocator] | [![][URI-master-build]][URI-travis] | [![][URI-master-codecov]][URI-codecov] | [![][URI-style-master]][URI-style] | | [develop][URI-develop] | [![][URI-develop-build]][URI-travis] | [![][URI-develop-codecov]][URI-codecov] | [![][URI-style-develop]][URI-style] | diff --git a/tests/BuildingLocatorTest.php b/tests/BuildingLocatorTest.php index 9329b69..1166854 100644 --- a/tests/BuildingLocatorTest.php +++ b/tests/BuildingLocatorTest.php @@ -125,7 +125,7 @@ public function testFindWithArray($scheme, $file, $location, $expectedPaths) // find($scheme, $file, $array, $all) $resource = $this->invokeMethod(self::$locator, 'find', [$scheme, $file, true, false]); - $this->assertInternalType('array', $resource); + $this->assertIsArray($resource); $this->assertEquals($this->relativeToAbsolutePaths($expectedPaths), $resource); } @@ -165,32 +165,28 @@ public function testFindWithArrayAndAll($scheme, $file, $location, $expectedPath // find($scheme, $file, $array, $all) $resource = $this->invokeMethod(self::$locator, 'find', [$scheme, $file, true, true]); - $this->assertInternalType('array', $resource); + $this->assertIsArray($resource); $this->assertEquals($this->relativeToAbsolutePaths($expectedAllPaths), $resource); } /** - * @expectedException \InvalidArgumentException * @depends testFind */ public function testFindThrowExceptionWhenSchemaDontExist() { + $this->expectException(\InvalidArgumentException::class); $this->invokeMethod(self::$locator, 'find', ['foo', 'foo', false, false]); } - /** - * @expectedException \InvalidArgumentException - */ public function testGetResourceThrowExceptionIfShemeNotExist() { + $this->expectException(\InvalidArgumentException::class); self::$locator->getResource('foo://'); } - /** - * @expectedException \InvalidArgumentException - */ public function testGetResourceThrowExceptionOnInvalidParameterUri() { + $this->expectException(\InvalidArgumentException::class); self::$locator->getResource(123); } @@ -243,7 +239,7 @@ public function testGetResourcesForSharedStream($scheme, $file, $location, $expe $uri = $scheme.'://'.$file; $resources = $locator->getResources($uri); - $this->assertInternalType('array', $resources); + $this->assertIsArray($resources); $this->assertCount(count($expectedPaths), $resources); $this->assertInstanceOf(ResourceInterface::class, $resources[0]); $this->assertEquals($this->getBasePath().$expectedPaths[0], $resources[0]); @@ -258,7 +254,7 @@ public function testGetResourcesForSharedStreamReturnFalseIfNoResourceFalse() $locator = self::$locator; $resources = $locator->getResources('cars://idontExist.txt'); - $this->assertInternalType('array', $resources); + $this->assertIsArray($resources); $this->assertCount(0, $resources); } @@ -287,27 +283,21 @@ public function testFindResourceForSharedStream($scheme, $file, $location, $expe $this->assertEquals($expectedPaths, $locator->findResources($uri, false)); } - /** - * @expectedException \InvalidArgumentException - */ public function testFindResourceThrowExceptionOnBadUri() { + $this->expectException(\InvalidArgumentException::class); self::$locator->findResource(123); } - /** - * @expectedException \InvalidArgumentException - */ public function testFindResourcesThrowExceptionOnBadUri() { + $this->expectException(\InvalidArgumentException::class); self::$locator->findResources(123); } - /** - * @expectedException \InvalidArgumentException - */ public function testInvokeThrowExceptionOnBadUri() { + $this->expectException(\InvalidArgumentException::class); $locator = self::$locator; $locator(123); } @@ -369,7 +359,7 @@ public function testGetResources($scheme, $file, $location, $expectedPaths) $uri = $scheme.'://'.$file; $resources = $locator->getResources($uri); - $this->assertInternalType('array', $resources); + $this->assertIsArray($resources); $this->assertCount(count($expectedPaths), $resources); $this->assertEquals($this->relativeToAbsolutePaths($expectedPaths), $resources); $this->assertInstanceOf(ResourceInterface::class, $resources[0]); diff --git a/tests/ResourceLocatorTest.php b/tests/ResourceLocatorTest.php index c07c4bf..73849f4 100644 --- a/tests/ResourceLocatorTest.php +++ b/tests/ResourceLocatorTest.php @@ -13,6 +13,8 @@ use PHPUnit\Framework\TestCase; use RocketTheme\Toolbox\ResourceLocator\ResourceLocatorInterface as BaseResourceLocatorInterface; use RocketTheme\Toolbox\StreamWrapper\StreamBuilder; +use UserFrosting\UniformResourceLocator\Exception\LocationNotFoundException; +use UserFrosting\UniformResourceLocator\Exception\StreamNotFoundException; use UserFrosting\UniformResourceLocator\ResourceLocation; use UserFrosting\UniformResourceLocator\ResourceLocationInterface; use UserFrosting\UniformResourceLocator\ResourceLocator; @@ -91,7 +93,7 @@ public function testAddStream() $this->assertTrue($locator->schemeExists('bar')); $barStream = $locator->getStream('bar'); - $this->assertInternalType('array', $barStream); + $this->assertIsArray($barStream); $this->assertInstanceOf(ResourceStreamInterface::class, $barStream[''][0]); $this->assertEquals('foo', $barStream[''][0]->getPath()); } @@ -109,7 +111,7 @@ public function testRegisterStream() $this->assertTrue($locator->schemeExists('bar')); $barStream = $locator->getStream('bar'); - $this->assertInternalType('array', $barStream); + $this->assertIsArray($barStream); $this->assertInstanceOf(ResourceStreamInterface::class, $barStream[''][0]); $this->assertEquals('foo', $barStream[''][0]->getPath()); } @@ -127,7 +129,7 @@ public function testRegisterSharedStream() $this->assertTrue($locator->schemeExists('bar')); $barStream = $locator->getStream('bar'); - $this->assertInternalType('array', $barStream); + $this->assertIsArray($barStream); $this->assertInstanceOf(ResourceStreamInterface::class, $barStream[''][0]); $this->assertEquals('foo', $barStream[''][0]->getPath()); $this->assertTrue($barStream[''][0]->isShared()); @@ -146,7 +148,7 @@ public function testRegisterSharedStreamShort() $this->assertTrue($locator->schemeExists('bar')); $barStream = $locator->getStream('bar'); - $this->assertInternalType('array', $barStream); + $this->assertIsArray($barStream); $this->assertInstanceOf(ResourceStreamInterface::class, $barStream[''][0]); $this->assertEquals('foo', $barStream[''][0]->getPath()); $this->assertTrue($barStream[''][0]->isShared()); @@ -166,7 +168,7 @@ public function testRegisterStreamWithPrefix() $this->assertTrue($locator->schemeExists('bar')); $barStream = $locator->getStream('bar'); - $this->assertInternalType('array', $barStream); + $this->assertIsArray($barStream); $this->assertInstanceOf(ResourceStreamInterface::class, $barStream['prefix'][0]); $this->assertEquals('foo', $barStream[''][0]->getPath()); $this->assertEquals('oof', $barStream['prefix'][0]->getPath()); @@ -185,28 +187,28 @@ public function testRegisterStreamWithOutPath() $this->assertTrue($locator->schemeExists('bar')); $barStream = $locator->getStream('bar'); - $this->assertInternalType('array', $barStream); + $this->assertIsArray($barStream); $this->assertInstanceOf(ResourceStreamInterface::class, $barStream[''][0]); $this->assertEquals('bar', $barStream[''][0]->getPath()); } /** * @depends testRegisterStream - * @expectedException \UserFrosting\UniformResourceLocator\Exception\StreamNotFoundException */ public function testStreamNotFoundException() { $locator = new ResourceLocator(); + $this->expectException(StreamNotFoundException::class); $locator->getStream('etc'); } /** * @depends testRegisterStream - * @expectedException \InvalidArgumentException */ public function testAddStreamThrowExceptionOnRestrictedScheme() { $locator = new ResourceLocator(); + $this->expectException(\InvalidArgumentException::class); $locator->registerStream('file'); } @@ -263,7 +265,7 @@ public function testGetStreams() $locator->registerStream('foo'); $streams = $locator->getStreams(); - $this->assertInternalType('array', $streams); + $this->assertIsArray($streams); $this->assertCount(2, $streams); $this->assertInstanceOf(ResourceStreamInterface::class, $streams['bar'][''][0]); $this->assertEquals('bar', $streams['bar'][''][0]->getPath()); @@ -347,11 +349,11 @@ public function testRegisterLocationWithNoPath() /** * @depends testAddLocation - * @expectedException \UserFrosting\UniformResourceLocator\Exception\LocationNotFoundException */ public function testGetLocationThrowExceptionIfNotFound() { $locator = new ResourceLocator(); + $this->expectException(LocationNotFoundException::class); $locator->getLocation('etc'); } @@ -365,7 +367,7 @@ public function testGetLocations() $locator->registerLocation('foo', '/bar'); $locations = $locator->getLocations(); - $this->assertInternalType('array', $locations); + $this->assertIsArray($locations); $this->assertCount(2, $locations); $this->assertInstanceOf(ResourceLocationInterface::class, $locations['bar']); $this->assertEquals('/foo', $locations['bar']->getPath()); @@ -482,21 +484,21 @@ public function testNormalizeReturnFalseOnSuppressedException() /** * @depends testNormalizeReturnFalseOnSuppressedException - * @expectedException \BadMethodCallException */ public function testNormalizeThrowExceptionOnBadUri() { $locator = new ResourceLocator(); + $this->expectException(\BadMethodCallException::class); $locator->normalize(123, true); } /** * @depends testNormalizeReturnFalseOnSuppressedException - * @expectedException \BadMethodCallException */ public function testNormalizeThrowExceptionOnBadUriPart() { $locator = new ResourceLocator(); + $this->expectException(\BadMethodCallException::class); $locator->normalize('path/to/../../../file.txt', true); } From b36e50ba5b583334a20218cf99266cc8460700b5 Mon Sep 17 00:00:00 2001 From: Louis Charette Date: Wed, 23 Dec 2020 10:39:58 -0500 Subject: [PATCH 7/8] Provides better exception message --- src/ResourceLocator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ResourceLocator.php b/src/ResourceLocator.php index 5f9d81d..4d03574 100644 --- a/src/ResourceLocator.php +++ b/src/ResourceLocator.php @@ -613,7 +613,7 @@ protected function find(string $scheme, string $file, bool $array, bool $all) { // Make sure stream exist if (!$this->schemeExists($scheme)) { - throw new InvalidArgumentException("Invalid resource {$scheme}://"); + throw new InvalidArgumentException("Scheme {$scheme}:// doesn't exist."); } // Prepare result depending on $array parameter From d2b280490a61efea5f860c26288c7bff3cea5c06 Mon Sep 17 00:00:00 2001 From: Louis Charette Date: Mon, 28 Dec 2020 14:04:22 -0500 Subject: [PATCH 8/8] Update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d2fa6f..0b98d3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [4.4.3] +- Replaced Travis with GitHub Action for build +- Upgrade deprecation in tests +- Provides better exception message when scheme doesn't exist + ## [4.4.2] - Fix issue where extra `/` would be present in the calculated path for stream with empty ('') path ([#16]). - Update PHP7 type hinting & DocBloc @@ -63,6 +68,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ### Security --> +[4.4.3]: https://github.com/userfrosting/uniformresourcelocator/compare/4.4.2...4.4.3 [4.4.2]: https://github.com/userfrosting/uniformresourcelocator/compare/4.4.1...4.4.2 [4.4.1]: https://github.com/userfrosting/uniformresourcelocator/compare/4.4.0...4.4.1 [4.4.0]: https://github.com/userfrosting/uniformresourcelocator/compare/4.3.3...4.4.0