Created
March 12, 2014 20:26
-
-
Save assertchris/9515602 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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