Skip to content

Commit

Permalink
add an abstract base class for tests to remove some redundancy
Browse files Browse the repository at this point in the history
  • Loading branch information
mszulik committed Mar 7, 2022
1 parent c6fb0a0 commit 02bbd4e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 30 deletions.
16 changes: 16 additions & 0 deletions Tests/BaseTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Cybex\Protector\Tests;

use Cybex\Protector\ProtectorServiceProvider;
use Orchestra\Testbench\TestCase;

abstract class BaseTest extends TestCase
{
protected function getPackageProviders($app): array
{
return [
ProtectorServiceProvider::class,
];
}
}
11 changes: 1 addition & 10 deletions Tests/ExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,13 @@

namespace Cybex\Protector\Tests;

use Cybex\Protector\ProtectorServiceProvider;
use LogicException;
use Orchestra\Testbench\TestCase;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;

class ExceptionTest extends TestCase
class ExceptionTest extends BaseTest
{
protected function getPackageProviders($app): array
{
return [
ProtectorServiceProvider::class,
];
}

/**
* @test
*/
Expand Down
11 changes: 1 addition & 10 deletions Tests/GetLatestDumpNameTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@

use Cybex\Protector\Exceptions\FileNotFoundException;
use Cybex\Protector\Protector;
use Cybex\Protector\ProtectorServiceProvider;
use Illuminate\Filesystem\FilesystemAdapter;
use Illuminate\Support\Facades\Config;
use Orchestra\Testbench\TestCase;

class GetLatestDumpNameTest extends TestCase
class GetLatestDumpNameTest extends BaseTest
{
/**
* Protector instance.
Expand All @@ -26,13 +24,6 @@ class GetLatestDumpNameTest extends TestCase
*/
protected string $baseDirectory;

protected function getPackageProviders($app): array
{
return [
ProtectorServiceProvider::class,
];
}

protected function setUp(): void
{
parent::setUp();
Expand Down
11 changes: 1 addition & 10 deletions Tests/RemoteDumpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,16 @@
namespace Cybex\Protector\Tests;

use Cybex\Protector\Exceptions\InvalidConfigurationException;
use Cybex\Protector\ProtectorServiceProvider;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Storage;
use Orchestra\Testbench\TestCase;
use ReflectionClass;
use ReflectionMethod;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;

class RemoteDumpTest extends TestCase
class RemoteDumpTest extends BaseTest
{
protected function getPackageProviders($app): array
{
return [
ProtectorServiceProvider::class,
];
}

protected function setUp(): void
{
parent::setUp();
Expand Down

0 comments on commit 02bbd4e

Please sign in to comment.