mirror of
https://github.com/flarum/framework.git
synced 2025-02-22 12:58:40 +08:00
Extract pure unit tests so that they can run fast
- Move to separate directory (base for a separate test suite) - Inherit directly from PhpUnit - Configure test suite with dedicated XML file
This commit is contained in:
parent
6484dc4982
commit
ba16ebe61f
@ -11,12 +11,8 @@
|
||||
syntaxCheck="false">
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="installation">
|
||||
<directory suffix="Test.php">./tests/Install</directory>
|
||||
</testsuite>
|
||||
<testsuite name="all">
|
||||
<directory suffix="Test.php">./tests</directory>
|
||||
<exclude>./tests/Install</exclude>
|
||||
<testsuite name="Flarum Unit Tests">
|
||||
<directory suffix="Test.php">./unit</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -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();
|
||||
}
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -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();
|
||||
}
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -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);
|
@ -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);
|
Loading…
x
Reference in New Issue
Block a user