Fixed tests

This commit is contained in:
Graham Campbell
2015-06-01 22:25:34 +01:00
parent 0c065ae690
commit 049b9ac308
4 changed files with 26 additions and 292 deletions

View File

@@ -11,19 +11,28 @@
namespace CachetHQ\Tests\Cachet;
use GrahamCampbell\TestBench\AbstractAppTestCase;
use Illuminate\Foundation\Testing\TestCase;
abstract class AbstractTestCase extends AbstractAppTestCase
abstract class AbstractTestCase extends TestCase
{
/**
* Get the service provider class.
* The base URL to use while testing the application.
*
* @param \Illuminate\Contracts\Foundation\Application $app
*
* @return string
* @var string
*/
protected function getServiceProviderClass($app)
protected $baseUrl = 'http://localhost';
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
return 'CachetHQ\Cachet\Providers\AppServiceProvider';
$app = require __DIR__.'/../bootstrap/app.php';
$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap();
return $app;
}
}

View File

@@ -21,18 +21,18 @@ class ComponentTest extends AbstractTestCase
public function testGetComponents()
{
$this->get('/api/v1/components')->seeJson(['data' => []]);
$this->assertResponseOk();
}
/**
* @expectedException \Illuminate\Database\Eloquent\ModelNotFoundException
*/
public function testGetInvalidComponent()
{
$this->get('/api/v1/components/1');
$this->assertResponseStatus(404);
}
/*public function testPostComponentUnauthorized()
public function testPostComponentUnauthorized()
{
$this->post('/api/v1/components')->seeJson(['data']);
}*/
$this->post('/api/v1/components');
$this->assertResponseStatus(401);
}
}