Skip to content

Commit

Permalink
Improved EntrustTest
Browse files Browse the repository at this point in the history
Improved EntrustTest.php.
Committed git's auto-normalization of line endings to LF
resulting from addition of .gitattributes in Zizaco#165.
Also, added 3 fixes matching those in pending PR Zizaco#166:
1. Entrust.php: $_app array access to $app prop access
2. git mv src/Zizaco/Entrust to src/Entrust
3. composer.json autoload to psr-4
  • Loading branch information
jobrios committed Jul 30, 2014
1 parent 0665937 commit cad775b
Show file tree
Hide file tree
Showing 10 changed files with 836 additions and 240 deletions.
28 changes: 14 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
language: php

php:
- 5.4
- 5.5
- 5.6
- hhvm

before_script:
- travis_retry composer self-update
- travis_retry composer install --no-interaction --prefer-source --dev

script:
- vendor/bin/phpunit --verbose
language: php

php:
- 5.4
- 5.5
- 5.6
- hhvm

before_script:
- travis_retry composer self-update
- travis_retry composer install --no-interaction --prefer-source --dev

script:
- vendor/bin/phpunit --verbose
124 changes: 62 additions & 62 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,62 +1,62 @@
{
"name": "zizaco/entrust",
"description": "This package provides a flexible way to add Role-based Permissions to Laravel 4",
"keywords": ["laravel","illuminate","auth","roles"],
"license": "MIT",
"authors": [
{
"name": "Zizaco Zizuini",
"email": "[email protected]"
},
{
"name": "Andrew Elkins",
"homepage": "http://www.andrewelkins.com"
}
],
"require": {
"php": ">=5.4.0",
"illuminate/support": "~4.0",
"laravelbook/ardent": "~2.4"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"mockery/mockery": "~0.8",
"illuminate/database": "~4.0",
"league/factory-muffin": "~1.5"
},
"repositories": [
{
"type": "package",
"package": {
"name": "laravelbook/ardent",
"version": "2.4.2",
"source": {
"type": "git",
"url": "https://github.com/bexarcreativeinc/ardent.git",
"reference": "master"
},
"autoload": {
"psr-0": {
"LaravelBook\\Ardent": "src/"
}
}
}
}
],
"suggest": {
"zizaco/confide":"Confide is an authentication solution for Laravel 4 that couples very well with Entrust"
},
"autoload": {
"classmap": [
"src/commands"
],
"psr-0": {
"Zizaco\\Entrust": "src/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.2-dev"
}
}
}
{
"name": "zizaco/entrust",
"description": "This package provides a flexible way to add Role-based Permissions to Laravel 4",
"keywords": ["laravel","illuminate","auth","roles"],
"license": "MIT",
"authors": [
{
"name": "Zizaco Zizuini",
"email": "[email protected]"
},
{
"name": "Andrew Elkins",
"homepage": "http://www.andrewelkins.com"
}
],
"require": {
"php": ">=5.4.0",
"illuminate/support": "~4.0",
"laravelbook/ardent": "~2.4"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"mockery/mockery": "~0.8",
"illuminate/database": "~4.0",
"league/factory-muffin": "~1.5"
},
"repositories": [
{
"type": "package",
"package": {
"name": "laravelbook/ardent",
"version": "2.4.2",
"source": {
"type": "git",
"url": "https://github.com/bexarcreativeinc/ardent.git",
"reference": "master"
},
"autoload": {
"psr-0": {
"LaravelBook\\Ardent": "src/"
}
}
}
}
],
"suggest": {
"zizaco/confide":"Confide is an authentication solution for Laravel 4 that couples very well with Entrust"
},
"autoload": {
"classmap": [
"src/commands"
],
"psr-4": {
"Zizaco\\Entrust\\": "src/Entrust/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.2-dev"
}
}
}
36 changes: 18 additions & 18 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
>
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
>
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
18 changes: 9 additions & 9 deletions src/Zizaco/Entrust/Entrust.php → src/Entrust/Entrust.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Entrust
*
* @var Illuminate\Foundation\Application
*/
public $_app;
public $app;

/**
* Create a new confide instance.
Expand All @@ -20,7 +20,7 @@ class Entrust
*/
public function __construct($app)
{
$this->_app = $app;
$this->app = $app;
}

/**
Expand Down Expand Up @@ -80,7 +80,7 @@ public function can( $permission )
*/
public function user()
{
return $this->_app['auth']->user();
return $this->app->auth->user();
}

/**
Expand Down Expand Up @@ -126,11 +126,11 @@ public function routeNeedsRole( $route, $roles, $result = null, $cumulative=true
}

// Same as Route::filter, registers a new filter
$this->_app['router']->filter($filter_name, $result);
$this->app->router->filter($filter_name, $result);

// Same as Route::when, assigns a route pattern to the
// previously created filter.
$this->_app['router']->when( $route, $filter_name );
$this->app->router->when( $route, $filter_name );
}

/**
Expand Down Expand Up @@ -178,11 +178,11 @@ public function routeNeedsPermission( $route, $permissions, $result = null, $cum
}

// Same as Route::filter, registers a new filter
$this->_app['router']->filter($filter_name, $result);
$this->app->router->filter($filter_name, $result);

// Same as Route::when, assigns a route pattern to the
// previously created filter.
$this->_app['router']->when( $route, $filter_name );
$this->app->router->when( $route, $filter_name );
}

/**
Expand Down Expand Up @@ -242,10 +242,10 @@ public function routeNeedsRoleOrPermission( $route, $roles, $permissions, $resul
}

// Same as Route::filter, registers a new filter
$this->_app['router']->filter($filter_name, $result);
$this->app->router->filter($filter_name, $result);

// Same as Route::when, assigns a route pattern to the
// previously created filter.
$this->_app['router']->when( $route, $filter_name );
$this->app->router->when( $route, $filter_name );
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,65 +1,65 @@
<?php namespace Zizaco\Entrust;

use Illuminate\Support\ServiceProvider;

class EntrustServiceProvider extends ServiceProvider {

/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;

/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$this->package('zizaco/entrust');
}

/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->registerEntrust();

$this->registerCommands();
}

/**
* Register the application bindings.
*
* @return void
*/
private function registerEntrust()
{
$this->app->bind('entrust', function($app)
{
return new Entrust($app);
});
}

/**
* Register the artisan commands.
*
* @return void
*/
private function registerCommands()
{
$this->app['command.entrust.migration'] = $this->app->share(function($app)
{
return new MigrationCommand($app);
});

$this->commands(
'command.entrust.migration'
);
}
}
<?php namespace Zizaco\Entrust;

use Illuminate\Support\ServiceProvider;

class EntrustServiceProvider extends ServiceProvider {

/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;

/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$this->package('zizaco/entrust');
}

/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->registerEntrust();

$this->registerCommands();
}

/**
* Register the application bindings.
*
* @return void
*/
private function registerEntrust()
{
$this->app->bind('entrust', function($app)
{
return new Entrust($app);
});
}

/**
* Register the artisan commands.
*
* @return void
*/
private function registerCommands()
{
$this->app['command.entrust.migration'] = $this->app->share(function($app)
{
return new MigrationCommand($app);
});

$this->commands(
'command.entrust.migration'
);
}
}
File renamed without changes.
Loading

0 comments on commit cad775b

Please sign in to comment.