Skip to content

Instantly share code, notes, and snippets.

@assertchris
Created March 12, 2014 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save assertchris/9515602 to your computer and use it in GitHub Desktop.
Save assertchris/9515602 to your computer and use it in GitHub Desktop.
<?php
namespace Tricks\Providers;
use App;
use Mockery;
use TestCase;
class NavigationServiceProviderTest
extends TestCase
{
public function tearDown()
{
Mockery::close();
}
public function testRegister()
{
$applicationMock = Mockery::mock('Illuminate\Foundation\Application');
$applicationMock
->shouldReceive('share')
->atLeast()->once()
->with(Mockery::on(function($callback) {
$applicationMock = Mockery::mock('Illuminate\Foundation\Application');
$applicationMock
->shouldReceive('offsetGet')
->atLeast()->once()
->with('config')
->andReturn(
Mockery::mock('Illuminate\Config\Repository')
);
$applicationMock
->shouldReceive('offsetGet')
->atLeast()->once()
->with('auth')
->andReturn(
Mockery::mock('Illuminate\Auth\AuthManager')
);
$this->assertInstanceOf('Tricks\Services\Navigation\Builder', $callback($applicationMock));
return true;
}))
->andReturn('mocked');
$applicationMock
->shouldReceive('offsetSet')
->atLeast()->once()
->with('navigation.builder', 'mocked');
$provider = new NavigationServiceProvider(
$applicationMock
);
App::register($provider, [], true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment