baseline 7.4 as-is produzione

This commit is contained in:
2026-09-09 14:32:53 +00:00
commit 71ec465d7a
3638 changed files with 859299 additions and 0 deletions
+67
View File
@@ -0,0 +1,67 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Collection;
use Illuminate\Testing\TestResponse;
use Tests\TestCase;
use Tests\UpdatesSettings;
use Vanguard\User;
class ApiTestCase extends TestCase
{
use RefreshDatabase, UpdatesSettings;
const API_GUARD = 'sanctum';
protected function setUp(): void
{
parent::setUp();
$this->artisan('db:seed');
$this->setSettings(['auth.expose_api' => true]);
}
/**
* @return mixed
*/
protected function login()
{
$user = User::factory()->create();
$this->be($user, self::API_GUARD);
return $user;
}
/**
* @return mixed
*/
protected function loginSuperUser()
{
$user = $this->createSuperUser();
$this->be($user, self::API_GUARD);
return $user;
}
/**
* Transform provided collection of items.
* @param Collection $collection
* @param $transformer
* @return array
*/
protected function transformCollection(Collection $collection, $transformer)
{
$transformed = [];
foreach ($collection as $item) {
$transformed[] = $transformer->transform($item);
}
return $transformed;
}
}