Namespaced models and refactored filters

This commit is contained in:
Graham Campbell
2015-01-02 00:18:19 +00:00
parent 15a6694865
commit 0ccb5e289c
66 changed files with 310 additions and 195 deletions
@@ -0,0 +1,35 @@
<?php
class ComponentControllerTest extends TestCase
{
public function setUp()
{
$this->repo = Mockery::mock('CachetHQ\Cachet\Repositories\Component\ComponentRepository');
$this->dingo = Mockery::mock('Dingo\Api\Auth\Shield');
}
public function tearDown()
{
Mockery::close();
}
public function test_get_components_method()
{
$this->repo->shouldReceive('all')->once()->andReturn('foo');
$controller = new CachetHQ\Cachet\Http\Controllers\Api\ComponentController($this->repo);
$response = $controller->getComponents();
$this->assertEquals('foo', $response);
}
public function test_get_component_method()
{
$this->repo->shouldReceive('findOrFail')->with(1)->once()->andReturn('foo');
$controller = new CachetHQ\Cachet\Http\Controllers\Api\ComponentController($this->repo);
$response = $controller->getComponent(1);
$this->assertEquals('foo', $response);
}
}
+18
View File
@@ -0,0 +1,18 @@
<?php
class TestCase extends Illuminate\Foundation\Testing\TestCase
{
/**
* Creates the application.
*
* @return \Symfony\Component\HttpKernel\HttpKernelInterface
*/
public function createApplication()
{
$unitTesting = true;
$testEnvironment = 'testing';
return require __DIR__.'/../bootstrap/start.php';
}
}