jonnybarnes.uk/tests/Unit/MediaTest.php
Jonny Barnes d7da42b626
Some checks failed
PHP Unit / PHPUnit test suite (pull_request) Has been cancelled
Laravel Pint / Laravel Pint (pull_request) Has been cancelled
Host images locally
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.
2024-10-25 20:40:52 +01:00

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);
}
}