1
0
mirror of https://github.com/flarum/core.git synced 2025-08-08 17:36:38 +02:00

Fix tests and CS

This commit is contained in:
Toby Zerner
2015-12-05 22:31:33 +10:30
parent 0cf000122f
commit d743e56bc1
10 changed files with 100 additions and 41 deletions

View File

@@ -1,6 +1,16 @@
<?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tests\Flarum\Api\Handler;
use Exception;
use Flarum\Api\Handler\ModelNotFoundExceptionHandler;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Tests\Test\TestCase;
@@ -16,7 +26,7 @@ class ModelNotFoundExceptionHandlerTest extends TestCase
public function test_it_handles_recognisable_exceptions()
{
$this->assertFalse($this->handler->manages(new \Exception));
$this->assertFalse($this->handler->manages(new Exception));
$this->assertTrue($this->handler->manages(new ModelNotFoundException));
}
@@ -25,6 +35,11 @@ class ModelNotFoundExceptionHandlerTest extends TestCase
$response = $this->handler->handle(new ModelNotFoundException);
$this->assertEquals(404, $response->getStatus());
$this->assertEquals([[]], $response->getErrors());
$this->assertEquals([
[
'status' => '404',
'code' => 'resource_not_found'
]
], $response->getErrors());
}
}