Incident templates cleanup (#2182)

Clean up Incident Templates, supply incident array to them by default
This commit is contained in:
James Brooks
2016-10-14 08:03:19 +01:00
committed by GitHub
parent c2153512d9
commit fe96a00b82
14 changed files with 124 additions and 157 deletions

View File

@@ -130,20 +130,18 @@ class IncidentTest extends AbstractApiTestCase
public function testPutIncidentWithTemplate()
{
$this->beUser();
$template = factory('CachetHQ\Cachet\Models\IncidentTemplate')->create();
$template = factory('CachetHQ\Cachet\Models\IncidentTemplate')->create([
'template' => 'Hello there this is a foo in my {{ incident.name }}!',
]);
$component = factory('CachetHQ\Cachet\Models\Incident')->create();
$this->put('/api/v1/incidents/1', [
'name' => 'Foo',
'template' => $template->slug,
'vars' => [
'name' => 'Foo',
'message' => 'Hello there this is a foo!',
],
]);
$this->seeJson([
'name' => 'Foo',
'message' => "Name: Foo,\nMessage: Hello there this is a foo!",
'message' => 'Hello there this is a foo in my Foo!',
]);
$this->assertResponseOk();
}

View File

@@ -39,7 +39,7 @@ class ReportIncidentCommandTest extends AbstractTestCase
'stickied' => false,
'incident_date' => null,
'template' => null,
'template_vars' => null,
'template_vars' => [],
];
$object = new ReportIncidentCommand(

View File

@@ -41,7 +41,7 @@ class UpdateIncidentCommandTest extends AbstractTestCase
'stickied' => false,
'incident_date' => null,
'template' => null,
'template_vars' => null,
'template_vars' => [],
];
$object = new UpdateIncidentCommand(