From c462d0eefff4a5009dbfc0dc952f111ac8d86cc9 Mon Sep 17 00:00:00 2001 From: Louis Charette Date: Sun, 13 Jan 2019 16:52:48 -0500 Subject: [PATCH] Updated Dependencies --- .php_cs | 5 +- CHANGELOG.md | 10 ++-- README.md | 8 +-- RUNNING_TESTS.md | 42 ++++++++++++++++ STYLE-GUIDE.md | 50 +++++++++++++++++++ composer.json | 3 +- src/AssetBundles/AssetBundlesInterface.php | 3 +- src/AssetBundles/GulpBundleAssetsBundles.php | 22 ++++---- .../GulpBundleAssetsCompiledBundles.php | 7 +-- .../GulpBundleAssetsRawBundles.php | 4 +- src/AssetLoader.php | 3 +- src/Assets.php | 3 +- src/AssetsTemplatePlugin.php | 3 +- src/Exception/InvalidBundlesFileException.php | 3 +- src/ServeAsset/SlimServeAsset.php | 3 +- src/Util/MimeType.php | 3 +- 16 files changed, 137 insertions(+), 35 deletions(-) create mode 100644 RUNNING_TESTS.md create mode 100644 STYLE-GUIDE.md diff --git a/.php_cs b/.php_cs index 9595dd8..d989615 100644 --- a/.php_cs +++ b/.php_cs @@ -1,8 +1,9 @@ in([__DIR__ . '/src', __DIR__ . '/tests']); + ->in([__DIR__ . '/src']); return PhpCsFixer\Config::create() ->setRules($rules) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84c03c6..a6174ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,15 @@ # Changelog + All notable changes to this project will be documented in this file. -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +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). -## [Unreleased] +## [5.0.1] - 2019-01-13 +- Updated Dependencies ## [5.0.0] - 2019-01-12 ### Added -- Option to recieve a `UserFrosting\Support\Repository\Repository` instance from UserFrosting\Assets\AssetBundles\GulpBundleAssetsBundles->readSchema` function by providing true for the second argument. +- Option to receive a `UserFrosting\Support\Repository\Repository` instance from UserFrosting\Assets\AssetBundles\GulpBundleAssetsBundles->readSchema` function by providing true for the second argument. ### Changed - `GulpBundleAssets*Bundles` classes simplified using ``UserFrosting\Support\Repository\Repository` returned by extended `readSchema`. @@ -46,6 +47,7 @@ Update composer dependencies. ## [4.0.0] - 2017-02-19 Initial 4.x release. +[5.0.1]: https://github.com/userfrosting/assets/compare/5.0.0...5.0.1 [5.0.0]: https://github.com/userfrosting/assets/compare/4.2.0...5.0.0 [4.2.0]: https://github.com/userfrosting/assets/compare/4.1.0...4.2.0 [4.1.0]: https://github.com/userfrosting/assets/compare/4.0.1...4.1.0 diff --git a/README.md b/README.md index d8cc600..2f759f9 100644 --- a/README.md +++ b/README.md @@ -176,10 +176,6 @@ $assetsPlugin = new AssetsTemplatePlugin($assets); ``` -## Testing +## [Style Guide](STYLE-GUIDE.md) -Testing can be done using the local version retrieved by composer : - -```shell -vendor/bin/phpunit -``` +## [Testing](RUNNING_TESTS.md) diff --git a/RUNNING_TESTS.md b/RUNNING_TESTS.md new file mode 100644 index 0000000..cca707c --- /dev/null +++ b/RUNNING_TESTS.md @@ -0,0 +1,42 @@ +# Running Tests + +## Prerequisites + +### PHPUnit +Unit tests use PHPUnit framework (see http://www.phpunit.de for more information). PHPUnit can be installed via Composer together with other development dependencies using the following command from the command line. + +``` +php composer install --dev +``` + +If you don't have composer, you need to install it: + 1. [Get Composer and Follow Installation instructions here](https://getcomposer.org/download ) + 2. Be sure to [install Composer **globally**](https://getcomposer.org/doc/00-intro.md#globally): `mv composer.phar /usr/local/bin/composer` + +## Running + +Once the prerequisites are installed, run the tests from the project root directory: + +``` +vendor/bin/phpunit +``` + + +If the tests are successful, you should see something similar to this. Otherwise, the errors will be displayed. +``` +PHPUnit 5.4.8-2-g44c37e0 by Sebastian Bergmann and contributors. + +. 1 / 1 (100%) + +Time: 41 ms, Memory: 3.75MB + +OK (1 test, 18 assertions) +``` + +# Running test coverage report + +``` +vendor/bin/phpunit --coverage-html _meta/coverage +``` + +Report will be available in _meta/coverage/index.html diff --git a/STYLE-GUIDE.md b/STYLE-GUIDE.md new file mode 100644 index 0000000..fd7c7d2 --- /dev/null +++ b/STYLE-GUIDE.md @@ -0,0 +1,50 @@ +# Style guide for contributing + +## PHP + +All PHP contributions must adhere to [PSR-1](http://www.php-fig.org/psr/psr-1/) and [PSR-2](http://www.php-fig.org/psr/psr-2/) specifications. + +In addition: + +### Documentation + +- All documentation blocks must adhere to the [PHPDoc](https://phpdoc.org/) format and syntax. +- All PHP files MUST contain the following documentation block immediately after the opening `=5.6", "rockettheme/toolbox": "~1.3.0", - "userfrosting/support": "~4.1.0", + "userfrosting/support": "~4.2.0", "userfrosting/uniformresourcelocator": "~4.2.0" }, "require-dev": { + "friendsofphp/php-cs-fixer": "^2.13", "phpunit/phpunit": "^5.7", "slim/slim": "^3" }, diff --git a/src/AssetBundles/AssetBundlesInterface.php b/src/AssetBundles/AssetBundlesInterface.php index ba8ba34..59dc57a 100644 --- a/src/AssetBundles/AssetBundlesInterface.php +++ b/src/AssetBundles/AssetBundlesInterface.php @@ -1,8 +1,9 @@ load()); - } - catch (FileNotFoundException $e) { + } catch (FileNotFoundException $e) { throw new FileNotFoundException('The schema file could not be found.', 0, $e); - } - catch (JsonException $e) { + } catch (JsonException $e) { throw new JsonException('The schema file could not be found.', 0, $e); } } else { @@ -100,12 +100,12 @@ protected function readSchema($path, $useRepository = false) if ($doc === false) { throw new FileNotFoundException("The schema '$path' could not be found."); } - + $schema = json_decode($doc); if ($schema === null) { throw new JsonException("The schema '$path' does not contain a valid JSON document. JSON error: " . json_last_error()); } - + return $schema; } } diff --git a/src/AssetBundles/GulpBundleAssetsCompiledBundles.php b/src/AssetBundles/GulpBundleAssetsCompiledBundles.php index 1cb662e..75ec562 100644 --- a/src/AssetBundles/GulpBundleAssetsCompiledBundles.php +++ b/src/AssetBundles/GulpBundleAssetsCompiledBundles.php @@ -1,8 +1,9 @@ cssBundles[$bundleName][] = $styles; - } else if ($styles !== null) { + } elseif ($styles !== null) { throw new InvalidBundlesFileException("Expected styles property for '$bundleName' to be of type string but was '" . gettype($styles) . "' for '$path'"); } $scripts = $schema["$bundleName.scripts"]; if (is_string($scripts)) { $this->jsBundles[$bundleName][] = $scripts; - } else if ($scripts !== null) { + } elseif ($scripts !== null) { throw new InvalidBundlesFileException("Expected scripts property for '$bundleName' to be of type string but was '" . gettype($scripts) . "' for '$path'"); } } diff --git a/src/AssetBundles/GulpBundleAssetsRawBundles.php b/src/AssetBundles/GulpBundleAssetsRawBundles.php index ad0fb05..ebf8c24 100644 --- a/src/AssetBundles/GulpBundleAssetsRawBundles.php +++ b/src/AssetBundles/GulpBundleAssetsRawBundles.php @@ -1,8 +1,9 @@