Skip to content
This repository has been archived by the owner on Apr 28, 2024. It is now read-only.

Commit

Permalink
4.4.3 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
lcharette authored Dec 28, 2020
2 parents aeb34e0 + d2b2804 commit 691274f
Show file tree
Hide file tree
Showing 12 changed files with 92 additions and 109 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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.*']
os: [ubuntu-latest, windows-latest]

runs-on: ${{ matrix.os }}
name: PHPUnit Tests - ${{ matrix.php_versions }} - ${{ matrix.os }} - ${{ matrix.laravel }}

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
36 changes: 0 additions & 36 deletions .github/workflows/windows.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ composer.lock
.php_cs.cache
.vscode
_meta
.phpunit.result.cache
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,28 @@

[![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 |
| ------ |:-----:|:-------------:|:--------:|:-----:|
| [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] |
| 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] |

<!-- Links -->
[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

Louis Charette 2018

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
4 changes: 4 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-html" target="_meta/coverage"/>
<log type="coverage-clover" target="_meta/coverage.xml"/>
</logging>
</phpunit>
2 changes: 1 addition & 1 deletion src/ResourceLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 12 additions & 22 deletions tests/BuildingLocatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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]);
Expand All @@ -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);
}

Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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]);
Expand Down
Loading

0 comments on commit 691274f

Please sign in to comment.