Update Laravel to v12
This commit is contained in:
parent
f2025b801b
commit
1dfa17abca
83 changed files with 1324 additions and 2323 deletions
|
@ -6,13 +6,14 @@ namespace Tests\Unit\Jobs;
|
|||
|
||||
use App\Jobs\AddClientToDatabase;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AddClientToDatabaseJobTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function clientIsAddedToDatabaseByJob(): void
|
||||
{
|
||||
$job = new AddClientToDatabase('https://example.org/client');
|
||||
|
|
|
@ -10,6 +10,7 @@ use GuzzleHttp\Handler\MockHandler;
|
|||
use GuzzleHttp\HandlerStack;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use Illuminate\FileSystem\FileSystem;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use Tests\TestCase;
|
||||
|
||||
class DownloadWebMentionJobTest extends TestCase
|
||||
|
@ -23,7 +24,7 @@ class DownloadWebMentionJobTest extends TestCase
|
|||
parent::tearDown();
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function htmlIsSavedByJob(): void
|
||||
{
|
||||
$this->assertFileDoesNotExist(storage_path('HTML/https'));
|
||||
|
@ -51,7 +52,7 @@ class DownloadWebMentionJobTest extends TestCase
|
|||
$this->assertFileDoesNotExist(storage_path('HTML/https/example.org/reply') . '/1.' . date('Y-m-d') . '.backup');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function htmlAndBackupSavedByJob(): void
|
||||
{
|
||||
$this->assertFileDoesNotExist(storage_path('HTML/https'));
|
||||
|
@ -86,7 +87,7 @@ class DownloadWebMentionJobTest extends TestCase
|
|||
$this->assertFileExists(storage_path('HTML/https/example.org/reply') . '/1.' . date('Y-m-d') . '.backup');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function indexHtmlFileIsSavedByJobForUrlsEndingWithSlash(): void
|
||||
{
|
||||
$this->assertFileDoesNotExist(storage_path('HTML/https'));
|
||||
|
|
|
@ -11,13 +11,14 @@ use App\Models\Bookmark;
|
|||
use App\Services\BookmarkService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Queue;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ProcessBookmarkJobTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function archiveLinkIsSavedByJobAndScreenshotJobIsQueued(): void
|
||||
{
|
||||
Queue::fake();
|
||||
|
@ -38,7 +39,7 @@ class ProcessBookmarkJobTest extends TestCase
|
|||
Queue::assertPushed(SaveScreenshot::class);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function archiveLinkSavedAsNullWhenExceptionThrown(): void
|
||||
{
|
||||
Queue::fake();
|
||||
|
|
|
@ -7,11 +7,12 @@ namespace Tests\Unit\Jobs;
|
|||
use App\Jobs\ProcessMedia;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Intervention\Image\ImageManager;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ProcessMediaJobTest extends TestCase
|
||||
{
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function nonMediaFilesAreNotSaved(): void
|
||||
{
|
||||
$manager = app()->make(ImageManager::class);
|
||||
|
@ -22,7 +23,7 @@ class ProcessMediaJobTest extends TestCase
|
|||
$this->assertFileDoesNotExist(storage_path('app/media/') . 'file.txt');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function smallImagesAreNotResized(): void
|
||||
{
|
||||
$manager = app()->make(ImageManager::class);
|
||||
|
@ -37,7 +38,7 @@ class ProcessMediaJobTest extends TestCase
|
|||
Storage::disk('local')->delete('public/media');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function largeImagesHaveSmallerImagesCreated(): void
|
||||
{
|
||||
$manager = app()->make(ImageManager::class);
|
||||
|
@ -45,16 +46,17 @@ class ProcessMediaJobTest extends TestCase
|
|||
$job = new ProcessMedia('test-image.jpg');
|
||||
$job->handle($manager);
|
||||
|
||||
Storage::disk('local')->assertExists('public/media/test-image.jpg');
|
||||
Storage::disk('local')->assertExists('public/media/test-image-small.jpg');
|
||||
Storage::disk('local')->assertExists('public/media/test-image-medium.jpg');
|
||||
// These need to look in public disk
|
||||
Storage::disk('public')->assertExists('media/test-image.jpg');
|
||||
Storage::disk('public')->assertExists('media/test-image-small.jpg');
|
||||
Storage::disk('public')->assertExists('media/test-image-medium.jpg');
|
||||
|
||||
$this->assertFileDoesNotExist(storage_path('app/media/') . 'test-image.jpg');
|
||||
|
||||
// Tidy up files created by the job
|
||||
Storage::disk('local')->delete('public/media/test-image.jpg');
|
||||
Storage::disk('local')->delete('public/media/test-image-small.jpg');
|
||||
Storage::disk('local')->delete('public/media/test-image-medium.jpg');
|
||||
Storage::disk('public')->delete('media/test-image.jpg');
|
||||
Storage::disk('public')->delete('media/test-image-small.jpg');
|
||||
Storage::disk('public')->delete('media/test-image-medium.jpg');
|
||||
$this->removeDirIfEmpty(storage_path('app/public/media'));
|
||||
$this->removeDirIfEmpty(storage_path('app/media'));
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ use Illuminate\FileSystem\FileSystem;
|
|||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Queue;
|
||||
use Jonnybarnes\WebmentionsParser\Parser;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ProcessWebMentionJobTest extends TestCase
|
||||
|
@ -32,7 +33,7 @@ class ProcessWebMentionJobTest extends TestCase
|
|||
parent::tearDown();
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function failureGettingWebmentionThrowsAnException(): void
|
||||
{
|
||||
$this->expectException(RemoteContentNotFoundException::class);
|
||||
|
@ -51,7 +52,7 @@ class ProcessWebMentionJobTest extends TestCase
|
|||
$job->handle($parser, $client);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function newWebmentionGetsSavedByJob(): void
|
||||
{
|
||||
Queue::fake();
|
||||
|
@ -83,7 +84,7 @@ class ProcessWebMentionJobTest extends TestCase
|
|||
]);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function existingWebmentionGetsUpdatedByJob(): void
|
||||
{
|
||||
Queue::fake();
|
||||
|
@ -120,7 +121,7 @@ class ProcessWebMentionJobTest extends TestCase
|
|||
]);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function webmentionReplyGetsDeletedWhenReplyToValueChanges(): void
|
||||
{
|
||||
$parser = new Parser;
|
||||
|
@ -157,7 +158,7 @@ class ProcessWebMentionJobTest extends TestCase
|
|||
]);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function webmentionLikeGetsDeletedWhenLikeOfValueChanges(): void
|
||||
{
|
||||
$parser = new Parser;
|
||||
|
@ -194,7 +195,7 @@ class ProcessWebMentionJobTest extends TestCase
|
|||
]);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function webmentionRepostGetsDeletedWhenRepostOfValueChanges(): void
|
||||
{
|
||||
$parser = new Parser;
|
||||
|
|
|
@ -11,6 +11,7 @@ use GuzzleHttp\HandlerStack;
|
|||
use GuzzleHttp\Psr7\Response;
|
||||
use Jonnybarnes\WebmentionsParser\Authorship;
|
||||
use Jonnybarnes\WebmentionsParser\Exceptions\AuthorshipParserException;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use Tests\TestCase;
|
||||
|
||||
class SaveProfileImageJobTest extends TestCase
|
||||
|
@ -24,7 +25,7 @@ class SaveProfileImageJobTest extends TestCase
|
|||
parent::tearDown();
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function authorshipAlgorithmReturnsNullOnException(): void
|
||||
{
|
||||
$mf = ['items' => []];
|
||||
|
@ -36,7 +37,7 @@ class SaveProfileImageJobTest extends TestCase
|
|||
$this->assertNull($job->handle($authorship));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function weDoNotProcessTwitterImages(): void
|
||||
{
|
||||
$mf = ['items' => []];
|
||||
|
@ -54,7 +55,7 @@ class SaveProfileImageJobTest extends TestCase
|
|||
$this->assertNull($job->handle($authorship));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function remoteAuthorImagesAreSavedLocally(): void
|
||||
{
|
||||
$mock = new MockHandler([
|
||||
|
@ -79,7 +80,7 @@ class SaveProfileImageJobTest extends TestCase
|
|||
$this->assertFileExists(public_path() . '/assets/profile-images/example.org/image');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function localDefaultAuthorImageIsUsedAsFallback(): void
|
||||
{
|
||||
$mock = new MockHandler([
|
||||
|
@ -107,7 +108,7 @@ class SaveProfileImageJobTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function weGetUrlFromPhotoObjectIfAltTextIsProvided(): void
|
||||
{
|
||||
$mock = new MockHandler([
|
||||
|
@ -135,7 +136,7 @@ class SaveProfileImageJobTest extends TestCase
|
|||
$this->assertFileExists(public_path() . '/assets/profile-images/example.org/image');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function useFirstUrlIfMultipleHomepagesAreProvided(): void
|
||||
{
|
||||
$mock = new MockHandler([
|
||||
|
|
|
@ -13,13 +13,14 @@ use GuzzleHttp\Middleware;
|
|||
use GuzzleHttp\Psr7\Response;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use Tests\TestCase;
|
||||
|
||||
class SaveScreenshotJobTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function screenshotIsSavedByJob(): void
|
||||
{
|
||||
Storage::fake('public');
|
||||
|
@ -84,7 +85,7 @@ class SaveScreenshotJobTest extends TestCase
|
|||
Storage::disk('public')->assertExists('/assets/img/bookmarks/' . $bookmark->screenshot . '.png');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function screenshotJobHandlesUnfinishedTasks(): void
|
||||
{
|
||||
Storage::fake('public');
|
||||
|
|
|
@ -10,11 +10,12 @@ use GuzzleHttp\Client;
|
|||
use GuzzleHttp\Handler\MockHandler;
|
||||
use GuzzleHttp\HandlerStack;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use Tests\TestCase;
|
||||
|
||||
class SendWebMentionJobTest extends TestCase
|
||||
{
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function discoverWebmentionEndpointOnOwnDomain(): void
|
||||
{
|
||||
$note = new Note;
|
||||
|
@ -23,7 +24,7 @@ class SendWebMentionJobTest extends TestCase
|
|||
$this->assertNull($job->discoverWebmentionEndpoint('/notes/tagged/test'));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function discoverWebmentionEndpointFromHeaderLinks(): void
|
||||
{
|
||||
$url = 'https://example.org/webmention';
|
||||
|
@ -38,7 +39,7 @@ class SendWebMentionJobTest extends TestCase
|
|||
$this->assertEquals($url, $job->discoverWebmentionEndpoint('https://example.org'));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function discoverWebmentionEndpointFromHtmlLinkTags(): void
|
||||
{
|
||||
$html = '<link rel="webmention" href="https://example.org/webmention">';
|
||||
|
@ -56,7 +57,7 @@ class SendWebMentionJobTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function discoverWebmentionEndpointFromLegacyHtmlMarkup(): void
|
||||
{
|
||||
$html = '<link rel="http://webmention.org/" href="https://example.org/webmention">';
|
||||
|
@ -74,14 +75,14 @@ class SendWebMentionJobTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function ensureEmptyNoteDoesNotTriggerAnyActions(): void
|
||||
{
|
||||
$job = new SendWebMentions(new Note);
|
||||
$this->assertNull($job->handle());
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function weResolveRelativeUris(): void
|
||||
{
|
||||
$uri = '/blog/post';
|
||||
|
@ -90,7 +91,7 @@ class SendWebMentionJobTest extends TestCase
|
|||
$this->assertEquals('https://example.org/blog/post', $job->resolveUri($uri, $base));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function weSendAWebmentionForANote(): void
|
||||
{
|
||||
$html = '<link rel="http://webmention.org/" href="https://example.org/webmention">';
|
||||
|
@ -110,7 +111,7 @@ class SendWebMentionJobTest extends TestCase
|
|||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function linksInNotesCanNotSupportWebmentions(): void
|
||||
{
|
||||
$mock = new MockHandler([
|
||||
|
|
|
@ -11,13 +11,14 @@ use GuzzleHttp\HandlerStack;
|
|||
use GuzzleHttp\Middleware;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use Tests\TestCase;
|
||||
|
||||
class SyndicateNoteToBlueskyJobTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function weSyndicateNotesToBluesky(): void
|
||||
{
|
||||
config(['bridgy.bluesky_token' => 'test']);
|
||||
|
@ -38,7 +39,7 @@ class SyndicateNoteToBlueskyJobTest extends TestCase
|
|||
]);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function weSyndicateTheOriginalMarkdownToBluesky(): void
|
||||
{
|
||||
config(['bridgy.bluesky_token' => 'test']);
|
||||
|
|
|
@ -11,13 +11,14 @@ use GuzzleHttp\HandlerStack;
|
|||
use GuzzleHttp\Middleware;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use Tests\TestCase;
|
||||
|
||||
class SyndicateNoteToMastodonJobTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function weSyndicateNotesToMastodon(): void
|
||||
{
|
||||
config(['bridgy.mastodon_token' => 'test']);
|
||||
|
@ -38,7 +39,7 @@ class SyndicateNoteToMastodonJobTest extends TestCase
|
|||
]);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function weSyndicateTheOriginalMarkdown(): void
|
||||
{
|
||||
config(['bridgy.mastodon_token' => 'test']);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue