Updated tests namespace to be ps4-valid. Added tests for flooding exception, fixed broken code

This commit is contained in:
Kirk Bushell 2015-10-27 12:48:27 +00:00
parent 71bb3eadcd
commit 067f87eacb
7 changed files with 27 additions and 5 deletions

View File

@ -67,7 +67,7 @@
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {
"tests\\": "tests/" "Tests\\": "tests/"
} }
}, },
"scripts": { "scripts": {

View File

View File

@ -1,5 +1,5 @@
<?php <?php
namespace tests\Flarum\Admin\Middleware; namespace Tests\Flarum\Admin\Middleware;
use Flarum\Admin\Middleware\AuthenticateWithCookie; use Flarum\Admin\Middleware\AuthenticateWithCookie;
use Flarum\Admin\Middleware\RequireAdministrateAbility; use Flarum\Admin\Middleware\RequireAdministrateAbility;

View File

@ -0,0 +1,22 @@
<?php
namespace tests\Flarum\Api\Handler;
use Flarum\Api\Handler\FloodingExceptionHandler;
use Flarum\Core\Exception\FloodingException;
use Tests\Test\TestCase;
class FloodingExceptionHandlerTest extends TestCase
{
private $handler;
public function init()
{
$this->handler = new FloodingExceptionHandler;
}
public function test_it_handles_recognisable_exceptions()
{
$this->assertFalse($this->handler->manages(new \Exception));
$this->assertTrue($this->handler->manages(new FloodingException));
}
}

View File

@ -1,5 +1,5 @@
<?php <?php
namespace tests\Flarum\Core\Settings; namespace Tests\Flarum\Core\Settings;
use Flarum\Settings\DatabaseSettingsRepository; use Flarum\Settings\DatabaseSettingsRepository;
use Illuminate\Database\ConnectionInterface; use Illuminate\Database\ConnectionInterface;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace tests\Flarum\Core\Settings; namespace Tests\Flarum\Core\Settings;
use Flarum\Settings\MemoryCacheSettingsRepository; use Flarum\Settings\MemoryCacheSettingsRepository;
use Flarum\Settings\SettingsRepositoryInterface; use Flarum\Settings\SettingsRepositoryInterface;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace tests\Test; namespace Tests\Test;
use Mockery; use Mockery;
use PHPUnit_Framework_TestCase; use PHPUnit_Framework_TestCase;