Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upadate the key of table name of password #549

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Updating Service Provider to do the Laravel 5 way of adding resources
  • Loading branch information
impleri committed Mar 18, 2015
commit 99f417f229989c1f470b368ae5ffede0cdeb37be
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
"src/migrations",
"src/commands"
],
"files": [
"tests/Confide/helpers.php"
],
"psr-4": {
"Zizaco\\Confide\\": "src/Confide/"
}
Expand Down
9 changes: 8 additions & 1 deletion src/Confide/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ class ServiceProvider extends IlluminateServiceProvider
*/
public function boot()
{
$this->package('zizaco/confide', 'confide', __DIR__.'/../');
$root = __DIR__.'/../';

$this->publishes([
$root . 'config/config.php' => config_path('confide.php'),
]);
$this->mergeConfigFrom($root . 'config/config.php', 'confide');
$this->loadTranslationsFrom($root . 'lang', 'confide');
$this->loadViewsFrom($root . 'views', 'confide');

$this->commands(
'command.confide.controller',
Expand Down
35 changes: 30 additions & 5 deletions tests/Confide/ServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,44 @@ public function testShouldBoot()
| Set
|------------------------------------------------------------
*/
$sp = m::mock('Zizaco\Confide\ServiceProvider[package,commands]', ['something']);
$sp = m::mock(
'Zizaco\Confide\ServiceProvider[commands,loadTranslationsFrom,loadViewsFrom,mergeConfigFrom,publishes]',
['something']
);
$sp->shouldAllowMockingProtectedMethods();
$test = $this;

/*
|------------------------------------------------------------
| Expectation
|------------------------------------------------------------
*/
$sp->shouldReceive('package')
->with('zizaco/confide', 'confide', m::any())
$sp->shouldReceive('publishes')
->with(m::type('array'))
->once()
->andReturnUsing(function ($array) use ($test) {
$test->assertContains('test/confide.php', $array);
});

$sp->shouldReceive('mergeConfigFrom')
->with(m::type('string'), 'confide')
->once()
->andReturnUsing(function ($a, $b) use ($test) {
$test->assertStringEndsWith('config/config.php', $a);
});

$sp->shouldReceive('loadTranslationsFrom')
->with(m::type('string'), 'confide')
->once()
->andReturnUsing(function ($a, $b) use ($test) {
$test->assertStringEndsWith('lang', $a);
});

$sp->shouldReceive('loadViewsFrom')
->with(m::type('string'), 'confide')
->once()
->andReturnUsing(function ($a, $b, $c) use ($test) {
$test->assertContains('confide/src/Confide/../', $c);
->andReturnUsing(function ($a, $b) use ($test) {
$test->assertStringEndsWith('views', $a);
});

$sp->shouldReceive('commands')
Expand Down
6 changes: 6 additions & 0 deletions tests/Confide/helpers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php namespace Zizaco\Confide;

function config_path($path)
{
return 'test/' . $path;
}