Start working on API tests
This commit is contained in:
Regular → Executable
+4
-1
@@ -37,7 +37,10 @@
|
|||||||
"barryvdh/laravel-cors": "^0.5"
|
"barryvdh/laravel-cors": "^0.5"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"graham-campbell/testbench": "^2.1"
|
"graham-campbell/testbench": "^2.1",
|
||||||
|
"fzaninotto/faker": "~1.4",
|
||||||
|
"mockery/mockery": "0.9.*",
|
||||||
|
"phpunit/phpunit": "~4.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"classmap": [
|
"classmap": [
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Cachet HQ <support@cachethq.io>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Api;
|
||||||
|
|
||||||
|
use CachetHQ\Tests\Cachet\AbstractTestCase;
|
||||||
|
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||||
|
|
||||||
|
class ComponentTest extends AbstractTestCase
|
||||||
|
{
|
||||||
|
use DatabaseMigrations;
|
||||||
|
|
||||||
|
public function testGetComponents()
|
||||||
|
{
|
||||||
|
$this->get('/api/v1/components')->seeJson(['data' => []]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetInvalidComponent()
|
||||||
|
{
|
||||||
|
$this->setExpectedException('Illuminate\Database\Eloquent\ModelNotFoundException');
|
||||||
|
$this->get('/api/v1/components/1');
|
||||||
|
}
|
||||||
|
|
||||||
|
/*public function testPostComponentUnauthorized()
|
||||||
|
{
|
||||||
|
$this->post('/api/v1/components')->seeJson(['data']);
|
||||||
|
}*/
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Cachet HQ <support@cachethq.io>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Api;
|
||||||
|
|
||||||
|
use CachetHQ\Tests\Cachet\AbstractTestCase;
|
||||||
|
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||||
|
|
||||||
|
class IncidentTest extends AbstractTestCase
|
||||||
|
{
|
||||||
|
use DatabaseMigrations;
|
||||||
|
|
||||||
|
public function testGetIncidents()
|
||||||
|
{
|
||||||
|
$this->get('/api/v1/incidents')->seeJson(['data' => []]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Cachet HQ <support@cachethq.io>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Api;
|
||||||
|
|
||||||
|
use CachetHQ\Tests\Cachet\AbstractTestCase;
|
||||||
|
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||||
|
|
||||||
|
class MetricTest extends AbstractTestCase
|
||||||
|
{
|
||||||
|
use DatabaseMigrations;
|
||||||
|
|
||||||
|
public function testGetMetrics()
|
||||||
|
{
|
||||||
|
$this->get('/api/v1/metrics')->seeJson(['data' => []]);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user