diff --git a/phpunit.xml b/tests/phpunit.unit.xml similarity index 68% rename from phpunit.xml rename to tests/phpunit.unit.xml index 9a6492957..aaa4c2d93 100644 --- a/phpunit.xml +++ b/tests/phpunit.unit.xml @@ -11,12 +11,8 @@ syntaxCheck="false"> - - ./tests/Install - - - ./tests - ./tests/Install + + ./unit diff --git a/tests/Api/ExceptionHandler/FloodingExceptionHandlerTest.php b/tests/unit/Api/ExceptionHandler/FloodingExceptionHandlerTest.php similarity index 90% rename from tests/Api/ExceptionHandler/FloodingExceptionHandlerTest.php rename to tests/unit/Api/ExceptionHandler/FloodingExceptionHandlerTest.php index 5b9b72398..e2043b493 100644 --- a/tests/Api/ExceptionHandler/FloodingExceptionHandlerTest.php +++ b/tests/unit/Api/ExceptionHandler/FloodingExceptionHandlerTest.php @@ -9,18 +9,18 @@ * file that was distributed with this source code. */ -namespace Flarum\Tests\Api\ExceptionHandler; +namespace Flarum\Tests\unit\Api\ExceptionHandler; use Exception; use Flarum\Api\ExceptionHandler\FloodingExceptionHandler; use Flarum\Post\Exception\FloodingException; -use Flarum\Tests\Test\TestCase; +use PHPUnit\Framework\TestCase; class FloodingExceptionHandlerTest extends TestCase { private $handler; - public function init() + public function setUp() { $this->handler = new FloodingExceptionHandler; } diff --git a/tests/Api/ExceptionHandler/IlluminateValidationExceptionHandlerTest.php b/tests/unit/Api/ExceptionHandler/IlluminateValidationExceptionHandlerTest.php similarity index 94% rename from tests/Api/ExceptionHandler/IlluminateValidationExceptionHandlerTest.php rename to tests/unit/Api/ExceptionHandler/IlluminateValidationExceptionHandlerTest.php index adbcc588d..ed3d799f6 100644 --- a/tests/Api/ExceptionHandler/IlluminateValidationExceptionHandlerTest.php +++ b/tests/unit/Api/ExceptionHandler/IlluminateValidationExceptionHandlerTest.php @@ -9,21 +9,21 @@ * file that was distributed with this source code. */ -namespace Flarum\Tests\Api\ExceptionHandler; +namespace Flarum\Tests\unit\Api\ExceptionHandler; use Exception; use Flarum\Api\ExceptionHandler\IlluminateValidationExceptionHandler; -use Flarum\Tests\Test\TestCase; use Illuminate\Translation\ArrayLoader; use Illuminate\Translation\Translator; use Illuminate\Validation\Factory; use Illuminate\Validation\ValidationException; +use PHPUnit\Framework\TestCase; class IlluminateValidationExceptionHandlerTest extends TestCase { private $handler; - public function init() + public function setUp() { $this->handler = new IlluminateValidationExceptionHandler; } diff --git a/tests/Api/ExceptionHandler/InvalidAccessTokenExceptionHandlerTest.php b/tests/unit/Api/ExceptionHandler/InvalidAccessTokenExceptionHandlerTest.php similarity index 91% rename from tests/Api/ExceptionHandler/InvalidAccessTokenExceptionHandlerTest.php rename to tests/unit/Api/ExceptionHandler/InvalidAccessTokenExceptionHandlerTest.php index bb270319f..3d7355eac 100644 --- a/tests/Api/ExceptionHandler/InvalidAccessTokenExceptionHandlerTest.php +++ b/tests/unit/Api/ExceptionHandler/InvalidAccessTokenExceptionHandlerTest.php @@ -9,18 +9,18 @@ * file that was distributed with this source code. */ -namespace Flarum\Tests\Api\ExceptionHandler; +namespace Flarum\Tests\unit\Api\ExceptionHandler; use Exception; use Flarum\Api\Exception\InvalidAccessTokenException; use Flarum\Api\ExceptionHandler\InvalidAccessTokenExceptionHandler; -use Flarum\Tests\Test\TestCase; +use PHPUnit\Framework\TestCase; class InvalidAccessTokenExceptionHandlerTest extends TestCase { private $handler; - public function init() + public function setUp() { $this->handler = new InvalidAccessTokenExceptionHandler; } diff --git a/tests/Api/ExceptionHandler/InvalidConfirmationTokenExceptionHandlerTest.php b/tests/unit/Api/ExceptionHandler/InvalidConfirmationTokenExceptionHandlerTest.php similarity index 91% rename from tests/Api/ExceptionHandler/InvalidConfirmationTokenExceptionHandlerTest.php rename to tests/unit/Api/ExceptionHandler/InvalidConfirmationTokenExceptionHandlerTest.php index f04b8edde..1f289fe73 100644 --- a/tests/Api/ExceptionHandler/InvalidConfirmationTokenExceptionHandlerTest.php +++ b/tests/unit/Api/ExceptionHandler/InvalidConfirmationTokenExceptionHandlerTest.php @@ -9,18 +9,18 @@ * file that was distributed with this source code. */ -namespace Flarum\Tests\Api\ExceptionHandler; +namespace Flarum\Tests\unit\Api\ExceptionHandler; use Exception; use Flarum\Api\ExceptionHandler\InvalidConfirmationTokenExceptionHandler; -use Flarum\Tests\Test\TestCase; use Flarum\User\Exception\InvalidConfirmationTokenException; +use PHPUnit\Framework\TestCase; class InvalidConfirmationTokenExceptionHandlerTest extends TestCase { private $handler; - public function init() + public function setUp() { $this->handler = new InvalidConfirmationTokenExceptionHandler; } diff --git a/tests/Api/ExceptionHandler/MethodNotAllowedExceptionHandlerTest.php b/tests/unit/Api/ExceptionHandler/MethodNotAllowedExceptionHandlerTest.php similarity index 91% rename from tests/Api/ExceptionHandler/MethodNotAllowedExceptionHandlerTest.php rename to tests/unit/Api/ExceptionHandler/MethodNotAllowedExceptionHandlerTest.php index 2da7da65d..23ce0761f 100644 --- a/tests/Api/ExceptionHandler/MethodNotAllowedExceptionHandlerTest.php +++ b/tests/unit/Api/ExceptionHandler/MethodNotAllowedExceptionHandlerTest.php @@ -9,18 +9,18 @@ * file that was distributed with this source code. */ -namespace Flarum\Tests\Api\ExceptionHandler; +namespace Flarum\Tests\unit\Api\ExceptionHandler; use Exception; use Flarum\Api\ExceptionHandler\MethodNotAllowedExceptionHandler; use Flarum\Http\Exception\MethodNotAllowedException; -use Flarum\Tests\Test\TestCase; +use PHPUnit\Framework\TestCase; class MethodNotAllowedExceptionHandlerTest extends TestCase { private $handler; - public function init() + public function setUp() { $this->handler = new MethodNotAllowedExceptionHandler(); } diff --git a/tests/Api/ExceptionHandler/ModelNotFoundExceptionHandlerTest.php b/tests/unit/Api/ExceptionHandler/ModelNotFoundExceptionHandlerTest.php similarity index 90% rename from tests/Api/ExceptionHandler/ModelNotFoundExceptionHandlerTest.php rename to tests/unit/Api/ExceptionHandler/ModelNotFoundExceptionHandlerTest.php index 4e097d446..c1eb2efcc 100644 --- a/tests/Api/ExceptionHandler/ModelNotFoundExceptionHandlerTest.php +++ b/tests/unit/Api/ExceptionHandler/ModelNotFoundExceptionHandlerTest.php @@ -9,18 +9,18 @@ * file that was distributed with this source code. */ -namespace Flarum\Tests\Api\ExceptionHandler; +namespace Flarum\Tests\unit\Api\ExceptionHandler; use Exception; use Flarum\Api\ExceptionHandler\ModelNotFoundExceptionHandler; -use Flarum\Tests\Test\TestCase; use Illuminate\Database\Eloquent\ModelNotFoundException; +use PHPUnit\Framework\TestCase; class ModelNotFoundExceptionHandlerTest extends TestCase { private $handler; - public function init() + public function setUp() { $this->handler = new ModelNotFoundExceptionHandler; } diff --git a/tests/Api/ExceptionHandler/PermissionDeniedExceptionHandlerTest.php b/tests/unit/Api/ExceptionHandler/PermissionDeniedExceptionHandlerTest.php similarity index 91% rename from tests/Api/ExceptionHandler/PermissionDeniedExceptionHandlerTest.php rename to tests/unit/Api/ExceptionHandler/PermissionDeniedExceptionHandlerTest.php index ffdb0e9f4..dcfdb33f8 100644 --- a/tests/Api/ExceptionHandler/PermissionDeniedExceptionHandlerTest.php +++ b/tests/unit/Api/ExceptionHandler/PermissionDeniedExceptionHandlerTest.php @@ -9,18 +9,18 @@ * file that was distributed with this source code. */ -namespace Flarum\Tests\Api\ExceptionHandler; +namespace Flarum\Tests\unit\Api\ExceptionHandler; use Exception; use Flarum\Api\ExceptionHandler\PermissionDeniedExceptionHandler; -use Flarum\Tests\Test\TestCase; use Flarum\User\Exception\PermissionDeniedException; +use PHPUnit\Framework\TestCase; class PermissionDeniedExceptionHandlerTest extends TestCase { private $handler; - public function init() + public function setUp() { $this->handler = new PermissionDeniedExceptionHandler; } diff --git a/tests/Api/ExceptionHandler/RouteNotFoundExceptionHandlerTest.php b/tests/unit/Api/ExceptionHandler/RouteNotFoundExceptionHandlerTest.php similarity index 90% rename from tests/Api/ExceptionHandler/RouteNotFoundExceptionHandlerTest.php rename to tests/unit/Api/ExceptionHandler/RouteNotFoundExceptionHandlerTest.php index 61659c53e..51c82cb70 100644 --- a/tests/Api/ExceptionHandler/RouteNotFoundExceptionHandlerTest.php +++ b/tests/unit/Api/ExceptionHandler/RouteNotFoundExceptionHandlerTest.php @@ -9,18 +9,18 @@ * file that was distributed with this source code. */ -namespace Flarum\Tests\Api\ExceptionHandler; +namespace Flarum\Tests\unit\Api\ExceptionHandler; use Exception; use Flarum\Api\ExceptionHandler\RouteNotFoundExceptionHandler; use Flarum\Http\Exception\RouteNotFoundException; -use Flarum\Tests\Test\TestCase; +use PHPUnit\Framework\TestCase; class RouteNotFoundExceptionHandlerTest extends TestCase { private $handler; - public function init() + public function setUp() { $this->handler = new RouteNotFoundExceptionHandler(); } diff --git a/tests/Api/ExceptionHandler/TokenMismatchExceptionHandlerTest.php b/tests/unit/Api/ExceptionHandler/TokenMismatchExceptionHandlerTest.php similarity index 90% rename from tests/Api/ExceptionHandler/TokenMismatchExceptionHandlerTest.php rename to tests/unit/Api/ExceptionHandler/TokenMismatchExceptionHandlerTest.php index 352b156a0..eebb1bff8 100644 --- a/tests/Api/ExceptionHandler/TokenMismatchExceptionHandlerTest.php +++ b/tests/unit/Api/ExceptionHandler/TokenMismatchExceptionHandlerTest.php @@ -9,18 +9,18 @@ * file that was distributed with this source code. */ -namespace Flarum\Tests\Api\ExceptionHandler; +namespace Flarum\Tests\unit\Api\ExceptionHandler; use Exception; use Flarum\Api\ExceptionHandler\TokenMismatchExceptionHandler; use Flarum\Http\Exception\TokenMismatchException; -use Flarum\Tests\Test\TestCase; +use PHPUnit\Framework\TestCase; class TokenMismatchExceptionHandlerTest extends TestCase { private $handler; - public function init() + public function setUp() { $this->handler = new TokenMismatchExceptionHandler; } diff --git a/tests/Api/ExceptionHandler/ValidationExceptionHandlerTest.php b/tests/unit/Api/ExceptionHandler/ValidationExceptionHandlerTest.php similarity index 93% rename from tests/Api/ExceptionHandler/ValidationExceptionHandlerTest.php rename to tests/unit/Api/ExceptionHandler/ValidationExceptionHandlerTest.php index 1cd125467..a014a96e5 100644 --- a/tests/Api/ExceptionHandler/ValidationExceptionHandlerTest.php +++ b/tests/unit/Api/ExceptionHandler/ValidationExceptionHandlerTest.php @@ -9,18 +9,18 @@ * file that was distributed with this source code. */ -namespace Flarum\Tests\Api\ExceptionHandler; +namespace Flarum\Tests\unit\Api\ExceptionHandler; use Exception; use Flarum\Api\ExceptionHandler\ValidationExceptionHandler; use Flarum\Foundation\ValidationException; -use Flarum\Tests\Test\TestCase; +use PHPUnit\Framework\TestCase; class ValidationExceptionHandlerTest extends TestCase { private $handler; - public function init() + public function setUp() { $this->handler = new ValidationExceptionHandler; } diff --git a/tests/Settings/DatabaseSettingsRepositoryTest.php b/tests/unit/Settings/DatabaseSettingsRepositoryTest.php similarity index 91% rename from tests/Settings/DatabaseSettingsRepositoryTest.php rename to tests/unit/Settings/DatabaseSettingsRepositoryTest.php index 134651487..c7188792d 100644 --- a/tests/Settings/DatabaseSettingsRepositoryTest.php +++ b/tests/unit/Settings/DatabaseSettingsRepositoryTest.php @@ -9,19 +9,19 @@ * file that was distributed with this source code. */ -namespace Flarum\Tests\Settings; +namespace Flarum\Tests\unit\Settings; use Flarum\Settings\DatabaseSettingsRepository; -use Flarum\Tests\Test\TestCase; use Illuminate\Database\ConnectionInterface; use Mockery as m; +use PHPUnit\Framework\TestCase; class DatabaseSettingsRepositoryTest extends TestCase { private $connection; private $repository; - public function init() + public function setUp() { $this->connection = m::mock(ConnectionInterface::class); $this->repository = new DatabaseSettingsRepository($this->connection); diff --git a/tests/Settings/MemoryCacheSettingsRepositoryTest.php b/tests/unit/Settings/MemoryCacheSettingsRepositoryTest.php similarity index 94% rename from tests/Settings/MemoryCacheSettingsRepositoryTest.php rename to tests/unit/Settings/MemoryCacheSettingsRepositoryTest.php index 0e21815ca..aa2e35615 100644 --- a/tests/Settings/MemoryCacheSettingsRepositoryTest.php +++ b/tests/unit/Settings/MemoryCacheSettingsRepositoryTest.php @@ -9,19 +9,19 @@ * file that was distributed with this source code. */ -namespace Flarum\Tests\Settings; +namespace Flarum\Tests\unit\Settings; use Flarum\Settings\MemoryCacheSettingsRepository; use Flarum\Settings\SettingsRepositoryInterface; -use Flarum\Tests\Test\TestCase; use Mockery as m; +use PHPUnit\Framework\TestCase; class MemoryCacheSettingsRepositoryTest extends TestCase { private $baseRepository; private $repository; - public function init() + public function setUp() { $this->baseRepository = m::mock(SettingsRepositoryInterface::class); $this->repository = new MemoryCacheSettingsRepository($this->baseRepository);