Files
panel/tests/Integration/IntegrationTestCase.php

55 lines
1.3 KiB
PHP
Raw Normal View History

2018-03-04 16:30:16 -06:00
<?php
2024-03-12 22:39:16 -04:00
namespace App\Tests\Integration;
2018-03-04 16:30:16 -06:00
2024-03-12 22:39:16 -04:00
use App\Events\ActivityLogged;
use App\Tests\Assertions\AssertsActivityLogged;
2025-09-24 13:34:19 +02:00
use App\Tests\TestCase;
2024-03-12 22:39:16 -04:00
use App\Tests\Traits\Integration\CreatesTestModels;
use App\Transformers\Api\Application\BaseTransformer;
2025-09-24 13:34:19 +02:00
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Illuminate\Foundation\Testing\DatabaseTruncation;
2024-04-30 00:04:24 +02:00
use Illuminate\Support\Facades\DB;
2025-09-24 13:34:19 +02:00
use Illuminate\Support\Facades\Event;
2018-03-04 16:30:16 -06:00
abstract class IntegrationTestCase extends TestCase
{
use AssertsActivityLogged;
2024-03-12 22:47:32 -04:00
use CreatesTestModels;
use DatabaseTruncation;
protected $seed = true;
2022-05-29 20:39:51 -04:00
protected $defaultHeaders = [
'Accept' => 'application/json',
];
2024-03-19 21:09:16 -04:00
protected function setUp(): void
{
parent::setUp();
Event::fake(ActivityLogged::class);
}
2018-03-04 16:30:16 -06:00
/**
* Return an ISO-8601 formatted timestamp to use in the API response.
*/
protected function formatTimestamp(string $timestamp): string
{
return CarbonImmutable::createFromFormat(CarbonInterface::DEFAULT_TO_STRING_FORMAT, $timestamp)
2018-03-04 16:30:16 -06:00
->setTimezone(BaseTransformer::RESPONSE_TIMEZONE)
->toAtomString();
2018-03-04 16:30:16 -06:00
}
2024-04-30 00:04:24 +02:00
/**
* The database connections that should have transactions.
*
* @return array
*/
protected function connectionsToTransact()
{
return [DB::getDriverName()];
}
2018-03-04 16:30:16 -06:00
}