Skip to content

Commit

Permalink
Merge pull request #13 from SocialiteProviders/feature/12-service-pro…
Browse files Browse the repository at this point in the history
…vider-test

Changed service provider to have SocialiteWasCalled Injected.

Added test for ServiceProvider
  • Loading branch information
AndyWendt committed Feb 26, 2015
2 parents 6964d4c + 7f809c0 commit 59d736b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ class ServiceProvider extends SocialiteServiceProvider
{
/**
* @param Dispatcher $event
* @param SocialiteWasCalled $socialiteWasCalled
*/
public function boot(Dispatcher $event)
public function boot(Dispatcher $event, SocialiteWasCalled $socialiteWasCalled)
{
$event->fire(new SocialiteWasCalled($this->app));
$event->fire($socialiteWasCalled);
}
}
28 changes: 28 additions & 0 deletions tests/ServiceProviderTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
namespace SocialiteProviders\Manager;

use Mockery as m;

class ServiceProviderTest extends \PHPUnit_Framework_TestCase
{

public function tearDown()
{
\Mockery::close();
}

/**
* @test
*/
public function it_fires_an_event()
{
$app = m::mock('Illuminate\Contracts\Foundation\Application');
$socialiteWasCalled = m::mock('SocialiteProviders\Manager\SocialiteWasCalled');

$event = m::mock('Illuminate\Contracts\Events\Dispatcher');
$event->shouldReceive('fire')->with($socialiteWasCalled);

$sp = new ServiceProvider($app);
$sp->boot($event, $socialiteWasCalled);
}
}

0 comments on commit 59d736b

Please sign in to comment.