Components can now be supplied meta data
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user