Finish Component API testing

This commit is contained in:
James Brooks
2015-06-02 19:44:17 +01:00
parent 9de5847004
commit 4245b95406
2 changed files with 34 additions and 3 deletions

View File

@@ -20,3 +20,14 @@ $factory->define('CachetHQ\Cachet\Models\User', function ($faker) {
'level' => 1,
];
});
$factory->define('CachetHQ\Cachet\Models\Component', function ($faker) {
return [
'name' => $faker->sentence(),
'description' => $faker->paragraph(),
'link' => $faker->url(),
'status' => 1,
'order' => 0,
'user_id' => 1,
];
});

View File

@@ -60,11 +60,31 @@ class ComponentTest extends AbstractTestCase
$this->seeJson(['name' => 'Foo']);
}
/*public function testGetNewComponent()
public function testGetNewComponent()
{
$this->beUser();
$incident = factory('CachetHQ\Cachet\Models\Component')->create();
$this->get('/api/v1/components/1');
$this->seeJson(['name' => $incident->name]);
}
public function testPutComponent()
{
$this->beUser();
$incident = factory('CachetHQ\Cachet\Models\Component')->create();
$this->put('/api/v1/components/1', [
'name' => 'Foo',
]);
$this->seeJson(['name' => 'Foo']);
}*/
}
public function testDeleteComponent()
{
$this->beUser();
$incident = factory('CachetHQ\Cachet\Models\Component')->create();
$this->delete('/api/v1/components/1');
$this->assertResponseStatus(204);
}
}