Skip to content

Commit

Permalink
Added some more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
esbenp committed Jun 24, 2015
1 parent 231a556 commit a76a293
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
composer.phar
composer.lock
vendor
6 changes: 6 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
stopOnFailure="false"
syntaxCheck="false">

<filter>
<whitelist>
<directory>./src/</directory>
</whitelist>
</filter>

<testsuites>
<testsuite name="Optimus\ApiConsumer Test Suite">
<directory suffix="Test.php">./tests/</directory>
Expand Down
4 changes: 3 additions & 1 deletion src/Facade/ApiConsumer.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php

namespace Illuminate\Support\Facades;
namespace Optimus\ApiConsumer\Facade;

use Illuminate\Support\Facades\Facade;

/**
* @see \Optimus\ApiConsumer\Router
Expand Down
21 changes: 21 additions & 0 deletions tests/Facade/ApiConsumerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

use Optimus\ApiConsumer\Facade\ApiConsumer as ApiConsumerFacade;

class StubFacade extends ApiConsumerFacade {
public function getAccessor()
{
return parent::getFacadeAccessor();
}
}

class ApiConsumerTest extends Orchestra\Testbench\TestCase {

public function testFacadeIsWorking()
{
$facade = new StubFacade;

$this->assertEquals('apiconsumer', $facade->getAccessor());
}

}
28 changes: 28 additions & 0 deletions tests/Provider/LaravelServiceProviderTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

use Mockery as m;

class LaravelServiceProviderTest extends Orchestra\Testbench\TestCase {

public function testServiceProviderIsWorking()
{
$appMock = m::mock('Illuminate\Foundation\Application');

$appMock->shouldReceive('bindShared')->with(
'apiconsumer',
m::on(function($closure){
var_dump($closure);
var_dump("YOP");
return true;
})
);

$provider = $this->app->make('Optimus\ApiConsumer\Provider\LaravelServiceProvider', [
$appMock
]);

$this->assertNull($provider->register());
$provider->boot();
}

}

0 comments on commit a76a293

Please sign in to comment.