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

Commit

Permalink
Updated Dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
lcharette committed Jan 13, 2019
1 parent 4552e99 commit c462d0e
Show file tree
Hide file tree
Showing 16 changed files with 137 additions and 35 deletions.
5 changes: 3 additions & 2 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

$header = 'UserFrosting (http://www.userfrosting.com)
$header = 'UserFrosting Assets (http://www.userfrosting.com)
@link https://github.com/userfrosting/assets
@copyright Copyright (c) 2013-2019 Alexander Weissman, Jordan Mele
@license https://github.com/userfrosting/assets/blob/master/LICENSE.md (MIT License)';

$rules = [
Expand Down Expand Up @@ -101,7 +102,7 @@ $rules = [
];

$finder = PhpCsFixer\Finder::create()
->in([__DIR__ . '/src', __DIR__ . '/tests']);
->in([__DIR__ . '/src']);

return PhpCsFixer\Config::create()
->setRules($rules)
Expand Down
10 changes: 6 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`.
Expand Down Expand Up @@ -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
Expand Down
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,6 @@ $assetsPlugin = new AssetsTemplatePlugin($assets);
<script src="https://assets.userfrosting.com/assets/bootstrap/js/npm.js" defer="true"></script>
```

## 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)
42 changes: 42 additions & 0 deletions RUNNING_TESTS.md
Original file line number Diff line number Diff line change
@@ -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
50 changes: 50 additions & 0 deletions STYLE-GUIDE.md
Original file line number Diff line number Diff line change
@@ -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 `<?php` tag:

```
/**
* UserFrosting Assets (http://www.userfrosting.com)
*
* @link https://github.com/userfrosting/assets
* @copyright Copyright (c) 2013-2019 Alexander Weissman, Jordan Mele
* @license https://github.com/userfrosting/assets/blob/master/LICENSE.md (MIT License)
*/
```

### Classes

- All classes MUST be prefaced with a documentation block containing a description and the author(s) of that class. You SHOULD add other descriptive properties as well.
- All class members and methods MUST be prefaced with a documentation block. Any parameters and return values MUST be documented.
- The contents of a class should be organized in the following order: constants, member variables, constructor, other magic methods, public methods, protected methods, private methods.
- Within each of the categories above, variables/methods should be alphabetized. See http://stackoverflow.com/a/3366429/2970321.
- Setter methods SHOULD return the parent object.

### Variables

- All class member variables and local variables MUST be declared in `camelCase`.

### Arrays

- Array keys MUST be defined using `snake_case`. This is so they can be referenced in Twig and other templating languages.
- Array keys MUST NOT contain `.`. This is because `.` is a reserved operator in Laravel and Twig's [dot syntax](https://medium.com/@assertchris/dot-notation-3fd3e42edc61).
- Multidimensional arrays SHOULD be referenced using dot syntax whenever possible. So, instead of doing `$myArray['person1']['email']`, you should use `$myArray['person1.email']` if your array structure supports it.

## Automatically fixing coding style with PHP-CS-Fixer

[PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) can be used to automatically fix PHP code styling. UserFrosting provides a project specific configuration file ([`.php_cs`](.php_cs)) with a set of rules reflecting our style guidelines. This tool should be used before submitting any code change to assure the style guidelines are met. Every sprinkles will also be parsed by the fixer.

PHP-CS-Fixer is automatically loaded by Composer and can be used from the UserFrosting root directory :

```
vendor/bin/php-cs-fixer fix
```
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
"require": {
"php": ">=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"
},
Expand Down
3 changes: 2 additions & 1 deletion src/AssetBundles/AssetBundlesInterface.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
/**
* UserFrosting (http://www.userfrosting.com)
* UserFrosting Assets (http://www.userfrosting.com)
*
* @link https://github.com/userfrosting/assets
* @copyright Copyright (c) 2013-2019 Alexander Weissman, Jordan Mele
* @license https://github.com/userfrosting/assets/blob/master/LICENSE.md (MIT License)
*/

Expand Down
22 changes: 11 additions & 11 deletions src/AssetBundles/GulpBundleAssetsBundles.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
/**
* UserFrosting (http://www.userfrosting.com)
* UserFrosting Assets (http://www.userfrosting.com)
*
* @link https://github.com/userfrosting/assets
* @copyright Copyright (c) 2013-2019 Alexander Weissman, Jordan Mele
* @license https://github.com/userfrosting/assets/blob/master/LICENSE.md (MIT License)
*/

Expand Down Expand Up @@ -70,24 +71,23 @@ public function getJsBundleAssets($bundleName = '')
/**
* Attempts to read the schema file from provided path.
*
* @param string $path Path to schema file.
* @param bool $useRepository
* @param string $path Path to schema file.
* @param bool $useRepository
* @throws FileNotFoundException if file cannot be found.
* @throws JsonException if file cannot be parsed as JSON.
* @return mixed|Repository Returns file contents parsed by json_decode or a Repository if $useRepository is true.
* @throws JsonException if file cannot be parsed as JSON.
* @return mixed|Repository Returns file contents parsed by json_decode or a Repository if $useRepository is true.
*/
protected function readSchema($path, $useRepository = false)
{
if ($useRepository === true) {
// Read schmea using Repository
try {
$loader = new YamlFileLoader($path);

return new Repository($loader->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 {
Expand All @@ -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;
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/AssetBundles/GulpBundleAssetsCompiledBundles.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
/**
* UserFrosting (http://www.userfrosting.com)
* UserFrosting Assets (http://www.userfrosting.com)
*
* @link https://github.com/userfrosting/assets
* @copyright Copyright (c) 2013-2019 Alexander Weissman, Jordan Mele
* @license https://github.com/userfrosting/assets/blob/master/LICENSE.md (MIT License)
*/

Expand Down Expand Up @@ -38,14 +39,14 @@ public function __construct($path)
$styles = $schema["$bundleName.styles"];
if (is_string($styles)) {
$this->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'");
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/AssetBundles/GulpBundleAssetsRawBundles.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
/**
* UserFrosting (http://www.userfrosting.com)
* UserFrosting Assets (http://www.userfrosting.com)
*
* @link https://github.com/userfrosting/assets
* @copyright Copyright (c) 2013-2019 Alexander Weissman, Jordan Mele
* @license https://github.com/userfrosting/assets/blob/master/LICENSE.md (MIT License)
*/

Expand Down Expand Up @@ -79,6 +80,7 @@ protected function standardiseBundle($bundle)
throw new \InvalidArgumentException('Input was array, so string expected but encountered ' . gettype($asset));
}
}

return $bundle;
} else {
throw new \InvalidArgumentException('Expected string or string[] but input was ' . gettype($bundle));
Expand Down
3 changes: 2 additions & 1 deletion src/AssetLoader.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
/**
* UserFrosting (http://www.userfrosting.com)
* UserFrosting Assets (http://www.userfrosting.com)
*
* @link https://github.com/userfrosting/assets
* @copyright Copyright (c) 2013-2019 Alexander Weissman, Jordan Mele
* @license https://github.com/userfrosting/assets/blob/master/LICENSE.md (MIT License)
*/

Expand Down
3 changes: 2 additions & 1 deletion src/Assets.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
/**
* UserFrosting (http://www.userfrosting.com)
* UserFrosting Assets (http://www.userfrosting.com)
*
* @link https://github.com/userfrosting/assets
* @copyright Copyright (c) 2013-2019 Alexander Weissman, Jordan Mele
* @license https://github.com/userfrosting/assets/blob/master/LICENSE.md (MIT License)
*/

Expand Down
3 changes: 2 additions & 1 deletion src/AssetsTemplatePlugin.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
/**
* UserFrosting (http://www.userfrosting.com)
* UserFrosting Assets (http://www.userfrosting.com)
*
* @link https://github.com/userfrosting/assets
* @copyright Copyright (c) 2013-2019 Alexander Weissman, Jordan Mele
* @license https://github.com/userfrosting/assets/blob/master/LICENSE.md (MIT License)
*/

Expand Down
3 changes: 2 additions & 1 deletion src/Exception/InvalidBundlesFileException.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
/**
* UserFrosting (http://www.userfrosting.com)
* UserFrosting Assets (http://www.userfrosting.com)
*
* @link https://github.com/userfrosting/assets
* @copyright Copyright (c) 2013-2019 Alexander Weissman, Jordan Mele
* @license https://github.com/userfrosting/assets/blob/master/LICENSE.md (MIT License)
*/

Expand Down
3 changes: 2 additions & 1 deletion src/ServeAsset/SlimServeAsset.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
/**
* UserFrosting (http://www.userfrosting.com)
* UserFrosting Assets (http://www.userfrosting.com)
*
* @link https://github.com/userfrosting/assets
* @copyright Copyright (c) 2013-2019 Alexander Weissman, Jordan Mele
* @license https://github.com/userfrosting/assets/blob/master/LICENSE.md (MIT License)
*/

Expand Down
3 changes: 2 additions & 1 deletion src/Util/MimeType.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
/**
* UserFrosting (http://www.userfrosting.com)
* UserFrosting Assets (http://www.userfrosting.com)
*
* @link https://github.com/userfrosting/assets
* @copyright Copyright (c) 2013-2019 Alexander Weissman, Jordan Mele
* @license https://github.com/userfrosting/assets/blob/master/LICENSE.md (MIT License)
*/

Expand Down

0 comments on commit c462d0e

Please sign in to comment.