Organize test suites into unit and integration

This is the goals of project organization composing different
combinations to run any number of tests together.
This commit is contained in:
Antonio Spinelli
2023-07-03 11:08:24 -03:00
parent 6ac3cc384b
commit 7f0db0de04
19 changed files with 102 additions and 37 deletions

View File

@@ -168,6 +168,12 @@
"post-install-cmd": [
"@php artisan firefly:instructions install",
"@php artisan firefly-iii:verify-security-alerts"
],
"unit-test": [
"@php vendor/bin/phpunit -c phpunit.xml --testsuite unit"
],
"integration-test": [
"@php vendor/bin/phpunit -c phpunit.xml --testsuite integration"
]
},
"config": {

View File

@@ -21,8 +21,11 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" stopOnFailure="true" processIsolation="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<coverage/>
<testsuites>
<testsuite name="Api">
<directory suffix="Test.php">./tests</directory>
<testsuite name="unit">
<directory suffix="Test.php">./tests/unit</directory>
</testsuite>
<testsuite name="integration">
<directory suffix="Test.php">./tests/integration</directory>
</testsuite>
</testsuites>
<php>

View File

@@ -21,11 +21,11 @@
declare(strict_types=1);
namespace Tests\Api\Autocomplete;
namespace Tests\integration\Api\Autocomplete;
use Laravel\Passport\Passport;
use Log;
use Tests\TestCase;
use Tests\integration\TestCase;
/**
* Class AccountControllerTest

View File

@@ -20,7 +20,7 @@
*/
declare(strict_types=1);
namespace Tests;
namespace Tests\integration;
use Illuminate\Contracts\Console\Kernel;
use Illuminate\Foundation\Application;

View File

@@ -21,10 +21,10 @@
*/
declare(strict_types=1);
namespace Tests;
namespace Tests\integration;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Tests\Traits\CollectsValues;
use Tests\integration\Traits\CollectsValues;
/**
* Class TestCase

View File

@@ -21,7 +21,7 @@
declare(strict_types=1);
namespace Tests\Traits;
namespace Tests\integration\Traits;
use FireflyIII\User;

View File

@@ -19,11 +19,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Tests\Support\Calendar;
namespace Tests\unit\Support\Calendar;
use Carbon\Carbon;
use FireflyIII\Support\Calendar\Periodicity;
use Tests\Support\Calendar\Periodicity\IntervalProvider;
use Tests\unit\Support\Calendar\Periodicity\IntervalProvider;
readonly class CalculatorProvider
{

View File

@@ -19,25 +19,28 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Tests\Support\Calendar;
namespace Tests\unit\Support\Calendar;
use Carbon\Carbon;
use FireflyIII\Api\V1\Controllers\Insight\Income\PeriodController;
use FireflyIII\Support\Calendar\Calculator;
use FireflyIII\Support\Calendar\Exceptions\IntervalException;
use FireflyIII\Support\Calendar\Periodicity;
use FireflyIII\Support\Navigation;
use Tests\Support\Calendar\Periodicity\BimonthlyTest;
use Tests\Support\Calendar\Periodicity\DailyTest;
use Tests\Support\Calendar\Periodicity\FortnightlyTest;
use Tests\Support\Calendar\Periodicity\HalfYearlyTest;
use Tests\Support\Calendar\Periodicity\IntervalProvider;
use Tests\Support\Calendar\Periodicity\MonthlyTest;
use Tests\Support\Calendar\Periodicity\QuarterlyTest;
use Tests\Support\Calendar\Periodicity\WeeklyTest;
use Tests\Support\Calendar\Periodicity\YearlyTest;
use Tests\TestCase;
use PHPUnit\Framework\TestCase;
use Tests\unit\Support\Calendar\Periodicity\BimonthlyTest;
use Tests\unit\Support\Calendar\Periodicity\DailyTest;
use Tests\unit\Support\Calendar\Periodicity\FortnightlyTest;
use Tests\unit\Support\Calendar\Periodicity\HalfYearlyTest;
use Tests\unit\Support\Calendar\Periodicity\IntervalProvider;
use Tests\unit\Support\Calendar\Periodicity\MonthlyTest;
use Tests\unit\Support\Calendar\Periodicity\QuarterlyTest;
use Tests\unit\Support\Calendar\Periodicity\WeeklyTest;
use Tests\unit\Support\Calendar\Periodicity\YearlyTest;
/**
* @group unit-test
* @group support
* @group calendar
* @group calculator
*/
class CalculatorTest extends TestCase
{
private static function convert(Periodicity $periodicity, array $intervals): array

View File

@@ -19,12 +19,18 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Tests\Support\Calendar\Periodicity;
namespace Tests\unit\Support\Calendar\Periodicity;
use Carbon\Carbon;
use FireflyIII\Support\Calendar\Periodicity;
use FireflyIII\Support\Calendar\Periodicity\Interval;
/**
* @group unit-test
* @group support
* @group calendar
* @group periodicity
*/
class BimonthlyTest extends IntervalTestCase
{
public static function factory(): Interval

View File

@@ -19,12 +19,18 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Tests\Support\Calendar\Periodicity;
namespace Tests\unit\Support\Calendar\Periodicity;
use Carbon\Carbon;
use FireflyIII\Support\Calendar\Periodicity;
use FireflyIII\Support\Calendar\Periodicity\Interval;
/**
* @group unit-test
* @group support
* @group calendar
* @group periodicity
*/
class DailyTest extends IntervalTestCase
{
public static function factory(): Interval

View File

@@ -19,12 +19,18 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Tests\Support\Calendar\Periodicity;
namespace Tests\unit\Support\Calendar\Periodicity;
use Carbon\Carbon;
use FireflyIII\Support\Calendar\Periodicity;
use FireflyIII\Support\Calendar\Periodicity\Interval;
/**
* @group unit-test
* @group support
* @group calendar
* @group periodicity
*/
class FortnightlyTest extends IntervalTestCase
{
public static function factory(): Interval

View File

@@ -19,12 +19,18 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Tests\Support\Calendar\Periodicity;
namespace Tests\unit\Support\Calendar\Periodicity;
use Carbon\Carbon;
use FireflyIII\Support\Calendar\Periodicity;
use FireflyIII\Support\Calendar\Periodicity\Interval;
/**
* @group unit-test
* @group support
* @group calendar
* @group periodicity
*/
class HalfYearlyTest extends IntervalTestCase
{
public static function factory(): Interval

View File

@@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Tests\Support\Calendar\Periodicity;
namespace Tests\unit\Support\Calendar\Periodicity;
use Carbon\Carbon;

View File

@@ -19,10 +19,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Tests\Support\Calendar\Periodicity;
namespace Tests\unit\Support\Calendar\Periodicity;
use FireflyIII\Support\Calendar\Periodicity\Interval;
use Tests\TestCase;
use PHPUnit\Framework\TestCase;
abstract class IntervalTestCase extends TestCase
{

View File

@@ -19,12 +19,18 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Tests\Support\Calendar\Periodicity;
namespace Tests\unit\Support\Calendar\Periodicity;
use Carbon\Carbon;
use FireflyIII\Support\Calendar\Periodicity;
use FireflyIII\Support\Calendar\Periodicity\Interval;
/**
* @group unit-test
* @group support
* @group calendar
* @group periodicity
*/
class MonthlyTest extends IntervalTestCase
{
public static function factory(): Interval

View File

@@ -19,12 +19,18 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Tests\Support\Calendar\Periodicity;
namespace Tests\unit\Support\Calendar\Periodicity;
use Carbon\Carbon;
use FireflyIII\Support\Calendar\Periodicity;
use FireflyIII\Support\Calendar\Periodicity\Interval;
/**
* @group unit-test
* @group support
* @group calendar
* @group periodicity
*/
class QuarterlyTest extends IntervalTestCase
{
public static function factory(): Interval

View File

@@ -19,12 +19,18 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Tests\Support\Calendar\Periodicity;
namespace Tests\unit\Support\Calendar\Periodicity;
use Carbon\Carbon;
use FireflyIII\Support\Calendar\Periodicity;
use FireflyIII\Support\Calendar\Periodicity\Interval;
/**
* @group unit-test
* @group support
* @group calendar
* @group periodicity
*/
class WeeklyTest extends IntervalTestCase
{
public static function factory(): Interval

View File

@@ -19,12 +19,18 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Tests\Support\Calendar\Periodicity;
namespace Tests\unit\Support\Calendar\Periodicity;
use Carbon\Carbon;
use FireflyIII\Support\Calendar\Periodicity;
use FireflyIII\Support\Calendar\Periodicity\Interval;
/**
* @group unit-test
* @group support
* @group calendar
* @group periodicity
*/
class YearlyTest extends IntervalTestCase
{
public static function factory(): Interval

View File

@@ -1,12 +1,17 @@
<?php
namespace Tests\Support;
namespace Tests\unit\Support;
use Carbon\Carbon;
use FireflyIII\Support\Calendar\Periodicity;
use FireflyIII\Support\Navigation;
use Tests\TestCase;
use PHPUnit\Framework\TestCase;
/**
* @group unit-test
* @group support
* @group navigation
*/
class NavigationTest extends TestCase
{
private Navigation $navigation;