Components can now be supplied meta data

This commit is contained in:
James Brooks
2016-12-05 19:03:27 +00:00
parent f5b6919aa3
commit edfbb2384f
12 changed files with 140 additions and 15 deletions

View File

@@ -84,6 +84,31 @@ class ComponentTest extends AbstractApiTestCase
$this->assertResponseOk();
}
public function testPostComponentWithMetaData()
{
$this->beUser();
$this->post('/api/v1/components', [
'name' => 'Foo',
'description' => 'Bar',
'status' => 1,
'link' => 'http://example.com',
'order' => 1,
'group_id' => 1,
'enabled' => true,
'meta' => [
'uuid' => '172ff3fb-41f7-49d3-8bcd-f57b53627fa0',
],
]);
$this->seeJson([
'meta' => [
'uuid' => '172ff3fb-41f7-49d3-8bcd-f57b53627fa0',
],
]);
$this->assertResponseOk();
}
public function testPostDisabledComponent()
{
$this->beUser();
@@ -122,6 +147,31 @@ class ComponentTest extends AbstractApiTestCase
$this->assertResponseOk();
}
public function testPutComponentWithMetaData()
{
$this->beUser();
$component = factory('CachetHQ\Cachet\Models\Component')->create([
'meta' => [
'uuid' => '172ff3fb-41f7-49d3-8bcd-f57b53627fa0',
],
]);
$this->put('/api/v1/components/1', [
'meta' => [
'uuid' => '172ff3fb-41f7-49d3-8bcd-f57b53627fa0',
'foo' => 'bar',
],
]);
$this->seeJson([
'meta' => [
'uuid' => '172ff3fb-41f7-49d3-8bcd-f57b53627fa0',
'foo' => 'bar',
],
]);
$this->assertResponseOk();
}
public function testDeleteComponent()
{
$this->beUser();

View File

@@ -36,6 +36,7 @@ class AddComponentCommandTest extends AbstractTestCase
'order' => 0,
'group_id' => 0,
'enabled' => true,
'meta' => null,
];
$object = new AddComponentCommand(
$params['name'],
@@ -44,7 +45,8 @@ class AddComponentCommandTest extends AbstractTestCase
$params['link'],
$params['order'],
$params['group_id'],
$params['enabled']
$params['enabled'],
$params['meta']
);
return compact('params', 'object');

View File

@@ -38,6 +38,7 @@ class UpdateComponentCommandTest extends AbstractTestCase
'order' => 0,
'group_id' => 0,
'enabled' => true,
'meta' => null,
];
$object = new UpdateComponentCommand(
@@ -48,7 +49,8 @@ class UpdateComponentCommandTest extends AbstractTestCase
$params['link'],
$params['order'],
$params['group_id'],
$params['enabled']
$params['enabled'],
$params['meta']
);
return compact('params', 'object');