Skip to content

Commit

Permalink
Folder and files restructuring
Browse files Browse the repository at this point in the history
  • Loading branch information
santigarcor committed Sep 15, 2017
1 parent 4f128e6 commit ccf7b81
Show file tree
Hide file tree
Showing 40 changed files with 41 additions and 42 deletions.
5 changes: 1 addition & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@
"phpunit/phpunit": "~4.1"
},
"autoload": {
"classmap": [
"src/commands"
],
"psr-4": {
"Laratrust\\": "src/Laratrust/"
"Laratrust\\": "src/"
}
},
"autoload-dev": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Laratrust;
namespace Laratrust\Commands;

/**
* This file is part of Laratrust,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Laratrust;
namespace Laratrust\Commands;

/**
* This file is part of Laratrust,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Laratrust;
namespace Laratrust\Commands;

/**
* This file is part of Laratrust,
Expand Down Expand Up @@ -66,7 +66,7 @@ protected function getDefaultNamespace($rootNamespace)
{
return $rootNamespace;
}

/**
* Get the console command arguments.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Laratrust;
namespace Laratrust\Commands;

/**
* This file is part of Laratrust,
Expand Down Expand Up @@ -73,7 +73,7 @@ protected function createSeeder()
$user = new Collection(Config::get('laratrust.user_models', ['App\User']));
$user = $user->first();

$output = $this->laravel->view->make('laratrust::generators.seeder')
$output = $this->laravel->view->make('laratrust::seeder')
->with(compact([
'role',
'permission',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Laratrust;
namespace Laratrust\Commands;

/**
* This file is part of Laratrust,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Laratrust;
namespace Laratrust\Commands;

/**
* This file is part of Laratrust,
Expand Down Expand Up @@ -57,7 +57,7 @@ public function handle()

if ($existingMigrations) {
$this->line('');

$this->warn($this->getExistingMigrationsWarning($existingMigrations));
}

Expand Down Expand Up @@ -93,7 +93,7 @@ protected function createMigration()
$migrationPath = $this->getMigrationPath();

$output = $this->laravel->view
->make('laratrust::generators.migration')
->make('laratrust::migration')
->with(['laratrust' => Config::get('laratrust')])
->render();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Laratrust;
namespace Laratrust\Commands;

/**
* This file is part of Laratrust,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Laratrust;
namespace Laratrust\Commands;

/**
* This file is part of Laratrust,
Expand Down Expand Up @@ -58,7 +58,7 @@ public function handle()

if ($existingMigrations) {
$this->line('');

$this->warn($this->getExistingMigrationsWarning($existingMigrations));
}

Expand Down Expand Up @@ -98,7 +98,7 @@ protected function createMigration()

$this->call('view:clear');
$output = $this->laravel->view
->make('laratrust::generators.setup-teams')
->make('laratrust::setup-teams')
->with(['laratrust' => Config::get('laratrust')])
->render();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Laratrust;
namespace Laratrust\Commands;

/**
* This file is part of Laratrust,
Expand Down Expand Up @@ -52,7 +52,7 @@ public function handle()

if ($existingMigrations) {
$this->line('');

$this->warn($this->getExistingMigrationsWarning($existingMigrations));
}

Expand Down Expand Up @@ -89,7 +89,7 @@ protected function createMigration()

$this->call('view:clear');
$output = $this->laravel->view
->make('laratrust::generators.upgrade-migration')
->make('laratrust::upgrade-migration')
->with(['laratrust' => Config::get('laratrust')])
->render();

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public function boot()
{
// Register published configuration.
$this->publishes([
__DIR__.'/../config/laratrust.php' => config_path('laratrust.php'),
__DIR__.'/../config/laratrust_seeder.php' => config_path('laratrust_seeder.php'),
__DIR__.'/config/laratrust.php' => config_path('laratrust.php'),
__DIR__.'/config/laratrust_seeder.php' => config_path('laratrust_seeder.php'),
], 'laratrust');

$this->useMorphMapForRelationships();
Expand Down Expand Up @@ -162,63 +162,63 @@ protected function registerCommands()
protected function registerMigrationCommand()
{
$this->app->singleton('command.laratrust.migration', function () {
return new MigrationCommand();
return new \Laratrust\Commands\MigrationCommand();
});
}

protected function registerMakeRoleCommand()
{
$this->app->singleton('command.laratrust.role', function ($app) {
return new MakeRoleCommand($app['files']);
return new \Laratrust\Commands\MakeRoleCommand($app['files']);
});
}

protected function registerMakePermissionCommand()
{
$this->app->singleton('command.laratrust.permission', function ($app) {
return new MakePermissionCommand($app['files']);
return new \Laratrust\Commands\MakePermissionCommand($app['files']);
});
}

protected function registerMakeTeamCommand()
{
$this->app->singleton('command.laratrust.team', function ($app) {
return new MakeTeamCommand($app['files']);
return new \Laratrust\Commands\MakeTeamCommand($app['files']);
});
}

protected function registerAddLaratrustUserTraitUseCommand()
{
$this->app->singleton('command.laratrust.add-trait', function () {
return new AddLaratrustUserTraitUseCommand();
return new \Laratrust\Commands\AddLaratrustUserTraitUseCommand();
});
}

protected function registerSetupCommand()
{
$this->app->singleton('command.laratrust.setup', function () {
return new SetupCommand();
return new \Laratrust\Commands\SetupCommand();
});
}

protected function registerSetupTeamsCommand()
{
$this->app->singleton('command.laratrust.setup-teams', function () {
return new SetupTeamsCommand();
return new \Laratrust\Commands\SetupTeamsCommand();
});
}

protected function registerMakeSeederCommand()
{
$this->app->singleton('command.laratrust.seeder', function () {
return new MakeSeederCommand();
return new \Laratrust\Commands\MakeSeederCommand();
});
}

protected function registerUpgradeCommand()
{
$this->app->singleton('command.laratrust.upgrade', function () {
return new UpgradeCommand();
return new \Laratrust\Commands\UpgradeCommand();
});
}

Expand All @@ -230,7 +230,7 @@ protected function registerUpgradeCommand()
private function mergeConfig()
{
$this->mergeConfigFrom(
__DIR__.'/../config/laratrust.php',
__DIR__.'/config/laratrust.php',
'laratrust'
);
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Laratrust;
namespace Laratrust\Models;

/**
* This file is part of Laratrust,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Laratrust;
namespace Laratrust\Models;

/**
* This file is part of Laratrust,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Laratrust;
namespace Laratrust\Models;

/**
* This file is part of Laratrust,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions tests/LaratrustRoleTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

use Illuminate\Database\Eloquent\SoftDeletes;
use Mockery as m;
use Laratrust\Models\LaratrustRole;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Config;
use Laratrust\LaratrustRole;
use Mockery as m;
use Illuminate\Database\Eloquent\SoftDeletes;

class LaratrustRoleTest extends UserTest
{
Expand Down
8 changes: 5 additions & 3 deletions tests/UserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function tearDown()

protected function mockPermission($permName, $team_id = null)
{
$permMock = m::mock('Laratrust\Permission');
$permMock = m::mock('Laratrust\Models\Permission');
$permMock->name = $permName;
$permMock->display_name = ucwords(str_replace('_', ' ', $permName));
$permMock->id = 1;
Expand All @@ -45,7 +45,7 @@ protected function mockPermission($permName, $team_id = null)

protected function mockRole($roleName, $team_id = null)
{
$roleMock = m::mock('Laratrust\LaratrustRole')->makePartial();
$roleMock = m::mock('Laratrust\Models\LaratrustRole')->makePartial();

Config::shouldReceive('get')->with('laratrust.user_models')->andReturn([]);
$roleMock->name = $roleName;
Expand All @@ -62,7 +62,9 @@ protected function mockRole($roleName, $team_id = null)

protected function mockTeam($teamName)
{
$teamMock = m::mock('Laratrust\Team');
$teamMock = m::mock('Laratrust\Models\LaratrustTeam')->makePartial();

Config::shouldReceive('get')->with('laratrust.user_models')->andReturn([]);
$teamMock->name = $teamName;
$teamMock->id = 1;

Expand Down

0 comments on commit ccf7b81

Please sign in to comment.