Code style fixes
This commit is contained in:
@@ -19,14 +19,14 @@ class IncidentTemplateController extends AbstractApiController
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get all incident templates.
|
* Get all incident templates.
|
||||||
|
*
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$templates = IncidentTemplate::query();
|
$templates = IncidentTemplate::query();
|
||||||
|
|
||||||
if ($sortBy = Binput::get('sort'))
|
if ($sortBy = Binput::get('sort')) {
|
||||||
{
|
|
||||||
$direction = Binput::has('order') && Binput::get('order') == 'desc';
|
$direction = Binput::has('order') && Binput::get('order') == 'desc';
|
||||||
|
|
||||||
$templates->sort($sortBy, $direction);
|
$templates->sort($sortBy, $direction);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ use CachetHQ\Cachet\Models\IncidentTemplate;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the incident template test class.
|
* This is the incident template test class.
|
||||||
|
*
|
||||||
* @author Marc Hagen <hello@marchagen.nl>
|
* @author Marc Hagen <hello@marchagen.nl>
|
||||||
*/
|
*/
|
||||||
class IncidentTemplateTest extends AbstractApiTestCase
|
class IncidentTemplateTest extends AbstractApiTestCase
|
||||||
@@ -25,9 +26,9 @@ class IncidentTemplateTest extends AbstractApiTestCase
|
|||||||
|
|
||||||
$response = $this->json('GET', '/api/v1/incidents/templates');
|
$response = $this->json('GET', '/api/v1/incidents/templates');
|
||||||
|
|
||||||
$response->assertJsonFragment([ 'id' => $templates[0]->id ]);
|
$response->assertJsonFragment(['id' => $templates[0]->id]);
|
||||||
$response->assertJsonFragment([ 'id' => $templates[1]->id ]);
|
$response->assertJsonFragment(['id' => $templates[1]->id]);
|
||||||
$response->assertJsonFragment([ 'id' => $templates[2]->id ]);
|
$response->assertJsonFragment(['id' => $templates[2]->id]);
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,5 +38,4 @@ class IncidentTemplateTest extends AbstractApiTestCase
|
|||||||
|
|
||||||
$response->assertStatus(404);
|
$response->assertStatus(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user