From 067f87eacb0295307e5f6bdd6d69d01d1a577174 Mon Sep 17 00:00:00 2001 From: Kirk Bushell Date: Tue, 27 Oct 2015 12:48:27 +0000 Subject: [PATCH] Updated tests namespace to be ps4-valid. Added tests for flooding exception, fixed broken code --- framework/core/composer.json | 2 +- framework/core/phpunit.yml | 0 .../RequireAdministrateAbilityTest.php | 2 +- .../Handler/FloodingExceptionHandlerTest.php | 22 +++++++++++++++++++ .../DatabaseSettingsRepositoryTest.php | 2 +- .../MemoryCacheSettingsRepositoryTest.php | 2 +- framework/core/tests/Test/TestCase.php | 2 +- 7 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 framework/core/phpunit.yml create mode 100644 framework/core/tests/Flarum/Api/Handler/FloodingExceptionHandlerTest.php diff --git a/framework/core/composer.json b/framework/core/composer.json index c81c3f702..10527f74e 100644 --- a/framework/core/composer.json +++ b/framework/core/composer.json @@ -67,7 +67,7 @@ }, "autoload-dev": { "psr-4": { - "tests\\": "tests/" + "Tests\\": "tests/" } }, "scripts": { diff --git a/framework/core/phpunit.yml b/framework/core/phpunit.yml new file mode 100644 index 000000000..e69de29bb diff --git a/framework/core/tests/Flarum/Admin/Middleware/RequireAdministrateAbilityTest.php b/framework/core/tests/Flarum/Admin/Middleware/RequireAdministrateAbilityTest.php index 607000928..261eba796 100644 --- a/framework/core/tests/Flarum/Admin/Middleware/RequireAdministrateAbilityTest.php +++ b/framework/core/tests/Flarum/Admin/Middleware/RequireAdministrateAbilityTest.php @@ -1,5 +1,5 @@ handler = new FloodingExceptionHandler; + } + + public function test_it_handles_recognisable_exceptions() + { + $this->assertFalse($this->handler->manages(new \Exception)); + $this->assertTrue($this->handler->manages(new FloodingException)); + } +} diff --git a/framework/core/tests/Flarum/Core/Settings/DatabaseSettingsRepositoryTest.php b/framework/core/tests/Flarum/Core/Settings/DatabaseSettingsRepositoryTest.php index 3e7929dc1..69b52ce64 100644 --- a/framework/core/tests/Flarum/Core/Settings/DatabaseSettingsRepositoryTest.php +++ b/framework/core/tests/Flarum/Core/Settings/DatabaseSettingsRepositoryTest.php @@ -1,5 +1,5 @@