From 12c4eb09a376db64e6ebc5d08520050bc589a542 Mon Sep 17 00:00:00 2001 From: Scott A Connerly Date: Thu, 19 Nov 2015 16:28:33 -0600 Subject: [PATCH 1/6] * Cache what roles a user has * Cache what permissions a role has --- src/Entrust/Traits/EntrustRoleTrait.php | 28 +++++++++++++++++++++- src/Entrust/Traits/EntrustUserTrait.php | 32 ++++++++++++++++++++++--- 2 files changed, 56 insertions(+), 4 deletions(-) diff --git a/src/Entrust/Traits/EntrustRoleTrait.php b/src/Entrust/Traits/EntrustRoleTrait.php index aa507c01..34c8678d 100644 --- a/src/Entrust/Traits/EntrustRoleTrait.php +++ b/src/Entrust/Traits/EntrustRoleTrait.php @@ -8,10 +8,36 @@ * @package Zizaco\Entrust */ +use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Config; trait EntrustRoleTrait { + //Big block of caching functionality. + public function cachedPermissions() + { + $rolePrimaryKey = $this->primaryKey; + $cacheKey = 'entrust_permissions_for_role_'.$this->$rolePrimaryKey; + return Cache::tags(Config::get('entrust.permission_role_table'))->remember($cacheKey, Config::get('cache.ttl'), function () { + return $this->perms()->get(); + }); + } + public function save(array $options = []) + { //both inserts and updates + parent::save($options); + Cache::tags(Config::get('entrust.permission_role_table'))->flush(); + } + public function delete(array $options = []) + { //soft or hard + parent::delete($options); + Cache::tags(Config::get('entrust.permission_role_table'))->flush(); + } + public function restore() + { //soft delete undo's + parent::restore(); + Cache::tags(Config::get('entrust.permission_role_table'))->flush(); + } + /** * Many-to-Many relations with the user model. * @@ -81,7 +107,7 @@ public function hasPermission($name, $requireAll = false) // Return the value of $requireAll; return $requireAll; } else { - foreach ($this->perms as $permission) { + foreach ($this->cachedPermissions() as $permission) { if ($permission->name == $name) { return true; } diff --git a/src/Entrust/Traits/EntrustUserTrait.php b/src/Entrust/Traits/EntrustUserTrait.php index e5ae8c3c..420634e5 100644 --- a/src/Entrust/Traits/EntrustUserTrait.php +++ b/src/Entrust/Traits/EntrustUserTrait.php @@ -8,11 +8,37 @@ * @package Zizaco\Entrust */ +use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Config; use InvalidArgumentException; trait EntrustUserTrait { + //Big block of caching functionality. + public function cachedRoles() + { + $userPrimaryKey = $this->primaryKey; + $cacheKey = 'entrust_roles_for_user_'.$this->$userPrimaryKey; + return Cache::tags(Config::get('entrust.role_user_table'))->remember($cacheKey, Config::get('cache.ttl'), function () { + return $this->roles()->get(); + }); + } + public function save(array $options = []) + { //both inserts and updates + parent::save($options); + Cache::tags(Config::get('entrust.role_user_table'))->flush(); + } + public function delete(array $options = []) + { //soft or hard + parent::delete($options); + Cache::tags(Config::get('entrust.role_user_table'))->flush(); + } + public function restore() + { //soft delete undo's + parent::restore(); + Cache::tags(Config::get('entrust.role_user_table'))->flush(); + } + /** * Many-to-Many relations with Role. * @@ -69,7 +95,7 @@ public function hasRole($name, $requireAll = false) // Return the value of $requireAll; return $requireAll; } else { - foreach ($this->roles as $role) { + foreach ($this->cachedRoles() as $role) { if ($role->name == $name) { return true; } @@ -105,9 +131,9 @@ public function can($permission, $requireAll = false) // Return the value of $requireAll; return $requireAll; } else { - foreach ($this->roles as $role) { + foreach ($this->cachedRoles() as $role) { // Validate against the Permission table - foreach ($role->perms as $perm) { + foreach ($role->cachedPermissions() as $perm) { if (str_is( $permission, $perm->name) ) { return true; } From d3e406cd292a6056e7b1f573575074ae65c2df84 Mon Sep 17 00:00:00 2001 From: Scott A Connerly Date: Fri, 20 Nov 2015 08:43:28 -0600 Subject: [PATCH 2/6] * Attempting to unit test my changes, but having issues with mocking the $app. --- composer.json | 3 +- composer.lock | 947 +++++++++++++++--------- src/Entrust/Traits/EntrustRoleTrait.php | 2 +- tests/EntrustUserTest.php | 32 + 4 files changed, 631 insertions(+), 353 deletions(-) diff --git a/composer.json b/composer.json index 74d430a5..86e4ed13 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,8 @@ "require": { "php": ">=5.4.0", "illuminate/console": "~5.0", - "illuminate/support": "~5.0" + "illuminate/support": "~5.0", + "illuminate/cache": "~5.0" }, "require-dev": { "phpunit/phpunit": "~4.1", diff --git a/composer.lock b/composer.lock index 61bc98a1..6ecabf24 100644 --- a/composer.lock +++ b/composer.lock @@ -1,23 +1,24 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "14a0fb4c39a9b27bee1fe50e36b55c40", + "hash": "4dd26f51fcabd23f92a161ae646d57eb", + "content-hash": "47db535c397a67d4992d70960fdaf60d", "packages": [ { "name": "danielstjules/stringy", - "version": "1.8.1", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/danielstjules/Stringy.git", - "reference": "6a7b0391b2baf0bfdca3ec0c8d33ff379c2835ad" + "reference": "efb10020f6f0274bd3c43a1549f37535e0a9d1cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/danielstjules/Stringy/zipball/6a7b0391b2baf0bfdca3ec0c8d33ff379c2835ad", - "reference": "6a7b0391b2baf0bfdca3ec0c8d33ff379c2835ad", + "url": "https://api.github.com/repos/danielstjules/Stringy/zipball/efb10020f6f0274bd3c43a1549f37535e0a9d1cc", + "reference": "efb10020f6f0274bd3c43a1549f37535e0a9d1cc", "shasum": "" }, "require": { @@ -60,20 +61,20 @@ "utility", "utils" ], - "time": "2015-01-08 15:21:43" + "time": "2015-09-03 06:50:48" }, { "name": "doctrine/inflector", - "version": "v1.0.1", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "0bcb2e79d8571787f18b7eb036ed3d004908e604" + "reference": "90b2128806bfde671b6952ab8bea493942c1fdae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/0bcb2e79d8571787f18b7eb036ed3d004908e604", - "reference": "0bcb2e79d8571787f18b7eb036ed3d004908e604", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/90b2128806bfde671b6952ab8bea493942c1fdae", + "reference": "90b2128806bfde671b6952ab8bea493942c1fdae", "shasum": "" }, "require": { @@ -85,7 +86,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { @@ -127,36 +128,88 @@ "singularize", "string" ], - "time": "2014-12-20 21:24:13" + "time": "2015-11-06 14:35:42" + }, + { + "name": "illuminate/cache", + "version": "5.2.x-dev", + "source": { + "type": "git", + "url": "https://github.com/illuminate/cache.git", + "reference": "63f0ab3c403efc4420e3b1dd5ccb5a12e9b46179" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/cache/zipball/63f0ab3c403efc4420e3b1dd5ccb5a12e9b46179", + "reference": "63f0ab3c403efc4420e3b1dd5ccb5a12e9b46179", + "shasum": "" + }, + "require": { + "illuminate/contracts": "5.2.*", + "illuminate/support": "5.2.*", + "nesbot/carbon": "~1.20", + "php": ">=5.5.9" + }, + "suggest": { + "illuminate/database": "Required to use the database cache driver (5.2.*).", + "illuminate/filesystem": "Required to use the file cache driver (5.2.*).", + "illuminate/redis": "Required to use the redis cache driver (5.2.*)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.2-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Cache\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylorotwell@gmail.com" + } + ], + "description": "The Illuminate Cache package.", + "homepage": "http://laravel.com", + "time": "2015-11-14 18:20:24" }, { "name": "illuminate/console", - "version": "v5.0.0", + "version": "5.2.x-dev", "source": { "type": "git", "url": "https://github.com/illuminate/console.git", - "reference": "74454f88dfa949f5a34dac80b2d82f902af68401" + "reference": "9448ee8f9ee1f70c50175f1b64423fcc7c57e5f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/console/zipball/74454f88dfa949f5a34dac80b2d82f902af68401", - "reference": "74454f88dfa949f5a34dac80b2d82f902af68401", + "url": "https://api.github.com/repos/illuminate/console/zipball/9448ee8f9ee1f70c50175f1b64423fcc7c57e5f1", + "reference": "9448ee8f9ee1f70c50175f1b64423fcc7c57e5f1", "shasum": "" }, "require": { - "illuminate/contracts": "5.0.*", - "php": ">=5.4.0", - "symfony/console": "2.6.*" + "illuminate/contracts": "5.2.*", + "illuminate/support": "5.2.*", + "nesbot/carbon": "~1.20", + "php": ">=5.5.9", + "symfony/console": "2.8.*|3.0.*" }, "suggest": { + "guzzlehttp/guzzle": "Required to use the thenPing method on schedules (~6.0).", "mtdowling/cron-expression": "Required to use scheduling component (~1.0).", - "nesbot/carbon": "Required to use scheduling component (~1.0).", - "symfony/process": "Required to use scheduling component (2.6.*)." + "symfony/process": "Required to use scheduling component (2.8.*|3.0.*)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.2-dev" } }, "autoload": { @@ -175,29 +228,30 @@ } ], "description": "The Illuminate Console package.", - "time": "2015-02-04 05:06:03" + "homepage": "http://laravel.com", + "time": "2015-11-11 22:45:19" }, { "name": "illuminate/contracts", - "version": "v5.0.0", + "version": "5.2.x-dev", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", - "reference": "78f1dba092d5fcb6d3a19537662abe31c4d128fd" + "reference": "3fa96ab963cbe769fe5214318ea1fee83b0237a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/contracts/zipball/78f1dba092d5fcb6d3a19537662abe31c4d128fd", - "reference": "78f1dba092d5fcb6d3a19537662abe31c4d128fd", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/3fa96ab963cbe769fe5214318ea1fee83b0237a6", + "reference": "3fa96ab963cbe769fe5214318ea1fee83b0237a6", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": ">=5.5.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.2-dev" } }, "autoload": { @@ -216,36 +270,41 @@ } ], "description": "The Illuminate Contracts package.", - "time": "2015-01-30 16:27:08" + "homepage": "http://laravel.com", + "time": "2015-11-18 08:43:01" }, { "name": "illuminate/support", - "version": "v5.0.0", + "version": "5.2.x-dev", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", - "reference": "306ceb305f5b480608d94355ac3a0a730b21a905" + "reference": "9aaff5435a6ca87a16e67d0d41ba0941088c4035" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/306ceb305f5b480608d94355ac3a0a730b21a905", - "reference": "306ceb305f5b480608d94355ac3a0a730b21a905", + "url": "https://api.github.com/repos/illuminate/support/zipball/9aaff5435a6ca87a16e67d0d41ba0941088c4035", + "reference": "9aaff5435a6ca87a16e67d0d41ba0941088c4035", "shasum": "" }, "require": { - "danielstjules/stringy": "~1.8", + "danielstjules/stringy": "~2.1", "doctrine/inflector": "~1.0", "ext-mbstring": "*", - "illuminate/contracts": "5.0.*", - "php": ">=5.4.0" + "illuminate/contracts": "5.2.*", + "php": ">=5.5.9" }, "suggest": { - "jeremeamia/superclosure": "Required to be able to serialize closures (~2.0)." + "illuminate/filesystem": "Required to use the composer class (5.2.*).", + "jeremeamia/superclosure": "Required to be able to serialize closures (~2.0).", + "paragonie/random_compat": "Provides a compatible interface like PHP7's random_bytes() in PHP 5 projects (~1.1).", + "symfony/process": "Required to use the composer class (2.8.*|3.0.*).", + "symfony/var-dumper": "Required to use the dd function (2.8.*|3.0.*)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.2-dev" } }, "autoload": { @@ -267,30 +326,78 @@ } ], "description": "The Illuminate Support package.", - "time": "2015-02-03 22:40:35" + "homepage": "http://laravel.com", + "time": "2015-11-18 19:16:09" + }, + { + "name": "nesbot/carbon", + "version": "1.21.0", + "source": { + "type": "git", + "url": "https://github.com/briannesbitt/Carbon.git", + "reference": "7b08ec6f75791e130012f206e3f7b0e76e18e3d7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/7b08ec6f75791e130012f206e3f7b0e76e18e3d7", + "reference": "7b08ec6f75791e130012f206e3f7b0e76e18e3d7", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "symfony/translation": "~2.6|~3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0|~5.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Carbon\\": "src/Carbon/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brian Nesbitt", + "email": "brian@nesbot.com", + "homepage": "http://nesbot.com" + } + ], + "description": "A simple API extension for DateTime.", + "homepage": "http://carbon.nesbot.com", + "keywords": [ + "date", + "datetime", + "time" + ], + "time": "2015-11-04 20:07:17" }, { "name": "symfony/console", - "version": "v2.6.4", - "target-dir": "Symfony/Component/Console", + "version": "2.8.x-dev", "source": { "type": "git", - "url": "https://github.com/symfony/Console.git", - "reference": "e44154bfe3e41e8267d7a3794cd9da9a51cfac34" + "url": "https://github.com/symfony/console.git", + "reference": "ee86b4579c9e8ad3859cd33f3ef1572f85eda537" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/e44154bfe3e41e8267d7a3794cd9da9a51cfac34", - "reference": "e44154bfe3e41e8267d7a3794cd9da9a51cfac34", + "url": "https://api.github.com/repos/symfony/console/zipball/ee86b4579c9e8ad3859cd33f3ef1572f85eda537", + "reference": "ee86b4579c9e8ad3859cd33f3ef1572f85eda537", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9", + "symfony/polyfill-mbstring": "~1.0" }, "require-dev": { "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1", - "symfony/process": "~2.1" + "symfony/event-dispatcher": "~2.1|~3.0.0", + "symfony/process": "~2.1|~3.0.0" }, "suggest": { "psr/log": "For using the console logger", @@ -300,46 +407,169 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.8-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2015-11-18 13:45:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "0b6a8940385311a24e060ec1fe35680e17c74497" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0b6a8940385311a24e060ec1fe35680e17c74497", + "reference": "0b6a8940385311a24e060ec1fe35680e17c74497", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" } }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, { "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2015-11-04 20:28:58" + }, + { + "name": "symfony/translation", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation.git", + "reference": "7f14717150a7445f8475864d1235875dd04061fb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation/zipball/7f14717150a7445f8475864d1235875dd04061fb", + "reference": "7f14717150a7445f8475864d1235875dd04061fb", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/config": "<2.8" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0", + "symfony/intl": "~2.8|~3.0", + "symfony/yaml": "~2.8|~3.0" + }, + "suggest": { + "psr/log": "To use logging capability in translator", + "symfony/config": "", + "symfony/yaml": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Translation\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Console Component", - "homepage": "http://symfony.com", - "time": "2015-01-25 04:39:26" + "description": "Symfony Translation Component", + "homepage": "https://symfony.com", + "time": "2015-11-18 13:48:51" } ], "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.0.4", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119" + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f976e5de371104877ebc89bd8fecb0019ed9c119", - "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", "shasum": "" }, "require": { @@ -350,7 +580,7 @@ "ext-pdo": "*", "ext-phar": "*", "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "2.0.*@ALPHA" + "squizlabs/php_codesniffer": "~2.0" }, "type": "library", "extra": { @@ -359,8 +589,8 @@ } }, "autoload": { - "psr-0": { - "Doctrine\\Instantiator\\": "src" + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" } }, "notification-url": "https://packagist.org/downloads/", @@ -380,30 +610,75 @@ "constructor", "instantiate" ], - "time": "2014-10-13 12:58:55" + "time": "2015-06-14 21:17:01" + }, + { + "name": "hamcrest/hamcrest-php", + "version": "v1.2.2", + "source": { + "type": "git", + "url": "https://github.com/hamcrest/hamcrest-php.git", + "reference": "b37020aa976fa52d3de9aa904aa2522dc518f79c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/b37020aa976fa52d3de9aa904aa2522dc518f79c", + "reference": "b37020aa976fa52d3de9aa904aa2522dc518f79c", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "replace": { + "cordoval/hamcrest-php": "*", + "davedevelopment/hamcrest-php": "*", + "kodova/hamcrest-php": "*" + }, + "require-dev": { + "phpunit/php-file-iterator": "1.3.3", + "satooshi/php-coveralls": "dev-master" + }, + "type": "library", + "autoload": { + "classmap": [ + "hamcrest" + ], + "files": [ + "hamcrest/Hamcrest.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD" + ], + "description": "This is the PHP port of Hamcrest Matchers", + "keywords": [ + "test" + ], + "time": "2015-05-11 14:41:42" }, { "name": "illuminate/container", - "version": "v5.0.0", + "version": "5.2.x-dev", "source": { "type": "git", "url": "https://github.com/illuminate/container.git", - "reference": "22fae557d2a631585536654fadb069f34c315040" + "reference": "d9a87f5861b140a6b98f73e64253da2ab2e2f36e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/container/zipball/22fae557d2a631585536654fadb069f34c315040", - "reference": "22fae557d2a631585536654fadb069f34c315040", + "url": "https://api.github.com/repos/illuminate/container/zipball/d9a87f5861b140a6b98f73e64253da2ab2e2f36e", + "reference": "d9a87f5861b140a6b98f73e64253da2ab2e2f36e", "shasum": "" }, "require": { - "illuminate/contracts": "5.0.*", - "php": ">=5.4.0" + "illuminate/contracts": "5.2.*", + "php": ">=5.5.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.2-dev" } }, "autoload": { @@ -422,38 +697,42 @@ } ], "description": "The Illuminate Container package.", - "time": "2015-01-07 02:06:23" + "homepage": "http://laravel.com", + "time": "2015-10-20 21:17:55" }, { "name": "illuminate/database", - "version": "v5.0.0", + "version": "5.2.x-dev", "source": { "type": "git", "url": "https://github.com/illuminate/database.git", - "reference": "c571ace791a601bf1bb3f9cf125eb86df00bf3ae" + "reference": "5a59fe01e91846378730b2bf8c9a76ead80b3c02" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/database/zipball/c571ace791a601bf1bb3f9cf125eb86df00bf3ae", - "reference": "c571ace791a601bf1bb3f9cf125eb86df00bf3ae", + "url": "https://api.github.com/repos/illuminate/database/zipball/5a59fe01e91846378730b2bf8c9a76ead80b3c02", + "reference": "5a59fe01e91846378730b2bf8c9a76ead80b3c02", "shasum": "" }, "require": { - "illuminate/container": "5.0.*", - "illuminate/contracts": "5.0.*", - "illuminate/support": "5.0.*", - "nesbot/carbon": "~1.0", - "php": ">=5.4.0" + "illuminate/container": "5.2.*", + "illuminate/contracts": "5.2.*", + "illuminate/support": "5.2.*", + "nesbot/carbon": "~1.20", + "php": ">=5.5.9" }, "suggest": { "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.4).", - "illuminate/console": "Required to use the database commands (5.0.*).", - "illuminate/filesystem": "Required to use the migrations (5.0.*)." + "fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).", + "illuminate/console": "Required to use the database commands (5.2.*).", + "illuminate/events": "Required to use the observers with Eloquent (5.2.*).", + "illuminate/filesystem": "Required to use the migrations (5.2.*).", + "illuminate/pagination": "Required to paginate the result set (5.2.*)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.2-dev" } }, "autoload": { @@ -472,26 +751,27 @@ } ], "description": "The Illuminate Database package.", + "homepage": "http://laravel.com", "keywords": [ "database", "laravel", "orm", "sql" ], - "time": "2015-02-02 19:27:30" + "time": "2015-11-18 19:10:29" }, { "name": "michelf/php-markdown", - "version": "1.4.1", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/michelf/php-markdown.git", - "reference": "de9a19c7bf352d41cc99ed86c3c0ef17e87394b6" + "reference": "e1aabe18173231ebcefc90e615565742fc1c7fd9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/michelf/php-markdown/zipball/de9a19c7bf352d41cc99ed86c3c0ef17e87394b6", - "reference": "de9a19c7bf352d41cc99ed86c3c0ef17e87394b6", + "url": "https://api.github.com/repos/michelf/php-markdown/zipball/e1aabe18173231ebcefc90e615565742fc1c7fd9", + "reference": "e1aabe18173231ebcefc90e615565742fc1c7fd9", "shasum": "" }, "require": { @@ -513,23 +793,23 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "John Gruber", + "homepage": "http://daringfireball.net/" + }, { "name": "Michel Fortin", "email": "michel.fortin@michelf.ca", - "homepage": "http://michelf.ca/", + "homepage": "https://michelf.ca/", "role": "Developer" - }, - { - "name": "John Gruber", - "homepage": "http://daringfireball.net/" } ], "description": "PHP Markdown", - "homepage": "http://michelf.ca/projects/php-markdown/", + "homepage": "https://michelf.ca/projects/php-markdown/", "keywords": [ "markdown" ], - "time": "2014-05-05 02:43:50" + "time": "2015-03-01 12:03:08" }, { "name": "mockery/mockery", @@ -537,27 +817,26 @@ "source": { "type": "git", "url": "https://github.com/padraic/mockery.git", - "reference": "0bf3f7346cb49a24587a1a6292e7f20fcd80af0a" + "reference": "15f6bb72f66df6857b957bedd09dc4fd0ace3b03" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/padraic/mockery/zipball/0bf3f7346cb49a24587a1a6292e7f20fcd80af0a", - "reference": "0bf3f7346cb49a24587a1a6292e7f20fcd80af0a", + "url": "https://api.github.com/repos/padraic/mockery/zipball/15f6bb72f66df6857b957bedd09dc4fd0ace3b03", + "reference": "15f6bb72f66df6857b957bedd09dc4fd0ace3b03", "shasum": "" }, "require": { + "hamcrest/hamcrest-php": "~1.1", "lib-pcre": ">=7.0", - "php": ">=5.3.2" + "php": ">=5.4.0" }, "require-dev": { - "hamcrest/hamcrest-php": "~1.1", - "phpunit/phpunit": "~4.0", - "satooshi/php-coveralls": "~0.7@dev" + "phpunit/phpunit": "~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "0.9.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { @@ -595,66 +874,20 @@ "test double", "testing" ], - "time": "2015-02-05 10:30:00" - }, - { - "name": "nesbot/carbon", - "version": "1.14.0", - "source": { - "type": "git", - "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "bb87460c995d97fe55b39e65f6ffb7f64b0a941e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/bb87460c995d97fe55b39e65f6ffb7f64b0a941e", - "reference": "bb87460c995d97fe55b39e65f6ffb7f64b0a941e", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "autoload": { - "psr-0": { - "Carbon": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Brian Nesbitt", - "email": "brian@nesbot.com", - "homepage": "http://nesbot.com" - } - ], - "description": "A simple API extension for DateTime.", - "homepage": "https://github.com/briannesbitt/Carbon", - "keywords": [ - "date", - "datetime", - "time" - ], - "time": "2015-02-06 05:07:29" + "time": "2015-11-17 13:12:31" }, { "name": "nikic/php-parser", - "version": "v1.1.0", + "version": "1.x-dev", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "ac05ef6f95bf8361549604b6031c115f92f39528" + "reference": "f78af2c9c86107aa1a34cd1dbb5bbe9eeb0d9f51" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/ac05ef6f95bf8361549604b6031c115f92f39528", - "reference": "ac05ef6f95bf8361549604b6031c115f92f39528", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f78af2c9c86107aa1a34cd1dbb5bbe9eeb0d9f51", + "reference": "f78af2c9c86107aa1a34cd1dbb5bbe9eeb0d9f51", "shasum": "" }, "require": { @@ -664,7 +897,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -686,7 +919,7 @@ "parser", "php" ], - "time": "2015-01-18 11:29:59" + "time": "2015-09-19 14:15:08" }, { "name": "phpdocumentor/reflection-docblock", @@ -739,21 +972,22 @@ }, { "name": "phpspec/prophecy", - "version": "v1.3.1", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "9ca52329bcdd1500de24427542577ebf3fc2f1c9" + "reference": "4f9b1eaf0a7da77c362f8d91cbc68ab1f4718d62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/9ca52329bcdd1500de24427542577ebf3fc2f1c9", - "reference": "9ca52329bcdd1500de24427542577ebf3fc2f1c9", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4f9b1eaf0a7da77c362f8d91cbc68ab1f4718d62", + "reference": "4f9b1eaf0a7da77c362f8d91cbc68ab1f4718d62", "shasum": "" }, "require": { - "doctrine/instantiator": "~1.0,>=1.0.2", - "phpdocumentor/reflection-docblock": "~2.0" + "doctrine/instantiator": "^1.0.2", + "phpdocumentor/reflection-docblock": "~2.0", + "sebastian/comparator": "~1.1" }, "require-dev": { "phpspec/phpspec": "~2.0" @@ -761,7 +995,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.5.x-dev" } }, "autoload": { @@ -785,7 +1019,7 @@ } ], "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "http://phpspec.org", + "homepage": "https://github.com/phpspec/prophecy", "keywords": [ "Double", "Dummy", @@ -794,20 +1028,20 @@ "spy", "stub" ], - "time": "2014-11-17 16:23:49" + "time": "2015-09-22 14:49:23" }, { "name": "phpunit/php-code-coverage", - "version": "2.0.15", + "version": "2.2.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "34cc484af1ca149188d0d9e91412191e398e0b67" + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/34cc484af1ca149188d0d9e91412191e398e0b67", - "reference": "34cc484af1ca149188d0d9e91412191e398e0b67", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", "shasum": "" }, "require": { @@ -815,7 +1049,7 @@ "phpunit/php-file-iterator": "~1.3", "phpunit/php-text-template": "~1.2", "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "~1.0", + "sebastian/environment": "^1.3.2", "sebastian/version": "~1.0" }, "require-dev": { @@ -830,7 +1064,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "2.2.x-dev" } }, "autoload": { @@ -856,35 +1090,37 @@ "testing", "xunit" ], - "time": "2015-01-24 10:06:35" + "time": "2015-10-06 15:47:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.3.4", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", "shasum": "" }, "require": { "php": ">=5.3.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, "autoload": { "classmap": [ - "File/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], @@ -901,20 +1137,20 @@ "filesystem", "iterator" ], - "time": "2013-10-10 15:34:57" + "time": "2015-06-21 13:08:43" }, { "name": "phpunit/php-text-template", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a" + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", - "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", "shasum": "" }, "require": { @@ -923,20 +1159,17 @@ "type": "library", "autoload": { "classmap": [ - "Text/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -945,20 +1178,20 @@ "keywords": [ "template" ], - "time": "2014-01-30 17:20:04" + "time": "2015-06-21 13:50:34" }, { "name": "phpunit/php-timer", - "version": "1.0.5", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c" + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", "shasum": "" }, "require": { @@ -967,13 +1200,10 @@ "type": "library", "autoload": { "classmap": [ - "PHP/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], @@ -989,20 +1219,20 @@ "keywords": [ "timer" ], - "time": "2013-08-02 07:42:54" + "time": "2015-06-21 08:01:12" }, { "name": "phpunit/php-token-stream", - "version": "1.4.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "db32c18eba00b121c145575fcbcd4d4d24e6db74" + "reference": "cab6c6fefee93d7b7c3a01292a0fe0884ea66644" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/db32c18eba00b121c145575fcbcd4d4d24e6db74", - "reference": "db32c18eba00b121c145575fcbcd4d4d24e6db74", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/cab6c6fefee93d7b7c3a01292a0fe0884ea66644", + "reference": "cab6c6fefee93d7b7c3a01292a0fe0884ea66644", "shasum": "" }, "require": { @@ -1038,20 +1268,20 @@ "keywords": [ "tokenizer" ], - "time": "2015-01-17 09:51:32" + "time": "2015-09-23 14:46:55" }, { "name": "phpunit/phpunit", - "version": "4.5.0", + "version": "4.8.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "5b578d3865a9128b9c209b011fda6539ec06e7a5" + "reference": "d82e69c1b34337eae1628c5e2e3b01d2082c4aa9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5b578d3865a9128b9c209b011fda6539ec06e7a5", - "reference": "5b578d3865a9128b9c209b011fda6539ec06e7a5", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d82e69c1b34337eae1628c5e2e3b01d2082c4aa9", + "reference": "d82e69c1b34337eae1628c5e2e3b01d2082c4aa9", "shasum": "" }, "require": { @@ -1061,19 +1291,19 @@ "ext-reflection": "*", "ext-spl": "*", "php": ">=5.3.3", - "phpspec/prophecy": "~1.3.1", - "phpunit/php-code-coverage": "~2.0", - "phpunit/php-file-iterator": "~1.3.2", + "phpspec/prophecy": "^1.3.1", + "phpunit/php-code-coverage": "~2.1", + "phpunit/php-file-iterator": "~1.4", "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "~1.0.2", + "phpunit/php-timer": ">=1.0.6", "phpunit/phpunit-mock-objects": "~2.3", "sebastian/comparator": "~1.1", - "sebastian/diff": "~1.1", - "sebastian/environment": "~1.2", + "sebastian/diff": "~1.2", + "sebastian/environment": "~1.3", "sebastian/exporter": "~1.2", "sebastian/global-state": "~1.0", "sebastian/version": "~1.0", - "symfony/yaml": "~2.0" + "symfony/yaml": "~2.1|~3.0" }, "suggest": { "phpunit/php-invoker": "~1.1" @@ -1084,7 +1314,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.5.x-dev" + "dev-master": "4.8.x-dev" } }, "autoload": { @@ -1110,29 +1340,30 @@ "testing", "xunit" ], - "time": "2015-02-05 15:51:19" + "time": "2015-11-17 20:03:40" }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.3.0", + "version": "2.3.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "c63d2367247365f688544f0d500af90a11a44c65" + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/c63d2367247365f688544f0d500af90a11a44c65", - "reference": "c63d2367247365f688544f0d500af90a11a44c65", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", "shasum": "" }, "require": { - "doctrine/instantiator": "~1.0,>=1.0.1", + "doctrine/instantiator": "^1.0.2", "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2" + "phpunit/php-text-template": "~1.2", + "sebastian/exporter": "~1.2" }, "require-dev": { - "phpunit/phpunit": "~4.3" + "phpunit/phpunit": "~4.4" }, "suggest": { "ext-soap": "*" @@ -1165,20 +1396,20 @@ "mock", "xunit" ], - "time": "2014-10-03 05:12:11" + "time": "2015-10-02 06:51:40" }, { "name": "pimple/pimple", - "version": "v3.0.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/silexphp/Pimple.git", - "reference": "876bf0899d01feacd2a2e83f04641e51350099ef" + "reference": "64e0f8320639b434baa073a40dd1e037e3286555" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/silexphp/Pimple/zipball/876bf0899d01feacd2a2e83f04641e51350099ef", - "reference": "876bf0899d01feacd2a2e83f04641e51350099ef", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/64e0f8320639b434baa073a40dd1e037e3286555", + "reference": "64e0f8320639b434baa073a40dd1e037e3286555", "shasum": "" }, "require": { @@ -1205,13 +1436,13 @@ "email": "fabien@symfony.com" } ], - "description": "Pimple is a simple Dependency Injection Container for PHP 5.3", + "description": "Pimple, a simple Dependency Injection Container", "homepage": "http://pimple.sensiolabs.org", "keywords": [ "container", "dependency injection" ], - "time": "2014-07-24 09:48:15" + "time": "2015-09-11 15:11:22" }, { "name": "sami/sami", @@ -1219,18 +1450,18 @@ "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/Sami.git", - "reference": "0e70f3316920df58d903de0bf2222e49784c8317" + "reference": "0a526ff0d6e098f6dd07d2e131cb1487cbace112" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/Sami/zipball/0e70f3316920df58d903de0bf2222e49784c8317", - "reference": "0e70f3316920df58d903de0bf2222e49784c8317", + "url": "https://api.github.com/repos/FriendsOfPHP/Sami/zipball/0a526ff0d6e098f6dd07d2e131cb1487cbace112", + "reference": "0a526ff0d6e098f6dd07d2e131cb1487cbace112", "shasum": "" }, "require": { "michelf/php-markdown": "~1.3", "nikic/php-parser": "~1.0", - "php": ">=5.3.3", + "php": ">=5.3.9", "phpdocumentor/reflection-docblock": "~2.0", "pimple/pimple": "~3.0", "symfony/console": "~2.1", @@ -1238,7 +1469,7 @@ "symfony/finder": "~2.1", "symfony/process": "~2.1", "symfony/yaml": "~2.1", - "twig/twig": "~1.13" + "twig/twig": "~1.20|~2.0" }, "bin": [ "sami.php" @@ -1269,20 +1500,20 @@ "keywords": [ "phpdoc" ], - "time": "2014-12-12 14:58:50" + "time": "2015-10-07 15:32:20" }, { "name": "sebastian/comparator", - "version": "1.1.1", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1dd8869519a225f7f2b9eb663e225298fade819e" + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dd8869519a225f7f2b9eb663e225298fade819e", - "reference": "1dd8869519a225f7f2b9eb663e225298fade819e", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", "shasum": "" }, "require": { @@ -1296,7 +1527,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -1333,20 +1564,20 @@ "compare", "equality" ], - "time": "2015-01-29 16:28:08" + "time": "2015-07-26 15:48:44" }, { "name": "sebastian/diff", - "version": "1.2.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "5843509fed39dee4b356a306401e9dd1a931fec7" + "reference": "6899b3e33bfbd386d88b5eea5f65f563e8793051" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/5843509fed39dee4b356a306401e9dd1a931fec7", - "reference": "5843509fed39dee4b356a306401e9dd1a931fec7", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/6899b3e33bfbd386d88b5eea5f65f563e8793051", + "reference": "6899b3e33bfbd386d88b5eea5f65f563e8793051", "shasum": "" }, "require": { @@ -1358,7 +1589,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.3-dev" } }, "autoload": { @@ -1385,32 +1616,32 @@ "keywords": [ "diff" ], - "time": "2014-08-15 10:29:00" + "time": "2015-06-22 14:15:55" }, { "name": "sebastian/environment", - "version": "1.2.1", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "6e6c71d918088c251b181ba8b3088af4ac336dd7" + "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6e6c71d918088c251b181ba8b3088af4ac336dd7", - "reference": "6e6c71d918088c251b181ba8b3088af4ac336dd7", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44", + "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "~4.3" + "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -1435,20 +1666,20 @@ "environment", "hhvm" ], - "time": "2014-10-25 08:00:45" + "time": "2015-08-03 06:14:51" }, { "name": "sebastian/exporter", - "version": "1.2.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "84839970d05254c73cde183a721c7af13aede943" + "reference": "f88f8936517d54ae6d589166810877fb2015d0a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/84839970d05254c73cde183a721c7af13aede943", - "reference": "84839970d05254c73cde183a721c7af13aede943", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/f88f8936517d54ae6d589166810877fb2015d0a2", + "reference": "f88f8936517d54ae6d589166810877fb2015d0a2", "shasum": "" }, "require": { @@ -1456,12 +1687,13 @@ "sebastian/recursion-context": "~1.0" }, "require-dev": { + "ext-mbstring": "*", "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -1501,20 +1733,20 @@ "export", "exporter" ], - "time": "2015-01-27 07:23:06" + "time": "2015-08-09 04:23:41" }, { "name": "sebastian/global-state", - "version": "1.0.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01" + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01", - "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", "shasum": "" }, "require": { @@ -1552,20 +1784,20 @@ "keywords": [ "global state" ], - "time": "2014-10-06 09:23:50" + "time": "2015-10-12 03:26:01" }, { "name": "sebastian/recursion-context", - "version": "1.0.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "3989662bbb30a29d20d9faa04a846af79b276252" + "reference": "994d4a811bafe801fb06dccbee797863ba2792ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/3989662bbb30a29d20d9faa04a846af79b276252", - "reference": "3989662bbb30a29d20d9faa04a846af79b276252", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba", + "reference": "994d4a811bafe801fb06dccbee797863ba2792ba", "shasum": "" }, "require": { @@ -1605,20 +1837,20 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-01-24 09:48:32" + "time": "2015-06-21 08:04:50" }, { "name": "sebastian/version", - "version": "1.0.4", + "version": "1.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "a77d9123f8e809db3fbdea15038c27a95da4058b" + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/a77d9123f8e809db3fbdea15038c27a95da4058b", - "reference": "a77d9123f8e809db3fbdea15038c27a95da4058b", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", "shasum": "" }, "type": "library", @@ -1640,217 +1872,230 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2014-12-15 14:25:24" + "time": "2015-06-21 13:59:46" }, { "name": "symfony/filesystem", - "version": "v2.6.4", - "target-dir": "Symfony/Component/Filesystem", + "version": "2.8.x-dev", "source": { "type": "git", - "url": "https://github.com/symfony/Filesystem.git", - "reference": "a1f566d1f92e142fa1593f4555d6d89e3044a9b7" + "url": "https://github.com/symfony/filesystem.git", + "reference": "8caf603ed1551f4408195557af56c1a68aec36b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/a1f566d1f92e142fa1593f4555d6d89e3044a9b7", - "reference": "a1f566d1f92e142fa1593f4555d6d89e3044a9b7", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/8caf603ed1551f4408195557af56c1a68aec36b3", + "reference": "8caf603ed1551f4408195557af56c1a68aec36b3", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.8-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Filesystem\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Filesystem Component", - "homepage": "http://symfony.com", - "time": "2015-01-03 21:13:09" + "homepage": "https://symfony.com", + "time": "2015-11-18 13:45:00" }, { "name": "symfony/finder", - "version": "v2.6.4", - "target-dir": "Symfony/Component/Finder", + "version": "2.8.x-dev", "source": { "type": "git", - "url": "https://github.com/symfony/Finder.git", - "reference": "16513333bca64186c01609961a2bb1b95b5e1355" + "url": "https://github.com/symfony/finder.git", + "reference": "ead9b07af4ba77b6507bee697396a5c79e633f08" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Finder/zipball/16513333bca64186c01609961a2bb1b95b5e1355", - "reference": "16513333bca64186c01609961a2bb1b95b5e1355", + "url": "https://api.github.com/repos/symfony/finder/zipball/ead9b07af4ba77b6507bee697396a5c79e633f08", + "reference": "ead9b07af4ba77b6507bee697396a5c79e633f08", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.8-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Finder\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Finder Component", - "homepage": "http://symfony.com", - "time": "2015-01-03 08:01:59" + "homepage": "https://symfony.com", + "time": "2015-10-30 20:15:42" }, { "name": "symfony/process", - "version": "v2.6.4", - "target-dir": "Symfony/Component/Process", + "version": "2.8.x-dev", "source": { "type": "git", - "url": "https://github.com/symfony/Process.git", - "reference": "ecfc23e89d9967999fa5f60a1e9af7384396e9ae" + "url": "https://github.com/symfony/process.git", + "reference": "cabf2f9dbaba77ef2725dbd6ec45ba5ed69e18f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Process/zipball/ecfc23e89d9967999fa5f60a1e9af7384396e9ae", - "reference": "ecfc23e89d9967999fa5f60a1e9af7384396e9ae", + "url": "https://api.github.com/repos/symfony/process/zipball/cabf2f9dbaba77ef2725dbd6ec45ba5ed69e18f9", + "reference": "cabf2f9dbaba77ef2725dbd6ec45ba5ed69e18f9", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.8-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Process\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Process Component", - "homepage": "http://symfony.com", - "time": "2015-01-25 04:39:26" + "homepage": "https://symfony.com", + "time": "2015-11-18 16:56:24" }, { "name": "symfony/yaml", - "version": "v2.6.4", - "target-dir": "Symfony/Component/Yaml", + "version": "2.8.x-dev", "source": { "type": "git", - "url": "https://github.com/symfony/Yaml.git", - "reference": "60ed7751671113cf1ee7d7778e691642c2e9acd8" + "url": "https://github.com/symfony/yaml.git", + "reference": "f65177d7093bc29aefebfbdbe496b9e3a6292653" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/60ed7751671113cf1ee7d7778e691642c2e9acd8", - "reference": "60ed7751671113cf1ee7d7778e691642c2e9acd8", + "url": "https://api.github.com/repos/symfony/yaml/zipball/f65177d7093bc29aefebfbdbe496b9e3a6292653", + "reference": "f65177d7093bc29aefebfbdbe496b9e3a6292653", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.8-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Yaml\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Yaml Component", - "homepage": "http://symfony.com", - "time": "2015-01-25 04:39:26" + "homepage": "https://symfony.com", + "time": "2015-11-18 13:45:00" }, { "name": "twig/twig", - "version": "v1.18.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "4cf7464348e7f9893a93f7096a90b73722be99cf" + "reference": "5cdca6bc1f1510c365c169dda68c5e1ebbad1d93" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/4cf7464348e7f9893a93f7096a90b73722be99cf", - "reference": "4cf7464348e7f9893a93f7096a90b73722be99cf", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/5cdca6bc1f1510c365c169dda68c5e1ebbad1d93", + "reference": "5cdca6bc1f1510c365c169dda68c5e1ebbad1d93", "shasum": "" }, "require": { - "php": ">=5.2.4" + "php": ">=5.5", + "symfony/polyfill-mbstring": "~1.0" + }, + "require-dev": { + "symfony/debug": "~2.7", + "symfony/phpunit-bridge": "~2.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.18-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1885,11 +2130,11 @@ "keywords": [ "templating" ], - "time": "2015-01-25 17:32:08" + "time": "2015-10-29 23:23:02" } ], "aliases": [], - "minimum-stability": "stable", + "minimum-stability": "dev", "stability-flags": { "mockery/mockery": 20, "sami/sami": 20 diff --git a/src/Entrust/Traits/EntrustRoleTrait.php b/src/Entrust/Traits/EntrustRoleTrait.php index 34c8678d..8b47cc0a 100644 --- a/src/Entrust/Traits/EntrustRoleTrait.php +++ b/src/Entrust/Traits/EntrustRoleTrait.php @@ -8,8 +8,8 @@ * @package Zizaco\Entrust */ -use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Config; +use Illuminate\Support\Facades\Cache; trait EntrustRoleTrait { diff --git a/tests/EntrustUserTest.php b/tests/EntrustUserTest.php index 979ba67e..41c5ad8a 100644 --- a/tests/EntrustUserTest.php +++ b/tests/EntrustUserTest.php @@ -3,6 +3,8 @@ use Zizaco\Entrust\Contracts\EntrustUserInterface; use Zizaco\Entrust\Traits\EntrustUserTrait; use Illuminate\Support\Facades\Config; +//use Illuminate\Support\Facades\Facade; +use Illuminate\Support\Facades\Cache; use Mockery as m; class EntrustUserTest extends PHPUnit_Framework_TestCase @@ -10,6 +12,8 @@ class EntrustUserTest extends PHPUnit_Framework_TestCase public function tearDown() { m::close(); + //Facade::setFacadeApplication(null); + //Facade::clearResolvedInstances(); } public function testRoles() @@ -66,6 +70,12 @@ public function testHasRole() $user = new HasRoleUser(); $user->roles = [$roleA, $roleB]; + + + //Cache::setFacadeApplication(['cache' => m::mock('Illuminate\Support\Facades\Cache')]); + $app = m::mock('app')->shouldReceive('instance')->getMock(); + Cache::setFacadeApplication($app); + Cache::shouldReceive('tags->remember')->times(7)->andReturn($user->roles); /* |------------------------------------------------------------ @@ -181,6 +191,8 @@ public function testAbilityShouldReturnBoolean() $user = m::mock('HasRoleUser')->makePartial(); $user->roles = [$roleA, $roleB]; + $user->id = 4; + $user->primaryKey = 'id'; /* |------------------------------------------------------------ @@ -295,6 +307,9 @@ public function testAbilityShouldReturnArray() $user = m::mock('HasRoleUser')->makePartial(); $user->roles = [$roleA, $roleB]; + $user->id = 4; + $user->primaryKey = 'id'; + /* |------------------------------------------------------------ @@ -448,6 +463,8 @@ public function testAbilityShouldReturnBoth() $user = m::mock('HasRoleUser')->makePartial(); $user->roles = [$roleA, $roleB]; + $user->id = 4; + $user->primaryKey = 'id'; /* |------------------------------------------------------------ @@ -615,6 +632,8 @@ public function testAbilityShouldAcceptStrings() $user = m::mock('HasRoleUser')->makePartial(); $user->roles = [$roleA, $roleB]; + $user->id = 4; + $user->primaryKey = 'id'; /* |------------------------------------------------------------ @@ -682,6 +701,8 @@ public function testAbilityDefaultOptions() $user = m::mock('HasRoleUser')->makePartial(); $user->roles = [$roleA, $roleB]; + $user->id = 4; + $user->primaryKey = 'id'; /* |------------------------------------------------------------ @@ -776,6 +797,8 @@ public function testAbilityShouldThrowInvalidArgumentException() $user = m::mock('HasRoleUser')->makePartial(); $user->roles = [$roleA]; + $user->id = 4; + $user->primaryKey = 'id'; function isExceptionThrown( HasRoleUser $user, @@ -1006,6 +1029,7 @@ protected function mockPermission($permName) $permMock = m::mock('Permission'); $permMock->name = $permName; $permMock->display_name = ucwords(str_replace('_', ' ', $permName)); + $permMock->id = 1; return $permMock; } @@ -1016,6 +1040,7 @@ protected function mockRole($roleName) $roleMock->name = $roleName; $roleMock->perms = []; $roleMock->permissions = []; + $roleMock->id = 1; return $roleMock; } @@ -1026,6 +1051,13 @@ class HasRoleUser implements EntrustUserInterface use EntrustUserTrait; public $roles; + public $primaryKey; + public $id; + + public function __construct() { + $this->primaryKey = 'id'; + $this->id = 4; + } public function belongsToMany($role, $assignedRolesTable) { From 826de3701963136817995ae182bb28121cd0f3dc Mon Sep 17 00:00:00 2001 From: Scott A Connerly Date: Fri, 20 Nov 2015 12:02:30 -0600 Subject: [PATCH 3/6] * Unit tests all pass now. Had to mock some extra stuff and move the Facade setup to a setUp() method. --- tests/EntrustUserTest.php | 101 ++++++++++++++++++++++++++++++++------ 1 file changed, 86 insertions(+), 15 deletions(-) diff --git a/tests/EntrustUserTest.php b/tests/EntrustUserTest.php index 41c5ad8a..efd2de5a 100644 --- a/tests/EntrustUserTest.php +++ b/tests/EntrustUserTest.php @@ -3,17 +3,34 @@ use Zizaco\Entrust\Contracts\EntrustUserInterface; use Zizaco\Entrust\Traits\EntrustUserTrait; use Illuminate\Support\Facades\Config; -//use Illuminate\Support\Facades\Facade; use Illuminate\Support\Facades\Cache; +use Zizaco\Entrust\Permission; +use Zizaco\Entrust\Role; use Mockery as m; class EntrustUserTest extends PHPUnit_Framework_TestCase { + private $facadeMocks = array(); + + public function setUp() + { + parent::setUp(); + + $app = m::mock('app')->shouldReceive('instance')->getMock(); + + $this->facadeMocks['config'] = m::mock('config'); + $this->facadeMocks['cache'] = m::mock('cache'); + + Config::setFacadeApplication($app); + Config::swap($this->facadeMocks['config']); + + Cache::setFacadeApplication($app); + Cache::swap($this->facadeMocks['cache']); + } + public function tearDown() { m::close(); - //Facade::setFacadeApplication(null); - //Facade::clearResolvedInstances(); } public function testRoles() @@ -26,11 +43,6 @@ public function testRoles() $belongsToMany = new stdClass(); $user = m::mock('HasRoleUser')->makePartial(); - $app = m::mock('app')->shouldReceive('instance')->getMock(); - $config = m::mock('config'); - Config::setFacadeApplication($app); - Config::swap($config); - /* |------------------------------------------------------------ | Expectation @@ -70,12 +82,15 @@ public function testHasRole() $user = new HasRoleUser(); $user->roles = [$roleA, $roleB]; - - //Cache::setFacadeApplication(['cache' => m::mock('Illuminate\Support\Facades\Cache')]); - $app = m::mock('app')->shouldReceive('instance')->getMock(); - Cache::setFacadeApplication($app); - Cache::shouldReceive('tags->remember')->times(7)->andReturn($user->roles); + /* + |------------------------------------------------------------ + | Expectation + |------------------------------------------------------------ + */ + Config::shouldReceive('get')->with('entrust.role_user_table')->times(9)->andReturn('role_user'); + Config::shouldReceive('get')->with('cache.ttl')->times(9)->andReturn('1440'); + Cache::shouldReceive('tags->remember')->times(9)->andReturn($user->roles); /* |------------------------------------------------------------ @@ -112,6 +127,17 @@ public function testCan() $user = new HasRoleUser(); $user->roles = [$roleA, $roleB]; + /* + |------------------------------------------------------------ + | Expectation + |------------------------------------------------------------ + */ + $roleA->shouldReceive('cachedPermissions')->times(11)->andReturn($roleA->perms); + $roleB->shouldReceive('cachedPermissions')->times(7)->andReturn($roleB->perms); + Config::shouldReceive('get')->with('entrust.role_user_table')->times(11)->andReturn('role_user'); + Config::shouldReceive('get')->with('cache.ttl')->times(11)->andReturn('1440'); + Cache::shouldReceive('tags->remember')->times(11)->andReturn($user->roles); + /* |------------------------------------------------------------ | Assertion @@ -147,6 +173,16 @@ public function testCanWithPlaceholderSupport () $user = new HasRoleUser(); $user->roles = [$role]; + /* + |------------------------------------------------------------ + | Expectation + |------------------------------------------------------------ + */ + $role->shouldReceive('cachedPermissions')->times(6)->andReturn($role->perms); + Config::shouldReceive('get')->with('entrust.role_user_table')->times(6)->andReturn('role_user'); + Config::shouldReceive('get')->with('cache.ttl')->times(6)->andReturn('1440'); + Cache::shouldReceive('tags->remember')->times(6)->andReturn($user->roles); + /* |------------------------------------------------------------ | Assertion @@ -199,6 +235,12 @@ public function testAbilityShouldReturnBoolean() | Expectation |------------------------------------------------------------ */ + $roleA->shouldReceive('cachedPermissions')->times(16)->andReturn($roleA->perms); + $roleB->shouldReceive('cachedPermissions')->times(12)->andReturn($roleB->perms); + Config::shouldReceive('get')->with('entrust.role_user_table')->times(32)->andReturn('role_user'); + Config::shouldReceive('get')->with('cache.ttl')->times(32)->andReturn('1440'); + Cache::shouldReceive('tags->remember')->times(32)->andReturn($user->roles); + $user->shouldReceive('hasRole') ->with(m::anyOf($userRoleNameA, $userRoleNameB), m::anyOf(true, false)) ->andReturn(true); @@ -316,6 +358,12 @@ public function testAbilityShouldReturnArray() | Expectation |------------------------------------------------------------ */ + $roleA->shouldReceive('cachedPermissions')->times(16)->andReturn($roleA->perms); + $roleB->shouldReceive('cachedPermissions')->times(12)->andReturn($roleB->perms); + Config::shouldReceive('get')->with('entrust.role_user_table')->times(32)->andReturn('role_user'); + Config::shouldReceive('get')->with('cache.ttl')->times(32)->andReturn('1440'); + Cache::shouldReceive('tags->remember')->times(32)->andReturn($user->roles); + $user->shouldReceive('hasRole') ->with(m::anyOf($userRoleNameA, $userRoleNameB), m::anyOf(true, false)) ->andReturn(true); @@ -471,6 +519,12 @@ public function testAbilityShouldReturnBoth() | Expectation |------------------------------------------------------------ */ + $roleA->shouldReceive('cachedPermissions')->times(16)->andReturn($roleA->perms); + $roleB->shouldReceive('cachedPermissions')->times(12)->andReturn($roleB->perms); + Config::shouldReceive('get')->with('entrust.role_user_table')->times(32)->andReturn('role_user'); + Config::shouldReceive('get')->with('cache.ttl')->times(32)->andReturn('1440'); + Cache::shouldReceive('tags->remember')->times(32)->andReturn($user->roles); + $user->shouldReceive('hasRole') ->with(m::anyOf($userRoleNameA, $userRoleNameB), m::anyOf(true, false)) ->andReturn(true); @@ -640,6 +694,12 @@ public function testAbilityShouldAcceptStrings() | Expectation |------------------------------------------------------------ */ + $roleA->shouldReceive('cachedPermissions')->times(4)->andReturn($roleA->perms); + $roleB->shouldReceive('cachedPermissions')->times(2)->andReturn($roleB->perms); + Config::shouldReceive('get')->with('entrust.role_user_table')->times(8)->andReturn('role_user'); + Config::shouldReceive('get')->with('cache.ttl')->times(8)->andReturn('1440'); + Cache::shouldReceive('tags->remember')->times(8)->andReturn($user->roles); + $user->shouldReceive('hasRole') ->with(m::anyOf('UserRoleA', 'UserRoleB'), m::anyOf(true, false)) ->andReturn(true); @@ -709,6 +769,12 @@ public function testAbilityDefaultOptions() | Expectation |------------------------------------------------------------ */ + $roleA->shouldReceive('cachedPermissions')->times(16)->andReturn($roleA->perms); + $roleB->shouldReceive('cachedPermissions')->times(12)->andReturn($roleB->perms); + Config::shouldReceive('get')->with('entrust.role_user_table')->times(32)->andReturn('role_user'); + Config::shouldReceive('get')->with('cache.ttl')->times(32)->andReturn('1440'); + Cache::shouldReceive('tags->remember')->times(32)->andReturn($user->roles); + $user->shouldReceive('hasRole') ->with(m::anyOf($userRoleNameA, $userRoleNameB), m::anyOf(true, false)) ->andReturn(true); @@ -1007,6 +1073,11 @@ public function testDetachAllRoles() | Expectation |------------------------------------------------------------ */ + Config::shouldReceive('get')->with('entrust.role')->once()->andReturn('App\Role'); + Config::shouldReceive('get')->with('entrust.role_user_table')->once()->andReturn('role_user'); + Config::shouldReceive('get')->with('entrust.user_foreign_key')->once()->andReturn('user_id'); + Config::shouldReceive('get')->with('entrust.role_foreign_key')->once()->andReturn('role_id'); + $relationship->shouldReceive('get') ->andReturn($user->roles)->once(); @@ -1026,7 +1097,7 @@ public function testDetachAllRoles() protected function mockPermission($permName) { - $permMock = m::mock('Permission'); + $permMock = m::mock('Zizaco\Entrust\Permission'); $permMock->name = $permName; $permMock->display_name = ucwords(str_replace('_', ' ', $permName)); $permMock->id = 1; @@ -1036,7 +1107,7 @@ protected function mockPermission($permName) protected function mockRole($roleName) { - $roleMock = m::mock('Role'); + $roleMock = m::mock('Zizaco\Entrust\Role'); $roleMock->name = $roleName; $roleMock->perms = []; $roleMock->permissions = []; From 6e0d472b4b839348ccc7d37bfe0f5e493d9088cc Mon Sep 17 00:00:00 2001 From: Scott A Connerly Date: Fri, 20 Nov 2015 12:16:05 -0600 Subject: [PATCH 4/6] * Downgrading Illuminate/Cache so it'll work on PHP 5.4 --- composer.json | 2 +- composer.lock | 185 ++++++++++++++++++++++++-------------------------- 2 files changed, 90 insertions(+), 97 deletions(-) diff --git a/composer.json b/composer.json index 86e4ed13..4bda52e6 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "php": ">=5.4.0", "illuminate/console": "~5.0", "illuminate/support": "~5.0", - "illuminate/cache": "~5.0" + "illuminate/cache": "5.0.*" }, "require-dev": { "phpunit/phpunit": "~4.1", diff --git a/composer.lock b/composer.lock index 6ecabf24..b9f7fd9a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,21 +4,21 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "4dd26f51fcabd23f92a161ae646d57eb", - "content-hash": "47db535c397a67d4992d70960fdaf60d", + "hash": "58fedb308076ce14a851f4677e844b9f", + "content-hash": "370ad780cc81d4e83c18f8554926e39d", "packages": [ { "name": "danielstjules/stringy", - "version": "2.1.0", + "version": "1.x-dev", "source": { "type": "git", "url": "https://github.com/danielstjules/Stringy.git", - "reference": "efb10020f6f0274bd3c43a1549f37535e0a9d1cc" + "reference": "4749c205db47ee5b32e8d1adf6d9aff8db6caf3b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/danielstjules/Stringy/zipball/efb10020f6f0274bd3c43a1549f37535e0a9d1cc", - "reference": "efb10020f6f0274bd3c43a1549f37535e0a9d1cc", + "url": "https://api.github.com/repos/danielstjules/Stringy/zipball/4749c205db47ee5b32e8d1adf6d9aff8db6caf3b", + "reference": "4749c205db47ee5b32e8d1adf6d9aff8db6caf3b", "shasum": "" }, "require": { @@ -61,7 +61,7 @@ "utility", "utils" ], - "time": "2015-09-03 06:50:48" + "time": "2015-07-23 00:54:12" }, { "name": "doctrine/inflector", @@ -132,33 +132,33 @@ }, { "name": "illuminate/cache", - "version": "5.2.x-dev", + "version": "5.0.x-dev", "source": { "type": "git", "url": "https://github.com/illuminate/cache.git", - "reference": "63f0ab3c403efc4420e3b1dd5ccb5a12e9b46179" + "reference": "f50da0fe0365ba7bcaa7cfa605db5bf7c9d3c9b9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/cache/zipball/63f0ab3c403efc4420e3b1dd5ccb5a12e9b46179", - "reference": "63f0ab3c403efc4420e3b1dd5ccb5a12e9b46179", + "url": "https://api.github.com/repos/illuminate/cache/zipball/f50da0fe0365ba7bcaa7cfa605db5bf7c9d3c9b9", + "reference": "f50da0fe0365ba7bcaa7cfa605db5bf7c9d3c9b9", "shasum": "" }, "require": { - "illuminate/contracts": "5.2.*", - "illuminate/support": "5.2.*", - "nesbot/carbon": "~1.20", - "php": ">=5.5.9" + "illuminate/contracts": "5.0.*", + "illuminate/support": "5.0.*", + "nesbot/carbon": "~1.0", + "php": ">=5.4.0" }, "suggest": { - "illuminate/database": "Required to use the database cache driver (5.2.*).", - "illuminate/filesystem": "Required to use the file cache driver (5.2.*).", - "illuminate/redis": "Required to use the redis cache driver (5.2.*)." + "illuminate/database": "Required to use the database cache driver (5.0.*).", + "illuminate/filesystem": "Required to use the file cache driver (5.0.*).", + "illuminate/redis": "Required to use the redis cache driver (5.0.*)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.2-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -178,38 +178,38 @@ ], "description": "The Illuminate Cache package.", "homepage": "http://laravel.com", - "time": "2015-11-14 18:20:24" + "time": "2015-04-07 17:53:27" }, { "name": "illuminate/console", - "version": "5.2.x-dev", + "version": "5.0.x-dev", "source": { "type": "git", "url": "https://github.com/illuminate/console.git", - "reference": "9448ee8f9ee1f70c50175f1b64423fcc7c57e5f1" + "reference": "a1271fa68eed09a06b39fb60522b15f3a3551a23" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/console/zipball/9448ee8f9ee1f70c50175f1b64423fcc7c57e5f1", - "reference": "9448ee8f9ee1f70c50175f1b64423fcc7c57e5f1", + "url": "https://api.github.com/repos/illuminate/console/zipball/a1271fa68eed09a06b39fb60522b15f3a3551a23", + "reference": "a1271fa68eed09a06b39fb60522b15f3a3551a23", "shasum": "" }, "require": { - "illuminate/contracts": "5.2.*", - "illuminate/support": "5.2.*", - "nesbot/carbon": "~1.20", - "php": ">=5.5.9", - "symfony/console": "2.8.*|3.0.*" + "illuminate/contracts": "5.0.*", + "nesbot/carbon": "~1.0", + "php": ">=5.4.0", + "symfony/console": "2.6.*" }, "suggest": { - "guzzlehttp/guzzle": "Required to use the thenPing method on schedules (~6.0).", + "guzzlehttp/guzzle": "Required to use the thenPing method on schedules (~5.0).", "mtdowling/cron-expression": "Required to use scheduling component (~1.0).", - "symfony/process": "Required to use scheduling component (2.8.*|3.0.*)." + "nesbot/carbon": "Required to use scheduling component (~1.0).", + "symfony/process": "Required to use scheduling component (2.6.*)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.2-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -229,29 +229,29 @@ ], "description": "The Illuminate Console package.", "homepage": "http://laravel.com", - "time": "2015-11-11 22:45:19" + "time": "2015-05-28 22:24:21" }, { "name": "illuminate/contracts", - "version": "5.2.x-dev", + "version": "5.0.x-dev", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", - "reference": "3fa96ab963cbe769fe5214318ea1fee83b0237a6" + "reference": "6d23815fee6057b29cab8094af8cbb8ce3ac82e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/contracts/zipball/3fa96ab963cbe769fe5214318ea1fee83b0237a6", - "reference": "3fa96ab963cbe769fe5214318ea1fee83b0237a6", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/6d23815fee6057b29cab8094af8cbb8ce3ac82e4", + "reference": "6d23815fee6057b29cab8094af8cbb8ce3ac82e4", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": ">=5.4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.2-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -271,40 +271,37 @@ ], "description": "The Illuminate Contracts package.", "homepage": "http://laravel.com", - "time": "2015-11-18 08:43:01" + "time": "2015-05-15 07:22:28" }, { "name": "illuminate/support", - "version": "5.2.x-dev", + "version": "5.0.x-dev", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", - "reference": "9aaff5435a6ca87a16e67d0d41ba0941088c4035" + "reference": "28dcacacd2091c106e352db1732eda8c590914f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/9aaff5435a6ca87a16e67d0d41ba0941088c4035", - "reference": "9aaff5435a6ca87a16e67d0d41ba0941088c4035", + "url": "https://api.github.com/repos/illuminate/support/zipball/28dcacacd2091c106e352db1732eda8c590914f6", + "reference": "28dcacacd2091c106e352db1732eda8c590914f6", "shasum": "" }, "require": { - "danielstjules/stringy": "~2.1", + "danielstjules/stringy": "~1.8", "doctrine/inflector": "~1.0", "ext-mbstring": "*", - "illuminate/contracts": "5.2.*", - "php": ">=5.5.9" + "illuminate/contracts": "5.0.*", + "php": ">=5.4.0" }, "suggest": { - "illuminate/filesystem": "Required to use the composer class (5.2.*).", "jeremeamia/superclosure": "Required to be able to serialize closures (~2.0).", - "paragonie/random_compat": "Provides a compatible interface like PHP7's random_bytes() in PHP 5 projects (~1.1).", - "symfony/process": "Required to use the composer class (2.8.*|3.0.*).", - "symfony/var-dumper": "Required to use the dd function (2.8.*|3.0.*)." + "symfony/var-dumper": "Required to use the dd function (2.6.*)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.2-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -327,7 +324,7 @@ ], "description": "The Illuminate Support package.", "homepage": "http://laravel.com", - "time": "2015-11-18 19:16:09" + "time": "2015-06-04 12:15:51" }, { "name": "nesbot/carbon", @@ -378,26 +375,27 @@ }, { "name": "symfony/console", - "version": "2.8.x-dev", + "version": "2.6.x-dev", + "target-dir": "Symfony/Component/Console", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "ee86b4579c9e8ad3859cd33f3ef1572f85eda537" + "reference": "0e5e18ae09d3f5c06367759be940e9ed3f568359" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/ee86b4579c9e8ad3859cd33f3ef1572f85eda537", - "reference": "ee86b4579c9e8ad3859cd33f3ef1572f85eda537", + "url": "https://api.github.com/repos/symfony/console/zipball/0e5e18ae09d3f5c06367759be940e9ed3f568359", + "reference": "0e5e18ae09d3f5c06367759be940e9ed3f568359", "shasum": "" }, "require": { - "php": ">=5.3.9", - "symfony/polyfill-mbstring": "~1.0" + "php": ">=5.3.3" }, "require-dev": { "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1|~3.0.0", - "symfony/process": "~2.1|~3.0.0" + "symfony/event-dispatcher": "~2.1", + "symfony/phpunit-bridge": "~2.7", + "symfony/process": "~2.1" }, "suggest": { "psr/log": "For using the console logger", @@ -407,16 +405,13 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "2.6-dev" } }, "autoload": { - "psr-4": { + "psr-0": { "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -434,7 +429,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2015-11-18 13:45:00" + "time": "2015-07-26 09:08:40" }, { "name": "symfony/polyfill-mbstring", @@ -659,26 +654,26 @@ }, { "name": "illuminate/container", - "version": "5.2.x-dev", + "version": "5.0.x-dev", "source": { "type": "git", "url": "https://github.com/illuminate/container.git", - "reference": "d9a87f5861b140a6b98f73e64253da2ab2e2f36e" + "reference": "c5a78e53ef15204469b5b072d390af9785a82d32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/container/zipball/d9a87f5861b140a6b98f73e64253da2ab2e2f36e", - "reference": "d9a87f5861b140a6b98f73e64253da2ab2e2f36e", + "url": "https://api.github.com/repos/illuminate/container/zipball/c5a78e53ef15204469b5b072d390af9785a82d32", + "reference": "c5a78e53ef15204469b5b072d390af9785a82d32", "shasum": "" }, "require": { - "illuminate/contracts": "5.2.*", - "php": ">=5.5.9" + "illuminate/contracts": "5.0.*", + "php": ">=5.4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.2-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -698,41 +693,39 @@ ], "description": "The Illuminate Container package.", "homepage": "http://laravel.com", - "time": "2015-10-20 21:17:55" + "time": "2015-05-29 20:16:27" }, { "name": "illuminate/database", - "version": "5.2.x-dev", + "version": "5.0.x-dev", "source": { "type": "git", "url": "https://github.com/illuminate/database.git", - "reference": "5a59fe01e91846378730b2bf8c9a76ead80b3c02" + "reference": "e8933b4765aaa1b65f3f4a3638b6a0ea61b76a5a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/database/zipball/5a59fe01e91846378730b2bf8c9a76ead80b3c02", - "reference": "5a59fe01e91846378730b2bf8c9a76ead80b3c02", + "url": "https://api.github.com/repos/illuminate/database/zipball/e8933b4765aaa1b65f3f4a3638b6a0ea61b76a5a", + "reference": "e8933b4765aaa1b65f3f4a3638b6a0ea61b76a5a", "shasum": "" }, "require": { - "illuminate/container": "5.2.*", - "illuminate/contracts": "5.2.*", - "illuminate/support": "5.2.*", - "nesbot/carbon": "~1.20", - "php": ">=5.5.9" + "illuminate/container": "5.0.*", + "illuminate/contracts": "5.0.*", + "illuminate/support": "5.0.*", + "nesbot/carbon": "~1.0", + "php": ">=5.4.0" }, "suggest": { "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.4).", - "fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).", - "illuminate/console": "Required to use the database commands (5.2.*).", - "illuminate/events": "Required to use the observers with Eloquent (5.2.*).", - "illuminate/filesystem": "Required to use the migrations (5.2.*).", - "illuminate/pagination": "Required to paginate the result set (5.2.*)." + "illuminate/console": "Required to use the database commands (5.0.*).", + "illuminate/events": "Required to use the observers with Eloquent (5.0.*).", + "illuminate/filesystem": "Required to use the migrations (5.0.*)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.2-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -758,7 +751,7 @@ "orm", "sql" ], - "time": "2015-11-18 19:10:29" + "time": "2015-06-02 13:39:10" }, { "name": "michelf/php-markdown", @@ -1978,12 +1971,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "cabf2f9dbaba77ef2725dbd6ec45ba5ed69e18f9" + "reference": "8ad2cbb13f20580a01d6451d20ce46c7890fb183" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/cabf2f9dbaba77ef2725dbd6ec45ba5ed69e18f9", - "reference": "cabf2f9dbaba77ef2725dbd6ec45ba5ed69e18f9", + "url": "https://api.github.com/repos/symfony/process/zipball/8ad2cbb13f20580a01d6451d20ce46c7890fb183", + "reference": "8ad2cbb13f20580a01d6451d20ce46c7890fb183", "shasum": "" }, "require": { @@ -2019,7 +2012,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2015-11-18 16:56:24" + "time": "2015-11-19 16:12:55" }, { "name": "symfony/yaml", From 16958e65c02c6c540ca23dafbacc486b9de89296 Mon Sep 17 00:00:00 2001 From: Scott A Connerly Date: Fri, 20 Nov 2015 12:21:26 -0600 Subject: [PATCH 5/6] * Dropping PHP 5.4 support in favor of caching. --- .travis.yml | 1 - composer.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f6b67931..f949b272 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: php php: - - 5.4 - 5.5 - 5.6 - 7.0 diff --git a/composer.json b/composer.json index 4bda52e6..86e4ed13 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "php": ">=5.4.0", "illuminate/console": "~5.0", "illuminate/support": "~5.0", - "illuminate/cache": "5.0.*" + "illuminate/cache": "~5.0" }, "require-dev": { "phpunit/phpunit": "~4.1", From 71e058b43be51caac5b8f9b82ed44bc0d30fedea Mon Sep 17 00:00:00 2001 From: Scott A Connerly Date: Fri, 20 Nov 2015 12:23:19 -0600 Subject: [PATCH 6/6] * Having Composer know that we dropped 5.4 support. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 86e4ed13..45320aa5 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ } ], "require": { - "php": ">=5.4.0", + "php": ">=5.5.0", "illuminate/console": "~5.0", "illuminate/support": "~5.0", "illuminate/cache": "~5.0"