Be more verbose in our testing
This commit is contained in:
@@ -20,7 +20,8 @@ class ComponentTest extends AbstractTestCase
|
|||||||
|
|
||||||
public function testGetComponents()
|
public function testGetComponents()
|
||||||
{
|
{
|
||||||
$this->get('/api/v1/components')->seeJson(['data' => []]);
|
$this->get('/api/v1/components');
|
||||||
|
$this->seeJson(['data' => []]);
|
||||||
$this->assertResponseOk();
|
$this->assertResponseOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,8 +39,7 @@ class ComponentTest extends AbstractTestCase
|
|||||||
|
|
||||||
public function testPostComponentNoData()
|
public function testPostComponentNoData()
|
||||||
{
|
{
|
||||||
$this->user = factory('CachetHQ\Cachet\Models\User')->create();
|
$this->beUser();
|
||||||
$this->be($this->user);
|
|
||||||
|
|
||||||
$this->post('/api/v1/components');
|
$this->post('/api/v1/components');
|
||||||
$this->assertResponseStatus(400);
|
$this->assertResponseStatus(400);
|
||||||
@@ -47,8 +47,7 @@ class ComponentTest extends AbstractTestCase
|
|||||||
|
|
||||||
public function testPostComponent()
|
public function testPostComponent()
|
||||||
{
|
{
|
||||||
$this->user = factory('CachetHQ\Cachet\Models\User')->create();
|
$this->beUser();
|
||||||
$this->be($this->user);
|
|
||||||
|
|
||||||
$this->post('/api/v1/components', [
|
$this->post('/api/v1/components', [
|
||||||
'name' => 'Foo',
|
'name' => 'Foo',
|
||||||
@@ -57,14 +56,21 @@ class ComponentTest extends AbstractTestCase
|
|||||||
'link' => 'http://example.com',
|
'link' => 'http://example.com',
|
||||||
'order' => 1,
|
'order' => 1,
|
||||||
'group_id' => 1,
|
'group_id' => 1,
|
||||||
])->seeJson(['name' => 'Foo']);
|
]);
|
||||||
|
$this->seeJson(['name' => 'Foo']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetNewComponent()
|
public function testGetNewComponent()
|
||||||
|
{
|
||||||
|
$this->beUser();
|
||||||
|
|
||||||
|
$this->get('/api/v1/components/1');
|
||||||
|
$this->seeJson(['name' => 'Foo']);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function beUser()
|
||||||
{
|
{
|
||||||
$this->user = factory('CachetHQ\Cachet\Models\User')->create();
|
$this->user = factory('CachetHQ\Cachet\Models\User')->create();
|
||||||
$this->be($this->user);
|
$this->be($this->user);
|
||||||
|
|
||||||
$this->get('/api/v1/components/1')->seeJson(['name' => 'Foo']);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user