We don’t need the complexity of S3. Sepcifically the complexity of managing my own AWS account, flysystem made the Laravel side easy. A command is added to copy the the S3 files over to local storage.
33 lines
733 B
PHP
33 lines
733 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Unit;
|
|
|
|
use App\Models\Media;
|
|
use App\Models\Note;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class MediaTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
/** @test */
|
|
public function getTheNoteThatMediaInstanceBelongsTo(): void
|
|
{
|
|
$media = Media::factory()->for(Note::factory())->create();
|
|
|
|
$this->assertInstanceOf(Note::class, $media->note);
|
|
}
|
|
|
|
/** @test */
|
|
public function absoluteUrlsAreReturnedUnmodified(): void
|
|
{
|
|
$absoluteUrl = 'https://instagram-cdn.com/image/uuid';
|
|
$media = new Media;
|
|
$media->path = $absoluteUrl;
|
|
|
|
$this->assertEquals($absoluteUrl, $media->url);
|
|
}
|
|
}
|