From 7a58287b34c7ae6026c93690b646040eb1ecfa84 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Sun, 6 Apr 2025 17:22:36 +0100 Subject: [PATCH 1/2] Remove references to short domain --- .../Controllers/Admin/PasskeysController.php | 10 +- app/Http/Controllers/FeedsController.php | 12 +- app/Http/Controllers/ShortURLsController.php | 55 --- app/Jobs/ProcessWebMention.php | 8 +- app/Jobs/SendWebMentions.php | 4 +- app/Models/Bookmark.php | 2 +- app/Models/Note.php | 9 +- app/Models/Place.php | 16 +- app/Services/Micropub/HCardService.php | 2 +- app/Services/Micropub/HEntryService.php | 8 +- config/url.php | 32 -- resources/views/articles/rss.blade.php | 2 +- resources/views/bookmarks/index.blade.php | 6 +- resources/views/bookmarks/tagged.blade.php | 6 +- resources/views/notes/atom.blade.php | 4 +- resources/views/notes/rss.blade.php | 6 +- resources/views/templates/note.blade.php | 2 +- routes/web.php | 336 +++++++++--------- tests/Feature/FeedsTest.php | 4 +- tests/Feature/MicropubControllerTest.php | 12 +- tests/Feature/NotesControllerTest.php | 4 +- tests/Feature/PlacesTest.php | 2 +- tests/Feature/ShortURLsControllerTest.php | 39 -- tests/Feature/WebMentionsControllerTest.php | 2 +- tests/Unit/Jobs/ProcessWebMentionJobTest.php | 6 +- tests/Unit/NotesTest.php | 12 +- tests/Unit/PlacesTest.php | 18 - 27 files changed, 215 insertions(+), 404 deletions(-) delete mode 100644 app/Http/Controllers/ShortURLsController.php delete mode 100644 config/url.php delete mode 100644 tests/Feature/ShortURLsControllerTest.php diff --git a/app/Http/Controllers/Admin/PasskeysController.php b/app/Http/Controllers/Admin/PasskeysController.php index 8325a59e..b9a67f64 100644 --- a/app/Http/Controllers/Admin/PasskeysController.php +++ b/app/Http/Controllers/Admin/PasskeysController.php @@ -60,7 +60,7 @@ class PasskeysController extends Controller // RP Entity i.e. the application $rpEntity = PublicKeyCredentialRpEntity::create( config('app.name'), - config('url.longurl'), + config('app.url'), ); // User Entity @@ -148,7 +148,7 @@ class PasskeysController extends Controller ); $securedRelyingPartyId = []; if (App::environment('local', 'development')) { - $securedRelyingPartyId = [config('url.longurl')]; + $securedRelyingPartyId = [config('app.url')]; } $ceremonyStepManagerFactory->setSecuredRelyingPartyId($securedRelyingPartyId); @@ -165,7 +165,7 @@ class PasskeysController extends Controller $publicKeyCredentialSource = $authenticatorAttestationResponseValidator->check( authenticatorAttestationResponse: $publicKeyCredential->response, publicKeyCredentialCreationOptions: $publicKeyCredentialCreationOptions, - request: config('url.longurl'), + request: config('app.url'), securedRelyingPartyId: $securedRelyingPartyId, ); @@ -258,7 +258,7 @@ class PasskeysController extends Controller ); $securedRelyingPartyId = []; if (App::environment('local', 'development')) { - $securedRelyingPartyId = [config('url.longurl')]; + $securedRelyingPartyId = [config('app.url')]; } $ceremonyStepManagerFactory->setSecuredRelyingPartyId($securedRelyingPartyId); @@ -277,7 +277,7 @@ class PasskeysController extends Controller credentialId: $publicKeyCredentialSource, authenticatorAssertionResponse: $publicKeyCredential->response, publicKeyCredentialRequestOptions: $publicKeyCredentialRequestOptions, - request: config('url.longurl'), + request: config('app.url'), userHandle: null, securedRelyingPartyId: $securedRelyingPartyId, ); diff --git a/app/Http/Controllers/FeedsController.php b/app/Http/Controllers/FeedsController.php index 4e887105..bf74dadf 100644 --- a/app/Http/Controllers/FeedsController.php +++ b/app/Http/Controllers/FeedsController.php @@ -122,8 +122,8 @@ class FeedsController extends Controller foreach ($notes as $key => $note) { $data['items'][$key] = [ - 'id' => $note->longurl, - 'url' => $note->longurl, + 'id' => $note->uri, + 'url' => $note->uri, 'content_text' => $note->content, 'date_published' => $note->created_at->tz('UTC')->toRfc3339String(), 'date_modified' => $note->updated_at->tz('UTC')->toRfc3339String(), @@ -164,7 +164,7 @@ class FeedsController extends Controller 'author' => [ 'type' => 'card', 'name' => config('user.display_name'), - 'url' => config('url.longurl'), + 'url' => config('app.url'), ], 'children' => $items, ], 200, [ @@ -183,8 +183,8 @@ class FeedsController extends Controller $items[] = [ 'type' => 'entry', 'published' => $note->created_at, - 'uid' => $note->longurl, - 'url' => $note->longurl, + 'uid' => $note->uri, + 'url' => $note->uri, 'content' => [ 'text' => $note->getRawOriginal('note'), 'html' => $note->note, @@ -200,7 +200,7 @@ class FeedsController extends Controller 'author' => [ 'type' => 'card', 'name' => config('user.display_name'), - 'url' => config('url.longurl'), + 'url' => config('app.url'), ], 'children' => $items, ], 200, [ diff --git a/app/Http/Controllers/ShortURLsController.php b/app/Http/Controllers/ShortURLsController.php deleted file mode 100644 index a232fcdb..00000000 --- a/app/Http/Controllers/ShortURLsController.php +++ /dev/null @@ -1,55 +0,0 @@ -type === 'in-reply-to') { - if ($parser->checkInReplyTo($microformats, $this->note->longurl) === false) { + if ($parser->checkInReplyTo($microformats, $this->note->uri) === false) { // it doesn’t so delete $webmention->delete(); @@ -67,7 +67,7 @@ class ProcessWebMention implements ShouldQueue return; } if ($webmention->type === 'like-of') { - if ($parser->checkLikeOf($microformats, $this->note->longurl) === false) { + if ($parser->checkLikeOf($microformats, $this->note->uri) === false) { // it doesn’t so delete $webmention->delete(); @@ -75,7 +75,7 @@ class ProcessWebMention implements ShouldQueue } // note we don’t need to do anything if it still is a like } if ($webmention->type === 'repost-of') { - if ($parser->checkRepostOf($microformats, $this->note->longurl) === false) { + if ($parser->checkRepostOf($microformats, $this->note->uri) === false) { // it doesn’t so delete $webmention->delete(); @@ -89,7 +89,7 @@ class ProcessWebMention implements ShouldQueue $type = $parser->getMentionType($microformats); // throw error here? dispatch(new SaveProfileImage($microformats)); $webmention->source = $this->source; - $webmention->target = $this->note->longurl; + $webmention->target = $this->note->uri; $webmention->commentable_id = $this->note->id; $webmention->commentable_type = Note::class; $webmention->type = $type; diff --git a/app/Jobs/SendWebMentions.php b/app/Jobs/SendWebMentions.php index 51e5f162..2ff5f2c6 100644 --- a/app/Jobs/SendWebMentions.php +++ b/app/Jobs/SendWebMentions.php @@ -45,7 +45,7 @@ class SendWebMentions implements ShouldQueue $guzzle = resolve(Client::class); $guzzle->post($endpoint, [ 'form_params' => [ - 'source' => $this->note->longurl, + 'source' => $this->note->uri, 'target' => $url, ], ]); @@ -61,7 +61,7 @@ class SendWebMentions implements ShouldQueue public function discoverWebmentionEndpoint(string $url): ?string { // let’s not send webmentions to myself - if (parse_url($url, PHP_URL_HOST) === config('url.longurl')) { + if (parse_url($url, PHP_URL_HOST) === parse_url(config('app.url'), PHP_URL_HOST)) { return null; } if (Str::startsWith($url, '/notes/tagged/')) { diff --git a/app/Models/Bookmark.php b/app/Models/Bookmark.php index 29bd25ad..37027e40 100644 --- a/app/Models/Bookmark.php +++ b/app/Models/Bookmark.php @@ -26,7 +26,7 @@ class Bookmark extends Model return $this->belongsToMany('App\Models\Tag'); } - protected function longurl(): Attribute + protected function local_uri(): Attribute { return Attribute::get( get: fn () => config('app.url') . '/bookmarks/' . $this->id, diff --git a/app/Models/Note.php b/app/Models/Note.php index 62b9fcea..74533443 100644 --- a/app/Models/Note.php +++ b/app/Models/Note.php @@ -124,7 +124,7 @@ class Note extends Model public function getNoteAttribute(?string $value): ?string { if ($value === null && $this->place !== null) { - $value = '📍: ' . $this->place->name . ''; + $value = '📍: ' . $this->place->name . ''; } // if $value is still null, just return null @@ -172,16 +172,11 @@ class Note extends Model return (string) resolve(Numbers::class)->numto60($this->id); } - public function getLongurlAttribute(): string + public function getUriAttribute(): string { return config('app.url') . '/notes/' . $this->nb60id; } - public function getShorturlAttribute(): string - { - return config('url.shorturl') . '/notes/' . $this->nb60id; - } - public function getIso8601Attribute(): string { return $this->updated_at->toISO8601String(); diff --git a/app/Models/Place.php b/app/Models/Place.php index 62c826ad..550f234d 100644 --- a/app/Models/Place.php +++ b/app/Models/Place.php @@ -74,24 +74,10 @@ class Place extends Model ])); } - protected function longurl(): Attribute - { - return Attribute::get( - get: fn ($value, $attributes) => config('app.url') . '/places/' . $attributes['slug'], - ); - } - - protected function shorturl(): Attribute - { - return Attribute::get( - get: fn ($value, $attributes) => config('url.shorturl') . '/places/' . $attributes['slug'], - ); - } - protected function uri(): Attribute { return Attribute::get( - get: fn () => $this->longurl, + get: static fn ($value, $attributes) => config('app.url') . '/places/' . $attributes['slug'], ); } diff --git a/app/Services/Micropub/HCardService.php b/app/Services/Micropub/HCardService.php index 7ab57a4e..ead22a5b 100644 --- a/app/Services/Micropub/HCardService.php +++ b/app/Services/Micropub/HCardService.php @@ -27,6 +27,6 @@ class HCardService $data['longitude'] = Arr::get($request, 'longitude'); } - return resolve(PlaceService::class)->createPlace($data)->longurl; + return resolve(PlaceService::class)->createPlace($data)->uri; } } diff --git a/app/Services/Micropub/HEntryService.php b/app/Services/Micropub/HEntryService.php index 807e6327..5f19156c 100644 --- a/app/Services/Micropub/HEntryService.php +++ b/app/Services/Micropub/HEntryService.php @@ -18,17 +18,17 @@ class HEntryService public function process(array $request, ?string $client = null): ?string { if (Arr::get($request, 'properties.like-of') || Arr::get($request, 'like-of')) { - return resolve(LikeService::class)->create($request)->longurl; + return resolve(LikeService::class)->create($request)->url; } if (Arr::get($request, 'properties.bookmark-of') || Arr::get($request, 'bookmark-of')) { - return resolve(BookmarkService::class)->create($request)->longurl; + return resolve(BookmarkService::class)->create($request)->uri; } if (Arr::get($request, 'properties.name') || Arr::get($request, 'name')) { - return resolve(ArticleService::class)->create($request)->longurl; + return resolve(ArticleService::class)->create($request)->link; } - return resolve(NoteService::class)->create($request, $client)->longurl; + return resolve(NoteService::class)->create($request, $client)->uri; } } diff --git a/config/url.php b/config/url.php deleted file mode 100644 index dfdffe6b..00000000 --- a/config/url.php +++ /dev/null @@ -1,32 +0,0 @@ - env('APP_LONGURL', 'longurl.local'), - - /* - |-------------------------------------------------------------------------- - | Application Short URL - |-------------------------------------------------------------------------- - | - | The short URL for the application - | - */ - - 'shorturl' => env('APP_SHORTURL', 'shorturl.local'), - -]; diff --git a/resources/views/articles/rss.blade.php b/resources/views/articles/rss.blade.php index 1f5f13d6..00268681 100644 --- a/resources/views/articles/rss.blade.php +++ b/resources/views/articles/rss.blade.php @@ -3,7 +3,7 @@ {{ config('user.display_name') }} - An RSS feed of the blog posts found on {{ config('url.longurl') }} + An RSS feed of the blog posts found on {{ config('app.url') }} {{ config('app.url') }}/blog {{ $buildDate }} 1800 diff --git a/resources/views/bookmarks/index.blade.php b/resources/views/bookmarks/index.blade.php index d489d273..886b940d 100644 --- a/resources/views/bookmarks/index.blade.php +++ b/resources/views/bookmarks/index.blade.php @@ -7,15 +7,15 @@ @foreach($bookmarks as $bookmark)
@isset($bookmark->content)

{{ $bookmark->content }}

diff --git a/resources/views/bookmarks/tagged.blade.php b/resources/views/bookmarks/tagged.blade.php index 4e7b59ea..d18fdf60 100644 --- a/resources/views/bookmarks/tagged.blade.php +++ b/resources/views/bookmarks/tagged.blade.php @@ -8,15 +8,15 @@ @foreach($bookmarks as $bookmark)
@isset($bookmark->content)

{{ $bookmark->content }}

diff --git a/resources/views/notes/atom.blade.php b/resources/views/notes/atom.blade.php index bcb60147..c84a4a93 100644 --- a/resources/views/notes/atom.blade.php +++ b/resources/views/notes/atom.blade.php @@ -8,8 +8,8 @@ @foreach($notes as $note) {{ strip_tags($note->note) }} - - {{ $note->longurl }} + + {{ $note->uri }} {{ $note->updated_at->toAtomString() }} {{ $note->note }} diff --git a/resources/views/notes/rss.blade.php b/resources/views/notes/rss.blade.php index 7d1b35d5..9146ebe0 100644 --- a/resources/views/notes/rss.blade.php +++ b/resources/views/notes/rss.blade.php @@ -3,7 +3,7 @@ {{ config('user.display_name') }} - An RSS feed of the notes found on {{ config('url.longurl') }} + An RSS feed of the notes found on {{ config('app.url') }} {{ config('app.url') }}/notes {{ $buildDate }} 1800 @@ -16,8 +16,8 @@ {!! $note->note !!} ]]> - {{ $note->longurl }} - {{ $note->longurl}} + {{ $note->uri }} + {{ $note->uri}} {{ $note->pubdate }} @endforeach diff --git a/resources/views/templates/note.blade.php b/resources/views/templates/note.blade.php index fb4bb58f..3a1bd11c 100644 --- a/resources/views/templates/note.blade.php +++ b/resources/views/templates/note.blade.php @@ -34,7 +34,7 @@ @if($note->client) via {{ $note->client->client_name }}@endif @if($note->place) @if($note->getOriginal('note')) - in {{ $note->address }} + in {{ $note->address }} @endif @elseif($note->address) in {!! $note->address !!} diff --git a/routes/web.php b/routes/web.php index 5c8e989d..21f5848e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -23,7 +23,6 @@ use App\Http\Controllers\MicropubMediaController; use App\Http\Controllers\NotesController; use App\Http\Controllers\PlacesController; use App\Http\Controllers\SearchController; -use App\Http\Controllers\ShortURLsController; use App\Http\Controllers\WebMentionsController; use App\Http\Middleware\CorsHeaders; use App\Http\Middleware\MyAuthMiddleware; @@ -41,201 +40,184 @@ use Illuminate\Support\Facades\Route; | */ -Route::domain(config('url.longurl'))->group(function () { - Route::get('/', [FrontPageController::class, 'index']); +Route::get('/', [FrontPageController::class, 'index']); - // Static project page - Route::view('projects', 'projects'); +// Static project page +Route::view('projects', 'projects'); - // Static colophon page - Route::view('colophon', 'colophon'); +// Static colophon page +Route::view('colophon', 'colophon'); - // The login routes to get auth’d for admin - Route::get('login', [AuthController::class, 'showLogin'])->name('login'); - Route::post('login', [AuthController::class, 'login']); - Route::get('login/passkey', [PasskeysController::class, 'getRequestOptions']); - Route::post('login/passkey', [PasskeysController::class, 'login']); +// The login routes to get auth’d for admin +Route::get('login', [AuthController::class, 'showLogin'])->name('login'); +Route::post('login', [AuthController::class, 'login']); +Route::get('login/passkey', [PasskeysController::class, 'getRequestOptions']); +Route::post('login/passkey', [PasskeysController::class, 'login']); - // And the logout routes - Route::get('logout', [AuthController::class, 'showLogout'])->name('logout'); - Route::post('logout', [AuthController::class, 'logout']); +// And the logout routes +Route::get('logout', [AuthController::class, 'showLogout'])->name('logout'); +Route::post('logout', [AuthController::class, 'logout']); - // Admin pages grouped for filter - Route::middleware(MyAuthMiddleware::class)->prefix('admin')->group(function () { - Route::get('/', [HomeController::class, 'welcome']); +// Admin pages grouped for filter +Route::middleware(MyAuthMiddleware::class)->prefix('admin')->group(function () { + Route::get('/', [HomeController::class, 'welcome']); - // Articles - Route::prefix('blog')->group(function () { - Route::get('/', [AdminArticlesController::class, 'index']); - Route::get('/create', [AdminArticlesController::class, 'create']); - Route::post('/', [AdminArticlesController::class, 'store']); - Route::get('/{article}/edit', [AdminArticlesController::class, 'edit']); - Route::put('/{id}', [AdminArticlesController::class, 'update']); - Route::delete('/{id}', [AdminArticlesController::class, 'destroy']); - }); - - // Notes - Route::prefix('notes')->group(function () { - Route::get('/', [AdminNotesController::class, 'index']); - Route::get('/create', [AdminNotesController::class, 'create']); - Route::post('/', [AdminNotesController::class, 'store']); - Route::get('/{id}/edit', [AdminNotesController::class, 'edit']); - Route::put('/{id}', [AdminNotesController::class, 'update']); - Route::delete('/{id}', [AdminNotesController::class, 'destroy']); - }); - - // Micropub Clients - Route::prefix('clients')->group(function () { - Route::get('/', [ClientsController::class, 'index']); - Route::get('/create', [ClientsController::class, 'create']); - Route::post('/', [ClientsController::class, 'store']); - Route::get('/{id}/edit', [ClientsController::class, 'edit']); - Route::put('/{id}', [ClientsController::class, 'update']); - Route::delete('/{id}', [ClientsController::class, 'destroy']); - }); - - // Contacts - Route::prefix('contacts')->group(function () { - Route::get('/', [AdminContactsController::class, 'index']); - Route::get('/create', [AdminContactsController::class, 'create']); - Route::post('/', [AdminContactsController::class, 'store']); - Route::get('/{id}/edit', [AdminContactsController::class, 'edit']); - Route::put('/{id}', [AdminContactsController::class, 'update']); - Route::delete('/{id}', [AdminContactsController::class, 'destroy']); - Route::get('/{id}/getavatar', [AdminContactsController::class, 'getAvatar']); - }); - - // Places - Route::prefix('places')->group(function () { - Route::get('/', [AdminPlacesController::class, 'index']); - Route::get('/create', [AdminPlacesController::class, 'create']); - Route::post('/', [AdminPlacesController::class, 'store']); - Route::get('/{id}/edit', [AdminPlacesController::class, 'edit']); - Route::put('/{id}', [AdminPlacesController::class, 'update']); - Route::get('/{id}/merge', [AdminPlacesController::class, 'mergeIndex']); - Route::get('/{place1_id}/merge/{place2_id}', [AdminPlacesController::class, 'mergeEdit']); - Route::post('/merge', [AdminPlacesController::class, 'mergeStore']); - Route::delete('/{id}', [AdminPlacesController::class, 'destroy']); - }); - - // Likes - Route::prefix('likes')->group(function () { - Route::get('/', [AdminLikesController::class, 'index']); - Route::get('/create', [AdminLikesController::class, 'create']); - Route::post('/', [AdminLikesController::class, 'store']); - Route::get('/{id}/edit', [AdminLikesController::class, 'edit']); - Route::put('/{id}', [AdminLikesController::class, 'update']); - Route::delete('/{id}', [AdminLikesController::class, 'destroy']); - }); - - // Syndication Targets - Route::prefix('syndication')->group(function () { - Route::get('/', [SyndicationTargetsController::class, 'index']); - Route::get('/create', [SyndicationTargetsController::class, 'create']); - Route::post('/', [SyndicationTargetsController::class, 'store']); - Route::get('/{syndicationTarget}/edit', [SyndicationTargetsController::class, 'edit']); - Route::put('/{syndicationTarget}', [SyndicationTargetsController::class, 'update']); - Route::delete('/{syndicationTarget}', [SyndicationTargetsController::class, 'destroy']); - }); - - // Bio - Route::prefix('bio')->group(function () { - Route::get('/', [BioController::class, 'show'])->name('admin.bio.show'); - Route::put('/', [BioController::class, 'update']); - }); - - // Passkeys - Route::prefix('passkeys')->group(function () { - Route::get('/', [PasskeysController::class, 'index']); - Route::get('register', [PasskeysController::class, 'getCreateOptions']); - Route::post('register', [PasskeysController::class, 'create']); - }); - }); - - // Blog pages using ArticlesController + // Articles Route::prefix('blog')->group(function () { - Route::get('/feed.rss', [FeedsController::class, 'blogRss']); - Route::get('/feed.atom', [FeedsController::class, 'blogAtom']); - Route::get('/feed.json', [FeedsController::class, 'blogJson']); - Route::get('/feed.jf2', [FeedsController::class, 'blogJf2']); - Route::get('/s/{id}', [ArticlesController::class, 'onlyIdInURL']); - Route::get('/{year?}/{month?}', [ArticlesController::class, 'index'])->where(['year' => '[0-9]{4}', 'month' => '[0-9]{2}']); - Route::get('/{year}/{month}/{slug}', [ArticlesController::class, 'show'])->where(['year' => '[0-9]{4}', 'month' => '[0-9]{2}']); + Route::get('/', [AdminArticlesController::class, 'index']); + Route::get('/create', [AdminArticlesController::class, 'create']); + Route::post('/', [AdminArticlesController::class, 'store']); + Route::get('/{article}/edit', [AdminArticlesController::class, 'edit']); + Route::put('/{id}', [AdminArticlesController::class, 'update']); + Route::delete('/{id}', [AdminArticlesController::class, 'destroy']); }); - // Notes pages using NotesController + // Notes Route::prefix('notes')->group(function () { - Route::get('/', [NotesController::class, 'index']); - Route::get('/feed.rss', [FeedsController::class, 'notesRss']); - Route::get('/feed.atom', [FeedsController::class, 'notesAtom']); - Route::get('/feed.json', [FeedsController::class, 'notesJson']); - Route::get('/feed.jf2', [FeedsController::class, 'notesJf2']); - Route::get('/new', [NotesController::class, 'create']); - Route::get('/{id}', [NotesController::class, 'show']); - Route::get('/tagged/{tag}', [NotesController::class, 'tagged']); + Route::get('/', [AdminNotesController::class, 'index']); + Route::get('/create', [AdminNotesController::class, 'create']); + Route::post('/', [AdminNotesController::class, 'store']); + Route::get('/{id}/edit', [AdminNotesController::class, 'edit']); + Route::put('/{id}', [AdminNotesController::class, 'update']); + Route::delete('/{id}', [AdminNotesController::class, 'destroy']); + }); + + // Micropub Clients + Route::prefix('clients')->group(function () { + Route::get('/', [ClientsController::class, 'index']); + Route::get('/create', [ClientsController::class, 'create']); + Route::post('/', [ClientsController::class, 'store']); + Route::get('/{id}/edit', [ClientsController::class, 'edit']); + Route::put('/{id}', [ClientsController::class, 'update']); + Route::delete('/{id}', [ClientsController::class, 'destroy']); + }); + + // Contacts + Route::prefix('contacts')->group(function () { + Route::get('/', [AdminContactsController::class, 'index']); + Route::get('/create', [AdminContactsController::class, 'create']); + Route::post('/', [AdminContactsController::class, 'store']); + Route::get('/{id}/edit', [AdminContactsController::class, 'edit']); + Route::put('/{id}', [AdminContactsController::class, 'update']); + Route::delete('/{id}', [AdminContactsController::class, 'destroy']); + Route::get('/{id}/getavatar', [AdminContactsController::class, 'getAvatar']); + }); + + // Places + Route::prefix('places')->group(function () { + Route::get('/', [AdminPlacesController::class, 'index']); + Route::get('/create', [AdminPlacesController::class, 'create']); + Route::post('/', [AdminPlacesController::class, 'store']); + Route::get('/{id}/edit', [AdminPlacesController::class, 'edit']); + Route::put('/{id}', [AdminPlacesController::class, 'update']); + Route::get('/{id}/merge', [AdminPlacesController::class, 'mergeIndex']); + Route::get('/{place1_id}/merge/{place2_id}', [AdminPlacesController::class, 'mergeEdit']); + Route::post('/merge', [AdminPlacesController::class, 'mergeStore']); + Route::delete('/{id}', [AdminPlacesController::class, 'destroy']); }); - Route::get('note/{id}', [NotesController::class, 'redirect']); // for legacy note URLs // Likes Route::prefix('likes')->group(function () { - Route::get('/', [LikesController::class, 'index']); - Route::get('/{like}', [LikesController::class, 'show']); + Route::get('/', [AdminLikesController::class, 'index']); + Route::get('/create', [AdminLikesController::class, 'create']); + Route::post('/', [AdminLikesController::class, 'store']); + Route::get('/{id}/edit', [AdminLikesController::class, 'edit']); + Route::put('/{id}', [AdminLikesController::class, 'update']); + Route::delete('/{id}', [AdminLikesController::class, 'destroy']); }); - // Bookmarks - Route::prefix('bookmarks')->group(function () { - Route::get('/', [BookmarksController::class, 'index']); - Route::redirect('/tagged', '/bookmarks'); - Route::get('/{bookmark}', [BookmarksController::class, 'show']); - Route::get('/tagged/{tag}', [BookmarksController::class, 'tagged']); + // Syndication Targets + Route::prefix('syndication')->group(function () { + Route::get('/', [SyndicationTargetsController::class, 'index']); + Route::get('/create', [SyndicationTargetsController::class, 'create']); + Route::post('/', [SyndicationTargetsController::class, 'store']); + Route::get('/{syndicationTarget}/edit', [SyndicationTargetsController::class, 'edit']); + Route::put('/{syndicationTarget}', [SyndicationTargetsController::class, 'update']); + Route::delete('/{syndicationTarget}', [SyndicationTargetsController::class, 'destroy']); }); - // IndieAuth - Route::get('.well-known/indieauth-server', [IndieAuthController::class, 'indieAuthMetadataEndpoint'])->name('indieauth.metadata'); - Route::get('auth', [IndieAuthController::class, 'start'])->middleware(MyAuthMiddleware::class)->name('indieauth.start'); - Route::post('auth/confirm', [IndieAuthController::class, 'confirm'])->middleware(MyAuthMiddleware::class); - Route::post('auth', [IndieAuthController::class, 'processCodeExchange']); - Route::post('token', [IndieAuthController::class, 'processTokenRequest'])->name('indieauth.token'); + // Bio + Route::prefix('bio')->group(function () { + Route::get('/', [BioController::class, 'show'])->name('admin.bio.show'); + Route::put('/', [BioController::class, 'update']); + }); - // Micropub Endpoints - Route::get('api/post', [MicropubController::class, 'get'])->middleware(VerifyMicropubToken::class); - Route::post('api/post', [MicropubController::class, 'post'])->middleware(VerifyMicropubToken::class)->name('micropub-endpoint'); - Route::get('api/media', [MicropubMediaController::class, 'getHandler'])->middleware(VerifyMicropubToken::class); - Route::post('api/media', [MicropubMediaController::class, 'media']) - ->middleware([VerifyMicropubToken::class, CorsHeaders::class]) - ->name('media-endpoint'); - Route::options('/api/media', [MicropubMediaController::class, 'mediaOptionsResponse'])->middleware(CorsHeaders::class); - - // Webmention - Route::get('webmention', [WebMentionsController::class, 'get'])->name('webmention-endpoint'); - Route::post('webmention', [WebMentionsController::class, 'receive']); - - // Contacts - Route::get('contacts', [ContactsController::class, 'index']); - Route::get('contacts/{contact:nick}', [ContactsController::class, 'show']); - - // Places - Route::get('places', [PlacesController::class, 'index']); - Route::get('places/{place}', [PlacesController::class, 'show']); - - // Micropub - Route::redirect('/micropub/create', '/notes/new'); - - // Search - Route::get('search', [SearchController::class, 'search']); + // Passkeys + Route::prefix('passkeys')->group(function () { + Route::get('/', [PasskeysController::class, 'index']); + Route::get('register', [PasskeysController::class, 'getCreateOptions']); + Route::post('register', [PasskeysController::class, 'create']); + }); }); -// Short URL -Route::domain(config('url.shorturl'))->group(function () { - Route::get('/', [ShortURLsController::class, 'baseURL']); - Route::get('@', [ShortURLsController::class, 'twitter']); - - Route::get('{type}/{id}', [ShortURLsController::class, 'expandType'])->where( - [ - 'type' => '[bt]', - 'id' => '[0-9A-HJ-NP-Z_a-km-z]+', - ] - ); - - Route::get('h/{id}', [ShortURLsController::class, 'redirect']); +// Blog pages using ArticlesController +Route::prefix('blog')->group(function () { + Route::get('/feed.rss', [FeedsController::class, 'blogRss']); + Route::get('/feed.atom', [FeedsController::class, 'blogAtom']); + Route::get('/feed.json', [FeedsController::class, 'blogJson']); + Route::get('/feed.jf2', [FeedsController::class, 'blogJf2']); + Route::get('/s/{id}', [ArticlesController::class, 'onlyIdInURL']); + Route::get('/{year?}/{month?}', [ArticlesController::class, 'index'])->where(['year' => '[0-9]{4}', 'month' => '[0-9]{2}']); + Route::get('/{year}/{month}/{slug}', [ArticlesController::class, 'show'])->where(['year' => '[0-9]{4}', 'month' => '[0-9]{2}']); }); + +// Notes pages using NotesController +Route::prefix('notes')->group(function () { + Route::get('/', [NotesController::class, 'index']); + Route::get('/feed.rss', [FeedsController::class, 'notesRss']); + Route::get('/feed.atom', [FeedsController::class, 'notesAtom']); + Route::get('/feed.json', [FeedsController::class, 'notesJson']); + Route::get('/feed.jf2', [FeedsController::class, 'notesJf2']); + Route::get('/new', [NotesController::class, 'create']); + Route::get('/{id}', [NotesController::class, 'show']); + Route::get('/tagged/{tag}', [NotesController::class, 'tagged']); +}); +Route::get('note/{id}', [NotesController::class, 'redirect']); // for legacy note URLs + +// Likes +Route::prefix('likes')->group(function () { + Route::get('/', [LikesController::class, 'index']); + Route::get('/{like}', [LikesController::class, 'show']); +}); + +// Bookmarks +Route::prefix('bookmarks')->group(function () { + Route::get('/', [BookmarksController::class, 'index']); + Route::redirect('/tagged', '/bookmarks'); + Route::get('/{bookmark}', [BookmarksController::class, 'show']); + Route::get('/tagged/{tag}', [BookmarksController::class, 'tagged']); +}); + +// IndieAuth +Route::get('.well-known/indieauth-server', [IndieAuthController::class, 'indieAuthMetadataEndpoint'])->name('indieauth.metadata'); +Route::get('auth', [IndieAuthController::class, 'start'])->middleware(MyAuthMiddleware::class)->name('indieauth.start'); +Route::post('auth/confirm', [IndieAuthController::class, 'confirm'])->middleware(MyAuthMiddleware::class); +Route::post('auth', [IndieAuthController::class, 'processCodeExchange']); +Route::post('token', [IndieAuthController::class, 'processTokenRequest'])->name('indieauth.token'); + +// Micropub Endpoints +Route::get('api/post', [MicropubController::class, 'get'])->middleware(VerifyMicropubToken::class); +Route::post('api/post', [MicropubController::class, 'post'])->middleware(VerifyMicropubToken::class)->name('micropub-endpoint'); +Route::get('api/media', [MicropubMediaController::class, 'getHandler'])->middleware(VerifyMicropubToken::class); +Route::post('api/media', [MicropubMediaController::class, 'media']) + ->middleware([VerifyMicropubToken::class, CorsHeaders::class]) + ->name('media-endpoint'); +Route::options('/api/media', [MicropubMediaController::class, 'mediaOptionsResponse'])->middleware(CorsHeaders::class); + +// Webmention +Route::get('webmention', [WebMentionsController::class, 'get'])->name('webmention-endpoint'); +Route::post('webmention', [WebMentionsController::class, 'receive']); + +// Contacts +Route::get('contacts', [ContactsController::class, 'index']); +Route::get('contacts/{contact:nick}', [ContactsController::class, 'show']); + +// Places +Route::get('places', [PlacesController::class, 'index']); +Route::get('places/{place}', [PlacesController::class, 'show']); + +// Micropub +Route::redirect('/micropub/create', '/notes/new'); + +// Search +Route::get('search', [SearchController::class, 'search']); diff --git a/tests/Feature/FeedsTest.php b/tests/Feature/FeedsTest.php index a0704b90..1ed6741a 100644 --- a/tests/Feature/FeedsTest.php +++ b/tests/Feature/FeedsTest.php @@ -64,7 +64,7 @@ class FeedsTest extends TestCase 'author' => [ 'type' => 'card', 'name' => config('user.display_name'), - 'url' => config('url.longurl'), + 'url' => config('app.url'), ], 'children' => [[ 'type' => 'entry', @@ -122,7 +122,7 @@ class FeedsTest extends TestCase 'author' => [ 'type' => 'card', 'name' => config('user.display_name'), - 'url' => config('url.longurl'), + 'url' => config('app.url'), ], 'children' => [[ 'type' => 'entry', diff --git a/tests/Feature/MicropubControllerTest.php b/tests/Feature/MicropubControllerTest.php index 2cd75fc3..f3a7bace 100644 --- a/tests/Feature/MicropubControllerTest.php +++ b/tests/Feature/MicropubControllerTest.php @@ -299,7 +299,7 @@ class MicropubControllerTest extends TestCase 'type' => ['h-entry'], 'properties' => [ 'content' => [$note], - 'location' => [$place->longurl], + 'location' => [$place->uri], ], ], ['HTTP_Authorization' => 'Bearer ' . $this->getToken()] @@ -499,7 +499,7 @@ class MicropubControllerTest extends TestCase '/api/post', [ 'action' => 'update', - 'url' => $note->longurl, + 'url' => $note->uri, 'replace' => [ 'content' => ['replaced content'], ], @@ -519,7 +519,7 @@ class MicropubControllerTest extends TestCase '/api/post', [ 'action' => 'update', - 'url' => $note->longurl, + 'url' => $note->uri, 'add' => [ 'syndication' => [ 'https://www.swarmapp.com/checkin/123', @@ -546,7 +546,7 @@ class MicropubControllerTest extends TestCase '/api/post', [ 'action' => 'update', - 'url' => $note->longurl, + 'url' => $note->uri, 'add' => [ 'photo' => ['https://example.org/photo.jpg'], ], @@ -607,7 +607,7 @@ class MicropubControllerTest extends TestCase '/api/post', [ 'action' => 'update', - 'url' => $note->longurl, + 'url' => $note->uri, 'morph' => [ // or any other unsupported update type 'syndication' => ['https://www.swarmapp.com/checkin/123'], ], @@ -646,7 +646,7 @@ class MicropubControllerTest extends TestCase '/api/post', [ 'action' => 'update', - 'url' => $note->longurl, + 'url' => $note->uri, 'replace' => [ 'syndication' => [ 'https://www.swarmapp.com/checkin/the-id', diff --git a/tests/Feature/NotesControllerTest.php b/tests/Feature/NotesControllerTest.php index 43e5a050..90ccd553 100644 --- a/tests/Feature/NotesControllerTest.php +++ b/tests/Feature/NotesControllerTest.php @@ -31,7 +31,7 @@ class NotesControllerTest extends TestCase public function specificNotePageLoads(): void { $note = Note::factory()->create(); - $response = $this->get($note->longurl); + $response = $this->get($note->uri); $response->assertViewHas('note'); } @@ -51,7 +51,7 @@ class NotesControllerTest extends TestCase { $note = Note::factory()->create(); $response = $this->get('/note/' . $note->id); - $response->assertRedirect($note->longurl); + $response->assertRedirect($note->uri); } /** diff --git a/tests/Feature/PlacesTest.php b/tests/Feature/PlacesTest.php index 82a3e280..c37e4239 100644 --- a/tests/Feature/PlacesTest.php +++ b/tests/Feature/PlacesTest.php @@ -30,7 +30,7 @@ class PlacesTest extends TestCase public function singlePlacePageLoads(): void { $place = Place::factory()->create(); - $response = $this->get($place->longurl); + $response = $this->get($place->uri); $response->assertViewHas('place', $place); } diff --git a/tests/Feature/ShortURLsControllerTest.php b/tests/Feature/ShortURLsControllerTest.php deleted file mode 100644 index 989f3b5b..00000000 --- a/tests/Feature/ShortURLsControllerTest.php +++ /dev/null @@ -1,39 +0,0 @@ -get('https://' . config('url.shorturl')); - $response->assertRedirect(config('app.url')); - } - - #[Test] - public function shortDomainSlashAtRedirectsToTwitter(): void - { - $response = $this->get('https://' . config('url.shorturl') . '/@'); - $response->assertRedirect('https://twitter.com/jonnybarnes'); - } - - #[Test] - public function shortDomainSlashTRedirectsToLongDomainSlashNotes(): void - { - $response = $this->get('https://' . config('url.shorturl') . '/t/E'); - $response->assertRedirect(config('app.url') . '/notes/E'); - } - - #[Test] - public function shortDomainSlashBRedirectsToLongDomainSlashBlog(): void - { - $response = $this->get('https://' . config('url.shorturl') . '/b/1'); - $response->assertRedirect(config('app.url') . '/blog/s/1'); - } -} diff --git a/tests/Feature/WebMentionsControllerTest.php b/tests/Feature/WebMentionsControllerTest.php index d9482450..5d2908cc 100644 --- a/tests/Feature/WebMentionsControllerTest.php +++ b/tests/Feature/WebMentionsControllerTest.php @@ -82,7 +82,7 @@ class WebMentionsControllerTest extends TestCase $response = $this->call('POST', '/webmention', [ 'source' => 'https://example.org/post/123', - 'target' => $note->longurl, + 'target' => $note->uri, ]); $response->assertStatus(202); diff --git a/tests/Unit/Jobs/ProcessWebMentionJobTest.php b/tests/Unit/Jobs/ProcessWebMentionJobTest.php index 1bf56621..a67ef15e 100644 --- a/tests/Unit/Jobs/ProcessWebMentionJobTest.php +++ b/tests/Unit/Jobs/ProcessWebMentionJobTest.php @@ -94,12 +94,12 @@ class ProcessWebMentionJobTest extends TestCase $source = 'https://aaronpk.localhost/reply/1'; WebMention::factory()->create([ 'source' => $source, - 'target' => $note->longurl, + 'target' => $note->uri, ]); $html = << -

In reply to a note

+

In reply to a note

Updated reply
HTML; @@ -117,7 +117,7 @@ class ProcessWebMentionJobTest extends TestCase 'source' => $source, 'type' => 'in-reply-to', // phpcs:ignore Generic.Files.LineLength.TooLong - 'mf2' => '{"rels": [], "items": [{"type": ["h-entry"], "properties": {"content": [{"html": "Updated reply", "value": "Updated reply"}], "in-reply-to": ["' . $note->longurl . '"]}}], "rel-urls": []}', + 'mf2' => '{"rels": [], "items": [{"type": ["h-entry"], "properties": {"content": [{"html": "Updated reply", "value": "Updated reply"}], "in-reply-to": ["' . $note->uri . '"]}}], "rel-urls": []}', ]); } diff --git a/tests/Unit/NotesTest.php b/tests/Unit/NotesTest.php index 2f157c8a..6cf0b5e5 100644 --- a/tests/Unit/NotesTest.php +++ b/tests/Unit/NotesTest.php @@ -115,14 +115,6 @@ class NotesTest extends TestCase $this->assertEquals($expected, $note->note); } - #[Test] - public function shorturlMethodReturnsExpectedValue(): void - { - $note = Note::factory()->make(); - $note->id = 14; - $this->assertEquals(config('url.shorturl') . '/notes/E', $note->shorturl); - } - #[Test] public function weGetLatitudeLongitudeValuesOfAssociatedPlaceOfNote(): void { @@ -382,11 +374,11 @@ class NotesTest extends TestCase public function markdown_content_gets_converted(): void { $note = Note::factory()->create([ - 'note' => 'The best search engine? https://duckduckgo.com', + 'note' => 'The best search engine? https://kagi.com', ]); $this->assertSame( - '

The best search engine? https://duckduckgo.com

' . PHP_EOL, + '

The best search engine? https://kagi.com

' . PHP_EOL, $note->note ); } diff --git a/tests/Unit/PlacesTest.php b/tests/Unit/PlacesTest.php index b3f0ed37..470cc869 100644 --- a/tests/Unit/PlacesTest.php +++ b/tests/Unit/PlacesTest.php @@ -40,24 +40,6 @@ class PlacesTest extends TestCase $this->assertEquals('the-bridgewater-pub', $nearby[0]->slug); } - #[Test] - public function getLongurl(): void - { - $place = Place::factory()->create([ - 'name' => 'The Bridgewater Pub', - ]); - $this->assertEquals(config('app.url') . '/places/the-bridgewater-pub', $place->longurl); - } - - #[Test] - public function getShorturl() - { - $place = Place::factory()->create([ - 'name' => 'The Bridgewater Pub', - ]); - $this->assertEquals(config('url.shorturl') . '/places/the-bridgewater-pub', $place->shorturl); - } - #[Test] public function getUri(): void { -- 2.49.0 From 126bb29ae20685ff79cc27a93d69131ab51e80a1 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Sun, 6 Apr 2025 17:25:06 +0100 Subject: [PATCH 2/2] Laravel Pint fixes --- .../Feature/Admin/AdminHomeControllerTest.php | 2 +- tests/Feature/Admin/AdminTest.php | 16 ++--- tests/Feature/Admin/ArticlesTest.php | 14 ++-- tests/Feature/Admin/BioTest.php | 8 +-- tests/Feature/Admin/ClientsTest.php | 12 ++-- tests/Feature/Admin/ContactsTest.php | 22 +++--- tests/Feature/Admin/LikesTest.php | 12 ++-- tests/Feature/Admin/NotesTest.php | 12 ++-- tests/Feature/Admin/PlacesTest.php | 10 +-- tests/Feature/ArticlesTest.php | 14 ++-- tests/Feature/BookmarksTest.php | 10 +-- tests/Feature/ContactsTest.php | 8 +-- tests/Feature/CorsHeadersTest.php | 4 +- tests/Feature/FeedsTest.php | 20 +++--- tests/Feature/FrontPageTest.php | 2 +- tests/Feature/HeaderLinkTest.php | 2 +- tests/Feature/HorizonTest.php | 2 +- tests/Feature/IndieAuthTest.php | 54 +++++++-------- tests/Feature/LikesTest.php | 20 +++--- tests/Feature/MicropubControllerTest.php | 68 +++++++++---------- tests/Feature/MicropubMediaTest.php | 38 +++++------ tests/Feature/NotesControllerTest.php | 12 ++-- tests/Feature/OwnYourGramTest.php | 2 +- tests/Feature/ParseCachedWebMentionsTest.php | 2 +- tests/Feature/PlacesTest.php | 6 +- tests/Feature/ReDownloadWebMentionsTest.php | 2 +- tests/Feature/SearchTest.php | 2 +- tests/Feature/SwarmTest.php | 14 ++-- tests/Feature/TokenServiceTest.php | 4 +- tests/Feature/WebMentionsControllerTest.php | 12 ++-- tests/Unit/ArticlesTest.php | 12 ++-- tests/Unit/BookmarksTest.php | 6 +- tests/Unit/HelpersTest.php | 6 +- .../Unit/Jobs/AddClientToDatabaseJobTest.php | 2 +- tests/Unit/Jobs/DownloadWebMentionJobTest.php | 6 +- tests/Unit/Jobs/ProcessBookmarkJobTest.php | 4 +- tests/Unit/Jobs/ProcessMediaJobTest.php | 6 +- tests/Unit/Jobs/ProcessWebMentionJobTest.php | 12 ++-- tests/Unit/Jobs/SaveProfileImageJobTest.php | 12 ++-- tests/Unit/Jobs/SaveScreenshotJobTest.php | 4 +- tests/Unit/Jobs/SendWebMentionJobTest.php | 16 ++--- .../Jobs/SyndicateNoteToBlueskyJobTest.php | 4 +- .../Jobs/SyndicateNoteToMastodonJobTest.php | 4 +- tests/Unit/LikesTest.php | 8 +-- tests/Unit/MediaTest.php | 4 +- tests/Unit/MicropubClientsTest.php | 2 +- tests/Unit/NotesTest.php | 44 ++++++------ tests/Unit/PlacesTest.php | 14 ++-- tests/Unit/TagsTest.php | 6 +- tests/Unit/WebMentionTest.php | 20 +++--- 50 files changed, 299 insertions(+), 299 deletions(-) diff --git a/tests/Feature/Admin/AdminHomeControllerTest.php b/tests/Feature/Admin/AdminHomeControllerTest.php index 0fd92cc0..7ee7b8bf 100644 --- a/tests/Feature/Admin/AdminHomeControllerTest.php +++ b/tests/Feature/Admin/AdminHomeControllerTest.php @@ -14,7 +14,7 @@ class AdminHomeControllerTest extends TestCase use RefreshDatabase; #[Test] - public function adminHomepageLoads(): void + public function admin_homepage_loads(): void { $user = User::factory()->make(); diff --git a/tests/Feature/Admin/AdminTest.php b/tests/Feature/Admin/AdminTest.php index 753ee054..cdebef7e 100644 --- a/tests/Feature/Admin/AdminTest.php +++ b/tests/Feature/Admin/AdminTest.php @@ -11,21 +11,21 @@ use Tests\TestCase; class AdminTest extends TestCase { #[Test] - public function adminPageRedirectsUnauthorisedUsersToLoginPage(): void + public function admin_page_redirects_unauthorised_users_to_login_page(): void { $response = $this->get('/admin'); $response->assertRedirect('/login'); } #[Test] - public function loginPageLoads(): void + public function login_page_loads(): void { $response = $this->get('/login'); $response->assertViewIs('login'); } #[Test] - public function loginAttemptWithBadCredentialsFails(): void + public function login_attempt_with_bad_credentials_fails(): void { $response = $this->post('/login', [ 'username' => 'bad', @@ -35,7 +35,7 @@ class AdminTest extends TestCase } #[Test] - public function loginSucceeds(): void + public function login_succeeds(): void { User::factory([ 'name' => 'admin', @@ -51,7 +51,7 @@ class AdminTest extends TestCase } #[Test] - public function whenLoggedInRedirectsToAdminPage(): void + public function when_logged_in_redirects_to_admin_page(): void { $user = User::factory()->create(); $response = $this->actingAs($user)->get('/login'); @@ -59,14 +59,14 @@ class AdminTest extends TestCase } #[Test] - public function loggedOutUsersSimplyRedirected(): void + public function logged_out_users_simply_redirected(): void { $response = $this->get('/logout'); $response->assertRedirect('/'); } #[Test] - public function loggedInUsersShownLogoutForm(): void + public function logged_in_users_shown_logout_form(): void { $user = User::factory()->create(); $response = $this->actingAs($user)->get('/logout'); @@ -74,7 +74,7 @@ class AdminTest extends TestCase } #[Test] - public function loggedInUsersCanLogout(): void + public function logged_in_users_can_logout(): void { $user = User::factory()->create(); $response = $this->actingAs($user)->post('/logout'); diff --git a/tests/Feature/Admin/ArticlesTest.php b/tests/Feature/Admin/ArticlesTest.php index 507ed072..42d7a451 100644 --- a/tests/Feature/Admin/ArticlesTest.php +++ b/tests/Feature/Admin/ArticlesTest.php @@ -17,7 +17,7 @@ class ArticlesTest extends TestCase use RefreshDatabase; #[Test] - public function adminArticlesPageLoads(): void + public function admin_articles_page_loads(): void { $user = User::factory()->make(); @@ -27,7 +27,7 @@ class ArticlesTest extends TestCase } #[Test] - public function adminCanLoadFormToCreateArticle(): void + public function admin_can_load_form_to_create_article(): void { $user = User::factory()->make(); @@ -37,7 +37,7 @@ class ArticlesTest extends TestCase } #[Test] - public function admiNCanCreateNewArticle(): void + public function admi_n_can_create_new_article(): void { $user = User::factory()->make(); @@ -50,7 +50,7 @@ class ArticlesTest extends TestCase } #[Test] - public function adminCanCreateNewArticleWithFile(): void + public function admin_can_create_new_article_with_file(): void { $user = User::factory()->make(); $faker = Factory::create(); @@ -75,7 +75,7 @@ class ArticlesTest extends TestCase } #[Test] - public function articleCanLoadFormToEditArticle(): void + public function article_can_load_form_to_edit_article(): void { $user = User::factory()->make(); $article = Article::factory()->create([ @@ -88,7 +88,7 @@ class ArticlesTest extends TestCase } #[Test] - public function adminCanEditArticle(): void + public function admin_can_edit_article(): void { $user = User::factory()->make(); $article = Article::factory()->create(); @@ -106,7 +106,7 @@ class ArticlesTest extends TestCase } #[Test] - public function adminCanDeleteArticle(): void + public function admin_can_delete_article(): void { $user = User::factory()->make(); $article = Article::factory()->create(); diff --git a/tests/Feature/Admin/BioTest.php b/tests/Feature/Admin/BioTest.php index 6453b037..630ec748 100644 --- a/tests/Feature/Admin/BioTest.php +++ b/tests/Feature/Admin/BioTest.php @@ -15,7 +15,7 @@ class BioTest extends TestCase use RefreshDatabase; #[Test] - public function adminBiosPageLoads(): void + public function admin_bios_page_loads(): void { $user = User::factory()->make(); @@ -25,7 +25,7 @@ class BioTest extends TestCase } #[Test] - public function adminCanCreateBio(): void + public function admin_can_create_bio(): void { $user = User::factory()->make(); @@ -38,7 +38,7 @@ class BioTest extends TestCase } #[Test] - public function adminCanLoadExistingBio(): void + public function admin_can_load_existing_bio(): void { $user = User::factory()->make(); $bio = Bio::factory()->create([ @@ -51,7 +51,7 @@ class BioTest extends TestCase } #[Test] - public function adminCanEditBio(): void + public function admin_can_edit_bio(): void { $user = User::factory()->make(); $bio = Bio::factory()->create(); diff --git a/tests/Feature/Admin/ClientsTest.php b/tests/Feature/Admin/ClientsTest.php index 4afe4a54..151b3fdb 100644 --- a/tests/Feature/Admin/ClientsTest.php +++ b/tests/Feature/Admin/ClientsTest.php @@ -15,7 +15,7 @@ class ClientsTest extends TestCase use RefreshDatabase; #[Test] - public function clientsPageLoads(): void + public function clients_page_loads(): void { $user = User::factory()->make(); @@ -25,7 +25,7 @@ class ClientsTest extends TestCase } #[Test] - public function adminCanLoadFormToCreateClient(): void + public function admin_can_load_form_to_create_client(): void { $user = User::factory()->make(); @@ -35,7 +35,7 @@ class ClientsTest extends TestCase } #[Test] - public function adminCanCreateNewClient(): void + public function admin_can_create_new_client(): void { $user = User::factory()->make(); @@ -51,7 +51,7 @@ class ClientsTest extends TestCase } #[Test] - public function adminCanLoadEditFormForClient(): void + public function admin_can_load_edit_form_for_client(): void { $user = User::factory()->make(); $client = MicropubClient::factory()->create([ @@ -64,7 +64,7 @@ class ClientsTest extends TestCase } #[Test] - public function adminCanEditClient(): void + public function admin_can_edit_client(): void { $user = User::factory()->make(); $client = MicropubClient::factory()->create(); @@ -82,7 +82,7 @@ class ClientsTest extends TestCase } #[Test] - public function adminCanDeleteClient(): void + public function admin_can_delete_client(): void { $user = User::factory()->make(); $client = MicropubClient::factory()->create([ diff --git a/tests/Feature/Admin/ContactsTest.php b/tests/Feature/Admin/ContactsTest.php index 4b8f632f..7e22d87b 100644 --- a/tests/Feature/Admin/ContactsTest.php +++ b/tests/Feature/Admin/ContactsTest.php @@ -29,7 +29,7 @@ class ContactsTest extends TestCase } #[Test] - public function contactIndexPageLoads(): void + public function contact_index_page_loads(): void { $user = User::factory()->make(); @@ -38,7 +38,7 @@ class ContactsTest extends TestCase } #[Test] - public function contactCreatePageLoads(): void + public function contact_create_page_loads(): void { $user = User::factory()->make(); @@ -47,7 +47,7 @@ class ContactsTest extends TestCase } #[Test] - public function adminCanCreateNewContact(): void + public function admin_can_create_new_contact(): void { $user = User::factory()->make(); @@ -64,7 +64,7 @@ class ContactsTest extends TestCase } #[Test] - public function adminCanSeeFormToEditContact(): void + public function admin_can_see_form_to_edit_contact(): void { $user = User::factory()->make(); $contact = Contact::factory()->create(); @@ -74,7 +74,7 @@ class ContactsTest extends TestCase } #[Test] - public function adminCanUpdateContact(): void + public function admin_can_update_contact(): void { $user = User::factory()->make(); $contact = Contact::factory()->create(); @@ -93,7 +93,7 @@ class ContactsTest extends TestCase } #[Test] - public function adminCanEditContactAndUploadAvatar(): void + public function admin_can_edit_contact_and_upload_avatar(): void { copy(__DIR__ . '/../../aaron.png', sys_get_temp_dir() . '/tantek.png'); $path = sys_get_temp_dir() . '/tantek.png'; @@ -116,7 +116,7 @@ class ContactsTest extends TestCase } #[Test] - public function adminCanDeleteContact(): void + public function admin_can_delete_contact(): void { $user = User::factory()->make(); $contact = Contact::factory()->create(['nick' => 'tantek']); @@ -134,7 +134,7 @@ class ContactsTest extends TestCase } #[Test] - public function adminCanTriggerRetrievalOfRemoteAvatar(): void + public function admin_can_trigger_retrieval_of_remote_avatar(): void { $html = <<<'HTML'
@@ -163,7 +163,7 @@ class ContactsTest extends TestCase } #[Test] - public function gettingRemoteAvatarFailsGracefullyWithRemoteNotFound(): void + public function getting_remote_avatar_fails_gracefully_with_remote_not_found(): void { $mock = new MockHandler([ new Response(404), @@ -180,7 +180,7 @@ class ContactsTest extends TestCase } #[Test] - public function gettingRemoteAvatarFailsGracefullyWithRemoteError(): void + public function getting_remote_avatar_fails_gracefully_with_remote_error(): void { $html = <<<'HTML'
@@ -203,7 +203,7 @@ class ContactsTest extends TestCase } #[Test] - public function gettingRemoteAvatarFailsGracefullyForContactWithNoHompage(): void + public function getting_remote_avatar_fails_gracefully_for_contact_with_no_hompage(): void { $contact = Contact::create([ 'nick' => 'fred', diff --git a/tests/Feature/Admin/LikesTest.php b/tests/Feature/Admin/LikesTest.php index 151f7b73..436088d6 100644 --- a/tests/Feature/Admin/LikesTest.php +++ b/tests/Feature/Admin/LikesTest.php @@ -17,7 +17,7 @@ class LikesTest extends TestCase use RefreshDatabase; #[Test] - public function likesPageLoads(): void + public function likes_page_loads(): void { $user = User::factory()->make(); @@ -27,7 +27,7 @@ class LikesTest extends TestCase } #[Test] - public function likeCreateFormLoads(): void + public function like_create_form_loads(): void { $user = User::factory()->make(); @@ -37,7 +37,7 @@ class LikesTest extends TestCase } #[Test] - public function adminCanCreateLike(): void + public function admin_can_create_like(): void { Queue::fake(); $user = User::factory()->make(); @@ -53,7 +53,7 @@ class LikesTest extends TestCase } #[Test] - public function likeEditFormLoads(): void + public function like_edit_form_loads(): void { $user = User::factory()->make(); $like = Like::factory()->create(); @@ -64,7 +64,7 @@ class LikesTest extends TestCase } #[Test] - public function adminCanEditLike(): void + public function admin_can_edit_like(): void { Queue::fake(); $user = User::factory()->make(); @@ -82,7 +82,7 @@ class LikesTest extends TestCase } #[Test] - public function adminCanDeleteLike(): void + public function admin_can_delete_like(): void { $like = Like::factory()->create(); $url = $like->url; diff --git a/tests/Feature/Admin/NotesTest.php b/tests/Feature/Admin/NotesTest.php index ccd3a867..ca6b8339 100644 --- a/tests/Feature/Admin/NotesTest.php +++ b/tests/Feature/Admin/NotesTest.php @@ -17,7 +17,7 @@ class NotesTest extends TestCase use RefreshDatabase; #[Test] - public function notesPageLoads(): void + public function notes_page_loads(): void { $user = User::factory()->make(); @@ -26,7 +26,7 @@ class NotesTest extends TestCase } #[Test] - public function noteCreatePageLoads(): void + public function note_create_page_loads(): void { $user = User::factory()->make(); @@ -35,7 +35,7 @@ class NotesTest extends TestCase } #[Test] - public function adminCanCreateNewNote(): void + public function admin_can_create_new_note(): void { $user = User::factory()->make(); @@ -49,7 +49,7 @@ class NotesTest extends TestCase } #[Test] - public function noteEditFormLoads(): void + public function note_edit_form_loads(): void { $user = User::factory()->make(); $note = Note::factory()->create(); @@ -59,7 +59,7 @@ class NotesTest extends TestCase } #[Test] - public function adminCanEditNote(): void + public function admin_can_edit_note(): void { Queue::fake(); $user = User::factory()->make(); @@ -78,7 +78,7 @@ class NotesTest extends TestCase } #[Test] - public function adminCanDeleteNote(): void + public function admin_can_delete_note(): void { $user = User::factory()->make(); $note = Note::factory()->create(); diff --git a/tests/Feature/Admin/PlacesTest.php b/tests/Feature/Admin/PlacesTest.php index 1f711e8e..367fbcb2 100644 --- a/tests/Feature/Admin/PlacesTest.php +++ b/tests/Feature/Admin/PlacesTest.php @@ -15,7 +15,7 @@ class PlacesTest extends TestCase use RefreshDatabase; #[Test] - public function placesPageLoads(): void + public function places_page_loads(): void { $user = User::factory()->make(); @@ -24,7 +24,7 @@ class PlacesTest extends TestCase } #[Test] - public function createPlacePageLoads(): void + public function create_place_page_loads(): void { $user = User::factory()->make(); @@ -33,7 +33,7 @@ class PlacesTest extends TestCase } #[Test] - public function adminCanCreateNewPlace(): void + public function admin_can_create_new_place(): void { $user = User::factory()->make(); @@ -50,7 +50,7 @@ class PlacesTest extends TestCase } #[Test] - public function editPlacePageLoads(): void + public function edit_place_page_loads(): void { $user = User::factory()->make(); $place = Place::factory()->create(); @@ -60,7 +60,7 @@ class PlacesTest extends TestCase } #[Test] - public function adminCanUpdatePlace(): void + public function admin_can_update_place(): void { $user = User::factory()->make(); $place = Place::factory()->create([ diff --git a/tests/Feature/ArticlesTest.php b/tests/Feature/ArticlesTest.php index 8e544009..c3922beb 100644 --- a/tests/Feature/ArticlesTest.php +++ b/tests/Feature/ArticlesTest.php @@ -15,14 +15,14 @@ class ArticlesTest extends TestCase use RefreshDatabase; #[Test] - public function articlesPageLoads(): void + public function articles_page_loads(): void { $response = $this->get('/blog'); $response->assertViewIs('articles.index'); } #[Test] - public function singleArticlePageLoads() + public function single_article_page_loads() { $article = Article::factory()->create(); $response = $this->get($article->link); @@ -30,7 +30,7 @@ class ArticlesTest extends TestCase } #[Test] - public function wrongDateInUrlRedirectsToCorrectDate() + public function wrong_date_in_url_redirects_to_correct_date() { $article = Article::factory()->create(); $response = $this->get('/blog/1900/01/' . $article->titleurl); @@ -38,7 +38,7 @@ class ArticlesTest extends TestCase } #[Test] - public function oldUrlsWithIdAreRedirected() + public function old_urls_with_id_are_redirected() { $article = Article::factory()->create(); $num60Id = resolve(Numbers::class)->numto60($article->id); @@ -47,21 +47,21 @@ class ArticlesTest extends TestCase } #[Test] - public function unknownSlugGetsNotFoundResponse() + public function unknown_slug_gets_not_found_response() { $response = $this->get('/blog/' . date('Y') . '/' . date('m') . '/unknown-slug'); $response->assertNotFound(); } #[Test] - public function unknownArticleIdGetsNotFoundResponse() + public function unknown_article_id_gets_not_found_response() { $response = $this->get('/blog/s/22'); $response->assertNotFound(); } #[Test] - public function someUrlsDoNotParseCorrectly(): void + public function some_urls_do_not_parse_correctly(): void { $response = $this->get('/blog/feed.js'); $response->assertNotFound(); diff --git a/tests/Feature/BookmarksTest.php b/tests/Feature/BookmarksTest.php index 73948237..ebbcedf6 100644 --- a/tests/Feature/BookmarksTest.php +++ b/tests/Feature/BookmarksTest.php @@ -17,14 +17,14 @@ class BookmarksTest extends TestCase use RefreshDatabase, TestToken; #[Test] - public function bookmarksPageLoadsWithoutError(): void + public function bookmarks_page_loads_without_error(): void { $response = $this->get('/bookmarks'); $response->assertViewIs('bookmarks.index'); } #[Test] - public function singleBookmarkPageLoadsWithoutError(): void + public function single_bookmark_page_loads_without_error(): void { $bookmark = Bookmark::factory()->create(); $response = $this->get('/bookmarks/' . $bookmark->id); @@ -32,7 +32,7 @@ class BookmarksTest extends TestCase } #[Test] - public function whenBookmarkIsAddedUsingHttpSyntaxCheckJobToTakeScreenshotIsInvoked(): void + public function when_bookmark_is_added_using_http_syntax_check_job_to_take_screenshot_is_invoked(): void { Queue::fake(); @@ -50,7 +50,7 @@ class BookmarksTest extends TestCase } #[Test] - public function whenBookmarkIsAddedUsingJsonSyntaxCheckJobToTakeScreenshotIsInvoked(): void + public function when_bookmark_is_added_using_json_syntax_check_job_to_take_screenshot_is_invoked(): void { Queue::fake(); @@ -70,7 +70,7 @@ class BookmarksTest extends TestCase } #[Test] - public function whenTheBookmarkIsCreatedCheckNecessaryTagsAreAlsoCreated(): void + public function when_the_bookmark_is_created_check_necessary_tags_are_also_created(): void { Queue::fake(); diff --git a/tests/Feature/ContactsTest.php b/tests/Feature/ContactsTest.php index a773e45f..0c4af8e9 100644 --- a/tests/Feature/ContactsTest.php +++ b/tests/Feature/ContactsTest.php @@ -17,7 +17,7 @@ class ContactsTest extends TestCase * Check the `/contacts` page gives a good response. */ #[Test] - public function contactsPageLoadsWithoutError(): void + public function contacts_page_loads_without_error(): void { $response = $this->get('/contacts'); $response->assertStatus(200); @@ -27,7 +27,7 @@ class ContactsTest extends TestCase * Test an individual contact page with default profile image. */ #[Test] - public function contactPageShouldFallbackToDefaultProfilePic(): void + public function contact_page_should_fallback_to_default_profile_pic(): void { Contact::factory()->create([ 'nick' => 'tantek', @@ -40,7 +40,7 @@ class ContactsTest extends TestCase * Test an individual contact page with a specific profile image. */ #[Test] - public function contactPageShouldUseSpecificProfilePicIfPresent(): void + public function contact_page_should_use_specific_profile_pic_if_present(): void { Contact::factory()->create([ 'nick' => 'aaron', @@ -51,7 +51,7 @@ class ContactsTest extends TestCase } #[Test] - public function unknownContactReturnsNotFoundResponse(): void + public function unknown_contact_returns_not_found_response(): void { $response = $this->get('/contacts/unknown'); $response->assertNotFound(); diff --git a/tests/Feature/CorsHeadersTest.php b/tests/Feature/CorsHeadersTest.php index 07af166e..e0804058 100644 --- a/tests/Feature/CorsHeadersTest.php +++ b/tests/Feature/CorsHeadersTest.php @@ -13,7 +13,7 @@ class CorsHeadersTest extends TestCase use TestToken; #[Test] - public function checkCorsHeadersOnMediaEndpoint(): void + public function check_cors_headers_on_media_endpoint(): void { $response = $this->call( 'OPTIONS', @@ -27,7 +27,7 @@ class CorsHeadersTest extends TestCase } #[Test] - public function checkForNoCorsHeaderOnNonMediaEndpointLinks(): void + public function check_for_no_cors_header_on_non_media_endpoint_links(): void { $response = $this->get('/blog'); $response->assertHeaderMissing('Access-Control-Allow-Origin'); diff --git a/tests/Feature/FeedsTest.php b/tests/Feature/FeedsTest.php index 1ed6741a..7c403da5 100644 --- a/tests/Feature/FeedsTest.php +++ b/tests/Feature/FeedsTest.php @@ -19,7 +19,7 @@ class FeedsTest extends TestCase * Test the blog RSS feed. */ #[Test] - public function blogRssFeedIsPresent(): void + public function blog_rss_feed_is_present(): void { Article::factory()->count(3)->create(); $response = $this->get('/blog/feed.rss'); @@ -31,7 +31,7 @@ class FeedsTest extends TestCase * Test the notes RSS feed. */ #[Test] - public function notesRssFeedIsPresent(): void + public function notes_rss_feed_is_present(): void { Note::factory()->count(3)->create(); $response = $this->get('/notes/feed.rss'); @@ -43,7 +43,7 @@ class FeedsTest extends TestCase * Test the blog RSS feed. */ #[Test] - public function blogAtomFeedIsPresent(): void + public function blog_atom_feed_is_present(): void { Article::factory()->count(3)->create(); $response = $this->get('/blog/feed.atom'); @@ -52,7 +52,7 @@ class FeedsTest extends TestCase } #[Test] - public function blogJf2FeedIsPresent(): void + public function blog_jf2_feed_is_present(): void { Article::factory()->count(3)->create(); $response = $this->get('/blog/feed.jf2'); @@ -77,7 +77,7 @@ class FeedsTest extends TestCase * Test the notes RSS feed. */ #[Test] - public function notesAtomFeedIsPresent(): void + public function notes_atom_feed_is_present(): void { Note::factory()->count(3)->create(); $response = $this->get('/notes/feed.atom'); @@ -89,7 +89,7 @@ class FeedsTest extends TestCase * Test the blog JSON feed. */ #[Test] - public function blogJsonFeedIsPresent(): void + public function blog_json_feed_is_present(): void { Article::factory()->count(3)->create(); $response = $this->get('/blog/feed.json'); @@ -101,7 +101,7 @@ class FeedsTest extends TestCase * Test the notes JSON feed. */ #[Test] - public function notesJsonFeedIsPresent(): void + public function notes_json_feed_is_present(): void { Note::factory()->count(3)->create(); $response = $this->get('/notes/feed.json'); @@ -110,7 +110,7 @@ class FeedsTest extends TestCase } #[Test] - public function notesJf2FeedIsPresent(): void + public function notes_jf2_feed_is_present(): void { Note::factory()->count(3)->create(); $response = $this->get('/notes/feed.jf2'); @@ -136,7 +136,7 @@ class FeedsTest extends TestCase * and whichever one they have can’t be `null`. */ #[Test] - public function jsonFeedsHaveRequiredAttributes(): void + public function json_feeds_have_required_attributes(): void { Note::factory()->count(3)->create(); $response = $this->get('/notes/feed.json'); @@ -156,7 +156,7 @@ class FeedsTest extends TestCase } #[Test] - public function jsonNoteFeedLoadsPlaceDataWithoutLazyLoading(): void + public function json_note_feed_loads_place_data_without_lazy_loading(): void { $place = Place::factory()->create(); Note::factory()->create(['note' => null, 'place_id' => $place->id]); diff --git a/tests/Feature/FrontPageTest.php b/tests/Feature/FrontPageTest.php index b78191bf..8c8a5706 100644 --- a/tests/Feature/FrontPageTest.php +++ b/tests/Feature/FrontPageTest.php @@ -15,7 +15,7 @@ class FrontPageTest extends TestCase use RefreshDatabase; #[Test] - public function frontPageLoadsAllContent(): void + public function front_page_loads_all_content(): void { Note::factory()->create(['note' => 'Note 1']); Article::factory()->create(['title' => 'Article 1']); diff --git a/tests/Feature/HeaderLinkTest.php b/tests/Feature/HeaderLinkTest.php index 8e220c79..e3d0ffff 100644 --- a/tests/Feature/HeaderLinkTest.php +++ b/tests/Feature/HeaderLinkTest.php @@ -10,7 +10,7 @@ use Tests\TestCase; class HeaderLinkTest extends TestCase { #[Test] - public function itShouldSeeTheIndiewebRelatedLinkHeaders(): void + public function it_should_see_the_indieweb_related_link_headers(): void { $response = $this->get('/'); diff --git a/tests/Feature/HorizonTest.php b/tests/Feature/HorizonTest.php index f4566e2f..26485c8a 100644 --- a/tests/Feature/HorizonTest.php +++ b/tests/Feature/HorizonTest.php @@ -12,7 +12,7 @@ class HorizonTest extends TestCase * Horizon has its own test suite, here we just test it has been installed successfully. */ #[Test] - public function horizonIsInstalled(): void + public function horizon_is_installed(): void { $user = User::factory()->create([ 'name' => 'jonny', diff --git a/tests/Feature/IndieAuthTest.php b/tests/Feature/IndieAuthTest.php index 78ba8130..106d9ae3 100644 --- a/tests/Feature/IndieAuthTest.php +++ b/tests/Feature/IndieAuthTest.php @@ -21,7 +21,7 @@ class IndieAuthTest extends TestCase use RefreshDatabase; #[Test] - public function itShouldReturnIndieAuthMetadata(): void + public function it_should_return_indie_auth_metadata(): void { $response = $this->get('/.well-known/indieauth-server'); @@ -37,7 +37,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldRequireAdminLoginToShowAuthoriseForm(): void + public function it_should_require_admin_login_to_show_authorise_form(): void { $response = $this->get('/auth', [ 'response_type' => 'code', @@ -59,7 +59,7 @@ class IndieAuthTest extends TestCase * same domain, later test will check the flow when they are different. */ #[Test] - public function itShouldReturnApprovalViewWhenTheRequestIsValid(): void + public function it_should_return_approval_view_when_the_request_is_valid(): void { $user = User::factory()->make(); $url = url()->query('/auth', [ @@ -80,7 +80,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldReturnErrorViewWhenResponeTypeIsWrong(): void + public function it_should_return_error_view_when_respone_type_is_wrong(): void { $user = User::factory()->make(); $url = url()->query('/auth', [ @@ -102,7 +102,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldReturnErrorViewWhenResponeTypeIsMissing(): void + public function it_should_return_error_view_when_respone_type_is_missing(): void { $user = User::factory()->make(); $url = url()->query('/auth', [ @@ -123,7 +123,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldReturnErrorViewWhenClientIdIsMissing(): void + public function it_should_return_error_view_when_client_id_is_missing(): void { $user = User::factory()->make(); $url = url()->query('/auth', [ @@ -144,7 +144,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldReturnErrorViewWhenRedirectUriIsMissing(): void + public function it_should_return_error_view_when_redirect_uri_is_missing(): void { $user = User::factory()->make(); $url = url()->query('/auth', [ @@ -165,7 +165,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldReturnErrorViewWhenStateIsMissing(): void + public function it_should_return_error_view_when_state_is_missing(): void { $user = User::factory()->make(); $url = url()->query('/auth', [ @@ -186,7 +186,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldReturnErrorViewWhenCodeChallengeIsMissing(): void + public function it_should_return_error_view_when_code_challenge_is_missing(): void { $user = User::factory()->make(); $url = url()->query('/auth', [ @@ -207,7 +207,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldReturnErrorViewWhenCodeChallengeMethodIsMissing(): void + public function it_should_return_error_view_when_code_challenge_method_is_missing(): void { $user = User::factory()->make(); $url = url()->query('/auth', [ @@ -228,7 +228,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldReturnErrorViewWhenCodeChallengeMethodIsUnsupportedValue(): void + public function it_should_return_error_view_when_code_challenge_method_is_unsupported_value(): void { $user = User::factory()->make(); $url = url()->query('/auth', [ @@ -250,7 +250,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldCheckClientIdForValidRedirect(): void + public function it_should_check_client_id_for_valid_redirect(): void { // Mock Guzzle request for client_id $appPageHtml = <<<'HTML' @@ -295,7 +295,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldErrorIfClientIdPageHasNoValidRedirect(): void + public function it_should_error_if_client_id_page_has_no_valid_redirect(): void { // Mock Guzzle request for client_id $appPageHtml = <<<'HTML' @@ -340,7 +340,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldRedirectToAppOnApproval(): void + public function it_should_redirect_to_app_on_approval(): void { $user = User::factory()->make(); $response = $this->actingAs($user)->post('/auth/confirm', [ @@ -373,7 +373,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldShowErrorResponseWhenApprovalRequestIsMissingGrantType(): void + public function it_should_show_error_response_when_approval_request_is_missing_grant_type(): void { $response = $this->post('/auth', [ 'code' => '123456', @@ -393,7 +393,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldShowErrorResponseWhenApprovalRequestIsMissingCode(): void + public function it_should_show_error_response_when_approval_request_is_missing_code(): void { $response = $this->post('/auth', [ 'grant_type' => 'authorization_code', @@ -413,7 +413,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldShowErrorResponseWhenApprovalRequestIsMissingClientId(): void + public function it_should_show_error_response_when_approval_request_is_missing_client_id(): void { $response = $this->post('/auth', [ 'grant_type' => 'authorization_code', @@ -433,7 +433,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldShowErrorResponseWhenApprovalRequestIsMissingRedirectUri(): void + public function it_should_show_error_response_when_approval_request_is_missing_redirect_uri(): void { $response = $this->post('/auth', [ 'grant_type' => 'authorization_code', @@ -453,7 +453,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldShowErrorResponseWhenApprovalRequestIsMissingCodeVerifier(): void + public function it_should_show_error_response_when_approval_request_is_missing_code_verifier(): void { $response = $this->post('/auth', [ 'grant_type' => 'authorization_code', @@ -473,7 +473,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldShowErrorResponseWhenApprovalRequestGrantTypeIsUnsupported(): void + public function it_should_show_error_response_when_approval_request_grant_type_is_unsupported(): void { $response = $this->post('/auth', [ 'grant_type' => 'unsupported', @@ -494,7 +494,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldReturnErrorForUnknownCode(): void + public function it_should_return_error_for_unknown_code(): void { $response = $this->post('/auth', [ 'grant_type' => 'authorization_code', @@ -515,7 +515,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldReturnErrorForInvalidCode(): void + public function it_should_return_error_for_invalid_code(): void { Cache::shouldReceive('pull') ->once() @@ -541,7 +541,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldReturnErrorForInvalidCodeVerifier(): void + public function it_should_return_error_for_invalid_code_verifier(): void { Cache::shouldReceive('pull') ->once() @@ -570,7 +570,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldReturnMeDataForValidRequest(): void + public function it_should_return_me_data_for_valid_request(): void { Cache::shouldReceive('pull') ->once() @@ -600,7 +600,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldReturnErrorWhenNoScopesGivenToTokenEndpoint(): void + public function it_should_return_error_when_no_scopes_given_to_token_endpoint(): void { Cache::shouldReceive('pull') ->once() @@ -635,7 +635,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldReturnErrorWhenClientIdDoesNotMatchDuringTokenRequest(): void + public function it_should_return_error_when_client_id_does_not_match_during_token_request(): void { Cache::shouldReceive('pull') ->once() @@ -670,7 +670,7 @@ class IndieAuthTest extends TestCase } #[Test] - public function itShouldReturnAnAccessTokenIfValidationPasses(): void + public function it_should_return_an_access_token_if_validation_passes(): void { Cache::shouldReceive('pull') ->once() diff --git a/tests/Feature/LikesTest.php b/tests/Feature/LikesTest.php index 3f13724a..b32b84b8 100644 --- a/tests/Feature/LikesTest.php +++ b/tests/Feature/LikesTest.php @@ -24,14 +24,14 @@ class LikesTest extends TestCase use TestToken; #[Test] - public function likesPageHasCorrectView(): void + public function likes_page_has_correct_view(): void { $response = $this->get('/likes'); $response->assertViewIs('likes.index'); } #[Test] - public function singleLikePageHasCorrectView(): void + public function single_like_page_has_correct_view(): void { $like = Like::factory()->create(); $response = $this->get('/likes/' . $like->id); @@ -39,7 +39,7 @@ class LikesTest extends TestCase } #[Test] - public function checkLikeCreatedFromMicropubApiRequests(): void + public function check_like_created_from_micropub_api_requests(): void { Queue::fake(); @@ -59,7 +59,7 @@ class LikesTest extends TestCase } #[Test] - public function checkLikeCreatedFromMicropubWebRequests(): void + public function check_like_created_from_micropub_web_requests(): void { Queue::fake(); @@ -77,7 +77,7 @@ class LikesTest extends TestCase } #[Test] - public function likeWithSimpleAuthor(): void + public function like_with_simple_author(): void { $like = new Like; $like->url = 'http://example.org/note/id'; @@ -116,7 +116,7 @@ class LikesTest extends TestCase } #[Test] - public function likeWithHCard(): void + public function like_with_h_card(): void { $like = new Like; $like->url = 'http://example.org/note/id'; @@ -159,7 +159,7 @@ class LikesTest extends TestCase } #[Test] - public function likeWithoutMicroformats(): void + public function like_without_microformats(): void { $like = new Like; $like->url = 'http://example.org/note/id'; @@ -195,7 +195,7 @@ class LikesTest extends TestCase } #[Test] - public function likeThatIsATweet(): void + public function like_that_is_a_tweet(): void { $like = new Like; $like->url = 'https://twitter.com/jonnybarnes/status/1050823255123251200'; @@ -234,7 +234,7 @@ class LikesTest extends TestCase } #[Test] - public function noErrorForFailureToPosseWithBridgy(): void + public function no_error_for_failure_to_posse_with_bridgy(): void { $like = new Like; $like->url = 'https://twitter.com/jonnybarnes/status/1050823255123251200'; @@ -271,7 +271,7 @@ class LikesTest extends TestCase } #[Test] - public function unknownLikeGivesNotFoundResponse(): void + public function unknown_like_gives_not_found_response(): void { $response = $this->get('/likes/202'); $response->assertNotFound(); diff --git a/tests/Feature/MicropubControllerTest.php b/tests/Feature/MicropubControllerTest.php index f3a7bace..0e7abdfc 100644 --- a/tests/Feature/MicropubControllerTest.php +++ b/tests/Feature/MicropubControllerTest.php @@ -25,7 +25,7 @@ class MicropubControllerTest extends TestCase use TestToken; #[Test] - public function micropubGetRequestWithoutTokenReturnsErrorResponse(): void + public function micropub_get_request_without_token_returns_error_response(): void { $response = $this->get('/api/post'); $response->assertStatus(401); @@ -33,7 +33,7 @@ class MicropubControllerTest extends TestCase } #[Test] - public function micropubGetRequestWithoutValidTokenReturnsErrorResponse(): void + public function micropub_get_request_without_valid_token_returns_error_response(): void { $response = $this->get('/api/post', ['HTTP_Authorization' => 'Bearer abc123']); $response->assertStatus(400); @@ -45,7 +45,7 @@ class MicropubControllerTest extends TestCase * 200 response. Check token information is also returned in the response. */ #[Test] - public function micropubGetRequestWithValidTokenReturnsOkResponse(): void + public function micropub_get_request_with_valid_token_returns_ok_response(): void { $response = $this->get('/api/post', ['HTTP_Authorization' => 'Bearer ' . $this->getToken()]); $response->assertStatus(200); @@ -53,14 +53,14 @@ class MicropubControllerTest extends TestCase } #[Test] - public function micropubClientsCanRequestSyndicationTargetsCanBeEmpty(): void + public function micropub_clients_can_request_syndication_targets_can_be_empty(): void { $response = $this->get('/api/post?q=syndicate-to', ['HTTP_Authorization' => 'Bearer ' . $this->getToken()]); $response->assertJsonFragment(['syndicate-to' => []]); } #[Test] - public function micropubClientsCanRequestSyndicationTargetsPopulatesFromModel(): void + public function micropub_clients_can_request_syndication_targets_populates_from_model(): void { $syndicationTarget = SyndicationTarget::factory()->create(); $response = $this->get('/api/post?q=syndicate-to', ['HTTP_Authorization' => 'Bearer ' . $this->getToken()]); @@ -68,7 +68,7 @@ class MicropubControllerTest extends TestCase } #[Test] - public function micropubClientsCanRequestKnownNearbyPlaces(): void + public function micropub_clients_can_request_known_nearby_places(): void { Place::factory()->create([ 'name' => 'The Bridgewater Pub', @@ -88,21 +88,21 @@ class MicropubControllerTest extends TestCase $response->assertJson(['places' => [['slug' => 'the-bridgewater-pub']]]); }*/ #[Test] - public function returnEmptyResultWhenMicropubClientRequestsKnownNearbyPlaces(): void + public function return_empty_result_when_micropub_client_requests_known_nearby_places(): void { $response = $this->get('/api/post?q=geo:1.23,4.56', ['HTTP_Authorization' => 'Bearer ' . $this->getToken()]); $response->assertJson(['places' => []]); } #[Test] - public function micropubClientCanRequestEndpointConfig(): void + public function micropub_client_can_request_endpoint_config(): void { $response = $this->get('/api/post?q=config', ['HTTP_Authorization' => 'Bearer ' . $this->getToken()]); $response->assertJsonFragment(['media-endpoint' => route('media-endpoint')]); } #[Test] - public function micropubClientCanCreateNewNote(): void + public function micropub_client_can_create_new_note(): void { $faker = Factory::create(); $note = $faker->text; @@ -121,7 +121,7 @@ class MicropubControllerTest extends TestCase } #[Test] - public function micropubClientCanRequestTheNewNoteIsSyndicatedToMastodonAndBluesky(): void + public function micropub_client_can_request_the_new_note_is_syndicated_to_mastodon_and_bluesky(): void { Queue::fake(); @@ -155,7 +155,7 @@ class MicropubControllerTest extends TestCase } #[Test] - public function micropubClientsCanCreateNewPlaces(): void + public function micropub_clients_can_create_new_places(): void { $response = $this->post( '/api/post', @@ -171,7 +171,7 @@ class MicropubControllerTest extends TestCase } #[Test] - public function micropubClientsCanCreateNewPlacesWithOldLocationSyntax(): void + public function micropub_clients_can_create_new_places_with_old_location_syntax(): void { $response = $this->post( '/api/post', @@ -188,7 +188,7 @@ class MicropubControllerTest extends TestCase } #[Test] - public function micropubClientWebRequestWithInvalidTokenReturnsErrorResponse(): void + public function micropub_client_web_request_with_invalid_token_returns_error_response(): void { $response = $this->post( '/api/post', @@ -203,7 +203,7 @@ class MicropubControllerTest extends TestCase } #[Test] - public function micropubClientWebRequestWithTokenWithoutAnyScopesReturnsErrorResponse(): void + public function micropub_client_web_request_with_token_without_any_scopes_returns_error_response(): void { $response = $this->post( '/api/post', @@ -218,7 +218,7 @@ class MicropubControllerTest extends TestCase } #[Test] - public function micropubClientWebRequestWithTokenWithoutCreateScopesReturnsErrorResponse(): void + public function micropub_client_web_request_with_token_without_create_scopes_returns_error_response(): void { $response = $this->post( '/api/post', @@ -237,7 +237,7 @@ class MicropubControllerTest extends TestCase * Test a valid micropub requests using JSON syntax creates a new note. */ #[Test] - public function micropubClientApiRequestCreatesNewNote(): void + public function micropub_client_api_request_creates_new_note(): void { Queue::fake(); Media::create([ @@ -284,7 +284,7 @@ class MicropubControllerTest extends TestCase * existing self-created place. */ #[Test] - public function micropubClientApiRequestCreatesNewNoteWithExistingPlaceInLocationData(): void + public function micropub_client_api_request_creates_new_note_with_existing_place_in_location_data(): void { $place = new Place; $place->name = 'Test Place'; @@ -314,7 +314,7 @@ class MicropubControllerTest extends TestCase * a new place defined in the location block. */ #[Test] - public function micropubClientApiRequestCreatesNewNoteWithNewPlaceInLocationData(): void + public function micropub_client_api_request_creates_new_note_with_new_place_in_location_data(): void { $faker = Factory::create(); $note = $faker->text; @@ -349,7 +349,7 @@ class MicropubControllerTest extends TestCase * a new place defined in the location block if there is missing data. */ #[Test] - public function micropubClientApiRequestCreatesNewNoteWithoutNewPlaceInLocationData(): void + public function micropub_client_api_request_creates_new_note_without_new_place_in_location_data(): void { $faker = Factory::create(); $note = $faker->text; @@ -382,7 +382,7 @@ class MicropubControllerTest extends TestCase * error. Also check the message. */ #[Test] - public function micropubClientApiRequestWithoutTokenReturnsError(): void + public function micropub_client_api_request_without_token_returns_error(): void { $faker = Factory::create(); $note = $faker->text; @@ -408,7 +408,7 @@ class MicropubControllerTest extends TestCase * an error. Also check the message. */ #[Test] - public function micropubClientApiRequestWithTokenWithInsufficientPermissionReturnsError(): void + public function micropub_client_api_request_with_token_with_insufficient_permission_returns_error(): void { $faker = Factory::create(); $note = $faker->text; @@ -431,7 +431,7 @@ class MicropubControllerTest extends TestCase } #[Test] - public function micropubClientApiRequestForUnsupportedPostTypeReturnsError(): void + public function micropub_client_api_request_for_unsupported_post_type_returns_error(): void { $response = $this->postJson( '/api/post', @@ -452,7 +452,7 @@ class MicropubControllerTest extends TestCase } #[Test] - public function micropubClientApiRequestCreatesNewPlace(): void + public function micropub_client_api_request_creates_new_place(): void { $faker = Factory::create(); $response = $this->postJson( @@ -472,7 +472,7 @@ class MicropubControllerTest extends TestCase } #[Test] - public function micropubClientApiRequestCreatesNewPlaceWithUncertaintyParameter(): void + public function micropub_client_api_request_creates_new_place_with_uncertainty_parameter(): void { $faker = Factory::create(); $response = $this->postJson( @@ -492,7 +492,7 @@ class MicropubControllerTest extends TestCase } #[Test] - public function micropubClientApiRequestUpdatesExistingNote(): void + public function micropub_client_api_request_updates_existing_note(): void { $note = Note::factory()->create(); $response = $this->postJson( @@ -512,7 +512,7 @@ class MicropubControllerTest extends TestCase } #[Test] - public function micropubClientApiRequestUpdatesNoteSyndicationLinks(): void + public function micropub_client_api_request_updates_note_syndication_links(): void { $note = Note::factory()->create(); $response = $this->postJson( @@ -539,7 +539,7 @@ class MicropubControllerTest extends TestCase } #[Test] - public function micropubClientApiRequestAddsImageToNote(): void + public function micropub_client_api_request_adds_image_to_note(): void { $note = Note::factory()->create(); $response = $this->postJson( @@ -562,7 +562,7 @@ class MicropubControllerTest extends TestCase } #[Test] - public function micropubClientApiRequestReturnsErrorTryingToUpdateNonNoteModel(): void + public function micropub_client_api_request_returns_error_trying_to_update_non_note_model(): void { $response = $this->postJson( '/api/post', @@ -581,7 +581,7 @@ class MicropubControllerTest extends TestCase } #[Test] - public function micropubClientApiRequestReturnsErrorTryingToUpdateNonExistingNote(): void + public function micropub_client_api_request_returns_error_trying_to_update_non_existing_note(): void { $response = $this->postJson( '/api/post', @@ -600,7 +600,7 @@ class MicropubControllerTest extends TestCase } #[Test] - public function micropubClientApiRequestReturnsErrorWhenTryingToUpdateUnsupportedProperty(): void + public function micropub_client_api_request_returns_error_when_trying_to_update_unsupported_property(): void { $note = Note::factory()->create(); $response = $this->postJson( @@ -620,7 +620,7 @@ class MicropubControllerTest extends TestCase } #[Test] - public function micropubClientApiRequestWithTokenWithInsufficientScopeReturnsError(): void + public function micropub_client_api_request_with_token_with_insufficient_scope_returns_error(): void { $response = $this->postJson( '/api/post', @@ -639,7 +639,7 @@ class MicropubControllerTest extends TestCase } #[Test] - public function micropubClientApiRequestCanReplaceNoteSyndicationTargets(): void + public function micropub_client_api_request_can_replace_note_syndication_targets(): void { $note = Note::factory()->create(); $response = $this->postJson( @@ -666,7 +666,7 @@ class MicropubControllerTest extends TestCase } #[Test] - public function micropubClientWebRequestCanEncodeTokenWithinTheForm(): void + public function micropub_client_web_request_can_encode_token_within_the_form(): void { $faker = Factory::create(); $note = $faker->text; @@ -684,7 +684,7 @@ class MicropubControllerTest extends TestCase } #[Test] - public function micropubClientApiRequestCreatesArticlesWhenItIncludesTheNameProperty(): void + public function micropub_client_api_request_creates_articles_when_it_includes_the_name_property(): void { $faker = Factory::create(); $name = $faker->text(50); diff --git a/tests/Feature/MicropubMediaTest.php b/tests/Feature/MicropubMediaTest.php index c38483f1..e11d8a1e 100644 --- a/tests/Feature/MicropubMediaTest.php +++ b/tests/Feature/MicropubMediaTest.php @@ -21,7 +21,7 @@ class MicropubMediaTest extends TestCase use TestToken; #[Test] - public function emptyResponseForLastUploadWhenNoneFound(): void + public function empty_response_for_last_upload_when_none_found(): void { // Make sure there’s no media $this->assertCount(0, Media::all()); @@ -35,7 +35,7 @@ class MicropubMediaTest extends TestCase } #[Test] - public function getRequestWithInvalidTokenReturnsErrorResponse(): void + public function get_request_with_invalid_token_returns_error_response(): void { $response = $this->get( '/api/media?q=last', @@ -46,7 +46,7 @@ class MicropubMediaTest extends TestCase } #[Test] - public function getRequestWithTokenWithoutScopeReturnsErrorResponse(): void + public function get_request_with_token_without_scope_returns_error_response(): void { $response = $this->get( '/api/media?q=last', @@ -57,7 +57,7 @@ class MicropubMediaTest extends TestCase } #[Test] - public function getRequestWithTokenWithInsufficientScopeReturnsErrorResponse(): void + public function get_request_with_token_with_insufficient_scope_returns_error_response(): void { $response = $this->get( '/api/media?q=last', @@ -68,7 +68,7 @@ class MicropubMediaTest extends TestCase } #[Test] - public function emptyGetRequestWithTokenReceivesOkResponse(): void + public function empty_get_request_with_token_receives_ok_response(): void { $response = $this->get( '/api/media', @@ -79,7 +79,7 @@ class MicropubMediaTest extends TestCase } #[Test] - public function clientCanListLastUpload(): void + public function client_can_list_last_upload(): void { Queue::fake(); $file = __DIR__ . '/../aaron.png'; @@ -108,7 +108,7 @@ class MicropubMediaTest extends TestCase } #[Test] - public function clientCanSourceUploads(): void + public function client_can_source_uploads(): void { Queue::fake(); $file = __DIR__ . '/../aaron.png'; @@ -140,7 +140,7 @@ class MicropubMediaTest extends TestCase } #[Test] - public function clientCanSourceUploadsWithLimit(): void + public function client_can_source_uploads_with_limit(): void { Queue::fake(); $file = __DIR__ . '/../aaron.png'; @@ -174,7 +174,7 @@ class MicropubMediaTest extends TestCase } #[Test] - public function mediaEndpointUploadRequiresFile(): void + public function media_endpoint_upload_requires_file(): void { $response = $this->post( '/api/media', @@ -190,7 +190,7 @@ class MicropubMediaTest extends TestCase } #[Test] - public function errorResponseForUnknownQValue(): void + public function error_response_for_unknown_q_value(): void { $response = $this->get( '/api/media?q=unknown', @@ -201,7 +201,7 @@ class MicropubMediaTest extends TestCase } #[Test] - public function optionsRequestReturnsCorsResponse(): void + public function options_request_returns_cors_response(): void { $response = $this->options('/api/media'); @@ -210,7 +210,7 @@ class MicropubMediaTest extends TestCase } #[Test] - public function mediaEndpointRequestWithInvalidTokenReturns400Response(): void + public function media_endpoint_request_with_invalid_token_returns400_response(): void { $response = $this->post( '/api/media', @@ -222,7 +222,7 @@ class MicropubMediaTest extends TestCase } #[Test] - public function mediaEndpointRequestWithTokenWithNoScopeReturns400Response(): void + public function media_endpoint_request_with_token_with_no_scope_returns400_response(): void { $response = $this->post( '/api/media', @@ -234,7 +234,7 @@ class MicropubMediaTest extends TestCase } #[Test] - public function mediaEndpointRequestWithInsufficientTokenScopesReturns401Response(): void + public function media_endpoint_request_with_insufficient_token_scopes_returns401_response(): void { $response = $this->post( '/api/media', @@ -248,7 +248,7 @@ class MicropubMediaTest extends TestCase } #[Test] - public function mediaEndpointUploadFile(): void + public function media_endpoint_upload_file(): void { Queue::fake(); $file = __DIR__ . '/../aaron.png'; @@ -271,7 +271,7 @@ class MicropubMediaTest extends TestCase } #[Test] - public function mediaEndpointUploadAudioFile(): void + public function media_endpoint_upload_audio_file(): void { Queue::fake(); $file = __DIR__ . '/../audio.mp3'; @@ -294,7 +294,7 @@ class MicropubMediaTest extends TestCase } #[Test] - public function mediaEndpointUploadVideoFile(): void + public function media_endpoint_upload_video_file(): void { Queue::fake(); $file = __DIR__ . '/../video.ogv'; @@ -317,7 +317,7 @@ class MicropubMediaTest extends TestCase } #[Test] - public function mediaEndpointUploadDocumentFile(): void + public function media_endpoint_upload_document_file(): void { Queue::fake(); @@ -339,7 +339,7 @@ class MicropubMediaTest extends TestCase } #[Test] - public function mediaEndpointUploadInvalidFileReturnsError(): void + public function media_endpoint_upload_invalid_file_returns_error(): void { Queue::fake(); Storage::fake('local'); diff --git a/tests/Feature/NotesControllerTest.php b/tests/Feature/NotesControllerTest.php index 90ccd553..ac3b08a4 100644 --- a/tests/Feature/NotesControllerTest.php +++ b/tests/Feature/NotesControllerTest.php @@ -18,7 +18,7 @@ class NotesControllerTest extends TestCase * mean the database is being hit. */ #[Test] - public function notesPageLoads(): void + public function notes_page_loads(): void { $response = $this->get('/notes'); $response->assertStatus(200); @@ -28,7 +28,7 @@ class NotesControllerTest extends TestCase * Test a specific note. */ #[Test] - public function specificNotePageLoads(): void + public function specific_note_page_loads(): void { $note = Note::factory()->create(); $response = $this->get($note->uri); @@ -47,7 +47,7 @@ class NotesControllerTest extends TestCase * Test that `/note/{decID}` redirects to `/notes/{nb60id}`. */ #[Test] - public function oldNoteUrlsRedirect(): void + public function old_note_urls_redirect(): void { $note = Note::factory()->create(); $response = $this->get('/note/' . $note->id); @@ -58,21 +58,21 @@ class NotesControllerTest extends TestCase * Visit the tagged page and check the tag view data. */ #[Test] - public function taggedNotesPageLoads(): void + public function tagged_notes_page_loads(): void { $response = $this->get('/notes/tagged/beer'); $response->assertViewHas('tag', 'beer'); } #[Test] - public function unknownNoteGives404(): void + public function unknown_note_gives404(): void { $response = $this->get('/notes/112233'); $response->assertNotFound(); } #[Test] - public function checkNoteIdNotOutOfRange(): void + public function check_note_id_not_out_of_range(): void { $response = $this->get('/notes/photou-photologo'); $response->assertNotFound(); diff --git a/tests/Feature/OwnYourGramTest.php b/tests/Feature/OwnYourGramTest.php index a1ff9026..b2edaf97 100644 --- a/tests/Feature/OwnYourGramTest.php +++ b/tests/Feature/OwnYourGramTest.php @@ -16,7 +16,7 @@ class OwnYourGramTest extends TestCase use TestToken; #[Test] - public function postingInstagramUrlSavesMediaPath(): void + public function posting_instagram_url_saves_media_path(): void { $response = $this->json( 'POST', diff --git a/tests/Feature/ParseCachedWebMentionsTest.php b/tests/Feature/ParseCachedWebMentionsTest.php index ae0e9b3c..ab66c6ac 100644 --- a/tests/Feature/ParseCachedWebMentionsTest.php +++ b/tests/Feature/ParseCachedWebMentionsTest.php @@ -27,7 +27,7 @@ class ParseCachedWebMentionsTest extends TestCase } #[Test] - public function parseWebmentionHtml(): void + public function parse_webmention_html(): void { $webmentionAaron = WebMention::factory()->create([ 'source' => 'https://aaronpk.localhost/reply/1', diff --git a/tests/Feature/PlacesTest.php b/tests/Feature/PlacesTest.php index c37e4239..26e16957 100644 --- a/tests/Feature/PlacesTest.php +++ b/tests/Feature/PlacesTest.php @@ -17,7 +17,7 @@ class PlacesTest extends TestCase * Test the `/places` page for OK response. */ #[Test] - public function placesPageLoads(): void + public function places_page_loads(): void { $response = $this->get('/places'); $response->assertStatus(200); @@ -27,7 +27,7 @@ class PlacesTest extends TestCase * Test a specific place. */ #[Test] - public function singlePlacePageLoads(): void + public function single_place_page_loads(): void { $place = Place::factory()->create(); $response = $this->get($place->uri); @@ -35,7 +35,7 @@ class PlacesTest extends TestCase } #[Test] - public function unknownPlaceGives404() + public function unknown_place_gives404() { $response = $this->get('/places/unknown'); $response->assertNotFound(); diff --git a/tests/Feature/ReDownloadWebMentionsTest.php b/tests/Feature/ReDownloadWebMentionsTest.php index f3ea0b6f..09fa1192 100644 --- a/tests/Feature/ReDownloadWebMentionsTest.php +++ b/tests/Feature/ReDownloadWebMentionsTest.php @@ -17,7 +17,7 @@ class ReDownloadWebMentionsTest extends TestCase use RefreshDatabase; #[Test] - public function downloadJobGetsQueued(): void + public function download_job_gets_queued(): void { Queue::fake(); diff --git a/tests/Feature/SearchTest.php b/tests/Feature/SearchTest.php index 582e8042..eea6a9e0 100644 --- a/tests/Feature/SearchTest.php +++ b/tests/Feature/SearchTest.php @@ -11,7 +11,7 @@ use Tests\TestCase; class SearchTest extends TestCase { #[Test] - public function searchEndpointReturnsResults(): void + public function search_endpoint_returns_results(): void { Note::factory(10)->create(); Note::Factory()->create(['note' => 'hello world']); diff --git a/tests/Feature/SwarmTest.php b/tests/Feature/SwarmTest.php index 84642009..76caa962 100644 --- a/tests/Feature/SwarmTest.php +++ b/tests/Feature/SwarmTest.php @@ -21,7 +21,7 @@ class SwarmTest extends TestCase * Given a check in to Foursquare, this is the content Ownyourswarm will post to us. */ #[Test] - public function mockedOwnyourswarmRequestWithFoursquare(): void + public function mocked_ownyourswarm_request_with_foursquare(): void { Queue::fake(); @@ -68,7 +68,7 @@ class SwarmTest extends TestCase * OpenStreetMap data. */ #[Test] - public function mockedOwnyourswarmRequestWithOsm(): void + public function mocked_ownyourswarm_request_with_osm(): void { Queue::fake(); @@ -110,7 +110,7 @@ class SwarmTest extends TestCase * This request would actually come from another client than OwnYourSwarm, as that would include a Foursquare URL */ #[Test] - public function mockedOwnyourswarmRequestWithoutKnownExternalUrl(): void + public function mocked_ownyourswarm_request_without_known_external_url(): void { Queue::fake(); @@ -149,7 +149,7 @@ class SwarmTest extends TestCase } #[Test] - public function mockedOwnyourswarmRequestWithNoTextContent(): void + public function mocked_ownyourswarm_request_with_no_text_content(): void { $response = $this->json( 'POST', @@ -186,7 +186,7 @@ class SwarmTest extends TestCase } #[Test] - public function mockedOwnyourswarmRequestSavesJustThePostWhenAnErrorOccursInTheCheckinData(): void + public function mocked_ownyourswarm_request_saves_just_the_post_when_an_error_occurs_in_the_checkin_data(): void { Queue::fake(); @@ -224,7 +224,7 @@ class SwarmTest extends TestCase } #[Test] - public function mockedOwnyourswarmRequestWithHAdrLocation(): void + public function mocked_ownyourswarm_request_with_h_adr_location(): void { Queue::fake(); @@ -270,7 +270,7 @@ class SwarmTest extends TestCase } #[Test] - public function ownyourswarmCheckinTestUsingRealData(): void + public function ownyourswarm_checkin_test_using_real_data(): void { $response = $this->json( 'POST', diff --git a/tests/Feature/TokenServiceTest.php b/tests/Feature/TokenServiceTest.php index 24f581b3..55024adf 100644 --- a/tests/Feature/TokenServiceTest.php +++ b/tests/Feature/TokenServiceTest.php @@ -19,7 +19,7 @@ class TokenServiceTest extends TestCase * the APP_KEY, to test, we shall create a token, and then verify it. */ #[Test] - public function tokenserviceCreatesAndValidatesTokens(): void + public function tokenservice_creates_and_validates_tokens(): void { $tokenService = new TokenService; $data = [ @@ -38,7 +38,7 @@ class TokenServiceTest extends TestCase } #[Test] - public function tokensWithDifferentSigningKeyThrowsException(): void + public function tokens_with_different_signing_key_throws_exception(): void { $this->expectException(RequiredConstraintsViolated::class); diff --git a/tests/Feature/WebMentionsControllerTest.php b/tests/Feature/WebMentionsControllerTest.php index 5d2908cc..184b5a9c 100644 --- a/tests/Feature/WebMentionsControllerTest.php +++ b/tests/Feature/WebMentionsControllerTest.php @@ -16,7 +16,7 @@ class WebMentionsControllerTest extends TestCase use RefreshDatabase; #[Test] - public function webmentionEndpointCanServeBrowserRequest(): void + public function webmention_endpoint_can_serve_browser_request(): void { $response = $this->get('/webmention'); $response->assertViewIs('webmention-endpoint'); @@ -26,7 +26,7 @@ class WebMentionsControllerTest extends TestCase * Test webmentions without source and target are rejected. */ #[Test] - public function webmentionsWithoutSourceAndTargetAreRejected(): void + public function webmentions_without_source_and_target_are_rejected(): void { $response = $this->call('POST', '/webmention', ['source' => 'https://example.org/post/123']); $response->assertStatus(400); @@ -38,7 +38,7 @@ class WebMentionsControllerTest extends TestCase * In this case an invalid target is a URL that doesn’t exist on our domain. */ #[Test] - public function invalidTargetReturnsErrorResponse(): void + public function invalid_target_returns_error_response(): void { $response = $this->call('POST', '/webmention', [ 'source' => 'https://example.org/post/123', @@ -51,7 +51,7 @@ class WebMentionsControllerTest extends TestCase * Test blog target gets a 501 response due to our not supporting it. */ #[Test] - public function blogTargetReturns501Response(): void + public function blog_target_returns501_response(): void { $response = $this->call('POST', '/webmention', [ 'source' => 'https://example.org/post/123', @@ -64,7 +64,7 @@ class WebMentionsControllerTest extends TestCase * Test that a non-existent note gives a 400 response. */ #[Test] - public function nonexistentNoteReturnsErrorResponse(): void + public function nonexistent_note_returns_error_response(): void { $response = $this->call('POST', '/webmention', [ 'source' => 'https://example.org/post/123', @@ -74,7 +74,7 @@ class WebMentionsControllerTest extends TestCase } #[Test] - public function legitimateWebmentionTriggersProcessWebmentionJob(): void + public function legitimate_webmention_triggers_process_webmention_job(): void { Queue::fake(); diff --git a/tests/Unit/ArticlesTest.php b/tests/Unit/ArticlesTest.php index a43a7006..9bb1dff1 100644 --- a/tests/Unit/ArticlesTest.php +++ b/tests/Unit/ArticlesTest.php @@ -15,7 +15,7 @@ class ArticlesTest extends TestCase use RefreshDatabase; #[Test] - public function titleSlugIsGeneratedAutomatically(): void + public function title_slug_is_generated_automatically(): void { $article = new Article; $article->title = 'My Title'; @@ -26,7 +26,7 @@ class ArticlesTest extends TestCase } #[Test] - public function markdownContentIsConverted(): void + public function markdown_content_is_converted(): void { $article = new Article; $article->main = 'Some *markdown*'; @@ -35,7 +35,7 @@ class ArticlesTest extends TestCase } #[Test] - public function weGenerateTheDifferentTimeAttributes(): void + public function we_generate_the_different_time_attributes(): void { $article = Article::create([ 'title' => 'Test', @@ -49,7 +49,7 @@ class ArticlesTest extends TestCase } #[Test] - public function weGenerateTheArticleLinkFromTheSlug(): void + public function we_generate_the_article_link_from_the_slug(): void { $article = Article::create([ 'title' => 'Test', @@ -64,7 +64,7 @@ class ArticlesTest extends TestCase } #[Test] - public function dateScopeReturnsExpectedArticles(): void + public function date_scope_returns_expected_articles(): void { Article::factory()->create([ 'created_at' => Carbon::now()->subYear()->toDateTimeString(), @@ -83,7 +83,7 @@ class ArticlesTest extends TestCase } #[Test] - public function dateScopeReturnsExpectedArticlesForDecember(): void + public function date_scope_returns_expected_articles_for_december(): void { Article::factory()->create([ 'created_at' => Carbon::now()->setDay(11)->setMonth(11)->toDateTimeString(), diff --git a/tests/Unit/BookmarksTest.php b/tests/Unit/BookmarksTest.php index 0f30267b..ce64848c 100644 --- a/tests/Unit/BookmarksTest.php +++ b/tests/Unit/BookmarksTest.php @@ -27,7 +27,7 @@ class BookmarksTest extends TestCase }*/ #[Test] - public function archiveLinkMethodCallsArchiveService(): void + public function archive_link_method_calls_archive_service(): void { $mock = new MockHandler([ new Response(200, ['Content-Location' => '/web/1234/example.org']), @@ -40,7 +40,7 @@ class BookmarksTest extends TestCase } #[Test] - public function archiveLinkMethodThrowsAnExceptionOnError(): void + public function archive_link_method_throws_an_exception_on_error(): void { $this->expectException(InternetArchiveException::class); @@ -54,7 +54,7 @@ class BookmarksTest extends TestCase } #[Test] - public function archiveLinkMethodThrowsAnExceptionIfNoLocationReturned(): void + public function archive_link_method_throws_an_exception_if_no_location_returned(): void { $this->expectException(InternetArchiveException::class); diff --git a/tests/Unit/HelpersTest.php b/tests/Unit/HelpersTest.php index 601296ff..2da28a7d 100644 --- a/tests/Unit/HelpersTest.php +++ b/tests/Unit/HelpersTest.php @@ -11,7 +11,7 @@ use Tests\TestCase; class HelpersTest extends TestCase { #[Test] - public function normalizeUrlIsIdempotent(): void + public function normalize_url_is_idempotent(): void { $input = 'http://example.org:80/index.php?foo=bar&baz=1'; $this->assertEquals(normalize_url(normalize_url($input)), normalize_url($input)); @@ -19,13 +19,13 @@ class HelpersTest extends TestCase #[Test] #[DataProvider('urlProvider')] - public function normalizeUrlOnDataProvider(string $input, string $output): void + public function normalize_url_on_data_provider(string $input, string $output): void { $this->assertEquals($output, normalize_url($input)); } #[Test] - public function prettyPrintJson(): void + public function pretty_print_json(): void { // phpcs:disable Generic.Files.LineLength.TooLong $json = <<<'JSON' diff --git a/tests/Unit/Jobs/AddClientToDatabaseJobTest.php b/tests/Unit/Jobs/AddClientToDatabaseJobTest.php index af07901b..3ed4d3d3 100644 --- a/tests/Unit/Jobs/AddClientToDatabaseJobTest.php +++ b/tests/Unit/Jobs/AddClientToDatabaseJobTest.php @@ -14,7 +14,7 @@ class AddClientToDatabaseJobTest extends TestCase use RefreshDatabase; #[Test] - public function clientIsAddedToDatabaseByJob(): void + public function client_is_added_to_database_by_job(): void { $job = new AddClientToDatabase('https://example.org/client'); $job->handle(); diff --git a/tests/Unit/Jobs/DownloadWebMentionJobTest.php b/tests/Unit/Jobs/DownloadWebMentionJobTest.php index 6e11a49c..3aee7810 100644 --- a/tests/Unit/Jobs/DownloadWebMentionJobTest.php +++ b/tests/Unit/Jobs/DownloadWebMentionJobTest.php @@ -25,7 +25,7 @@ class DownloadWebMentionJobTest extends TestCase } #[Test] - public function htmlIsSavedByJob(): void + public function html_is_saved_by_job(): void { $this->assertFileDoesNotExist(storage_path('HTML/https')); $source = 'https://example.org/reply/1'; @@ -53,7 +53,7 @@ class DownloadWebMentionJobTest extends TestCase } #[Test] - public function htmlAndBackupSavedByJob(): void + public function html_and_backup_saved_by_job(): void { $this->assertFileDoesNotExist(storage_path('HTML/https')); $source = 'https://example.org/reply/1'; @@ -88,7 +88,7 @@ class DownloadWebMentionJobTest extends TestCase } #[Test] - public function indexHtmlFileIsSavedByJobForUrlsEndingWithSlash(): void + public function index_html_file_is_saved_by_job_for_urls_ending_with_slash(): void { $this->assertFileDoesNotExist(storage_path('HTML/https')); $source = 'https://example.org/reply-one/'; diff --git a/tests/Unit/Jobs/ProcessBookmarkJobTest.php b/tests/Unit/Jobs/ProcessBookmarkJobTest.php index f433270b..5be0dd40 100644 --- a/tests/Unit/Jobs/ProcessBookmarkJobTest.php +++ b/tests/Unit/Jobs/ProcessBookmarkJobTest.php @@ -19,7 +19,7 @@ class ProcessBookmarkJobTest extends TestCase use RefreshDatabase; #[Test] - public function archiveLinkIsSavedByJobAndScreenshotJobIsQueued(): void + public function archive_link_is_saved_by_job_and_screenshot_job_is_queued(): void { Queue::fake(); @@ -40,7 +40,7 @@ class ProcessBookmarkJobTest extends TestCase } #[Test] - public function archiveLinkSavedAsNullWhenExceptionThrown(): void + public function archive_link_saved_as_null_when_exception_thrown(): void { Queue::fake(); diff --git a/tests/Unit/Jobs/ProcessMediaJobTest.php b/tests/Unit/Jobs/ProcessMediaJobTest.php index daecc00e..e3fa2059 100644 --- a/tests/Unit/Jobs/ProcessMediaJobTest.php +++ b/tests/Unit/Jobs/ProcessMediaJobTest.php @@ -13,7 +13,7 @@ use Tests\TestCase; class ProcessMediaJobTest extends TestCase { #[Test] - public function nonMediaFilesAreNotSaved(): void + public function non_media_files_are_not_saved(): void { $manager = app()->make(ImageManager::class); Storage::disk('local')->put('media/file.txt', 'This is not an image'); @@ -24,7 +24,7 @@ class ProcessMediaJobTest extends TestCase } #[Test] - public function smallImagesAreNotResized(): void + public function small_images_are_not_resized(): void { $manager = app()->make(ImageManager::class); Storage::disk('local')->put('media/aaron.png', file_get_contents(__DIR__ . '/../../aaron.png')); @@ -39,7 +39,7 @@ class ProcessMediaJobTest extends TestCase } #[Test] - public function largeImagesHaveSmallerImagesCreated(): void + public function large_images_have_smaller_images_created(): void { $manager = app()->make(ImageManager::class); Storage::disk('local')->put('media/test-image.jpg', file_get_contents(__DIR__.'/../../test-image.jpg')); diff --git a/tests/Unit/Jobs/ProcessWebMentionJobTest.php b/tests/Unit/Jobs/ProcessWebMentionJobTest.php index a67ef15e..e3754b86 100644 --- a/tests/Unit/Jobs/ProcessWebMentionJobTest.php +++ b/tests/Unit/Jobs/ProcessWebMentionJobTest.php @@ -34,7 +34,7 @@ class ProcessWebMentionJobTest extends TestCase } #[Test] - public function failureGettingWebmentionThrowsAnException(): void + public function failure_getting_webmention_throws_an_exception(): void { $this->expectException(RemoteContentNotFoundException::class); @@ -53,7 +53,7 @@ class ProcessWebMentionJobTest extends TestCase } #[Test] - public function newWebmentionGetsSavedByJob(): void + public function new_webmention_gets_saved_by_job(): void { Queue::fake(); @@ -85,7 +85,7 @@ class ProcessWebMentionJobTest extends TestCase } #[Test] - public function existingWebmentionGetsUpdatedByJob(): void + public function existing_webmention_gets_updated_by_job(): void { Queue::fake(); @@ -122,7 +122,7 @@ class ProcessWebMentionJobTest extends TestCase } #[Test] - public function webmentionReplyGetsDeletedWhenReplyToValueChanges(): void + public function webmention_reply_gets_deleted_when_reply_to_value_changes(): void { $parser = new Parser; @@ -159,7 +159,7 @@ class ProcessWebMentionJobTest extends TestCase } #[Test] - public function webmentionLikeGetsDeletedWhenLikeOfValueChanges(): void + public function webmention_like_gets_deleted_when_like_of_value_changes(): void { $parser = new Parser; @@ -196,7 +196,7 @@ class ProcessWebMentionJobTest extends TestCase } #[Test] - public function webmentionRepostGetsDeletedWhenRepostOfValueChanges(): void + public function webmention_repost_gets_deleted_when_repost_of_value_changes(): void { $parser = new Parser; diff --git a/tests/Unit/Jobs/SaveProfileImageJobTest.php b/tests/Unit/Jobs/SaveProfileImageJobTest.php index 3c418a7a..67d441fa 100644 --- a/tests/Unit/Jobs/SaveProfileImageJobTest.php +++ b/tests/Unit/Jobs/SaveProfileImageJobTest.php @@ -26,7 +26,7 @@ class SaveProfileImageJobTest extends TestCase } #[Test] - public function authorshipAlgorithmReturnsNullOnException(): void + public function authorship_algorithm_returns_null_on_exception(): void { $mf = ['items' => []]; $authorship = $this->createMock(Authorship::class); @@ -38,7 +38,7 @@ class SaveProfileImageJobTest extends TestCase } #[Test] - public function weDoNotProcessTwitterImages(): void + public function we_do_not_process_twitter_images(): void { $mf = ['items' => []]; $author = [ @@ -56,7 +56,7 @@ class SaveProfileImageJobTest extends TestCase } #[Test] - public function remoteAuthorImagesAreSavedLocally(): void + public function remote_author_images_are_saved_locally(): void { $mock = new MockHandler([ new Response(200, ['Content-Type' => 'image/jpeg'], 'fake jpeg image'), @@ -81,7 +81,7 @@ class SaveProfileImageJobTest extends TestCase } #[Test] - public function localDefaultAuthorImageIsUsedAsFallback(): void + public function local_default_author_image_is_used_as_fallback(): void { $mock = new MockHandler([ new Response(404), @@ -109,7 +109,7 @@ class SaveProfileImageJobTest extends TestCase } #[Test] - public function weGetUrlFromPhotoObjectIfAltTextIsProvided(): void + public function we_get_url_from_photo_object_if_alt_text_is_provided(): void { $mock = new MockHandler([ new Response(200, ['Content-Type' => 'image/jpeg'], 'fake jpeg image'), @@ -137,7 +137,7 @@ class SaveProfileImageJobTest extends TestCase } #[Test] - public function useFirstUrlIfMultipleHomepagesAreProvided(): void + public function use_first_url_if_multiple_homepages_are_provided(): void { $mock = new MockHandler([ new Response(200, ['Content-Type' => 'image/jpeg'], 'fake jpeg image'), diff --git a/tests/Unit/Jobs/SaveScreenshotJobTest.php b/tests/Unit/Jobs/SaveScreenshotJobTest.php index b2c3ef15..f8066bbd 100644 --- a/tests/Unit/Jobs/SaveScreenshotJobTest.php +++ b/tests/Unit/Jobs/SaveScreenshotJobTest.php @@ -21,7 +21,7 @@ class SaveScreenshotJobTest extends TestCase use RefreshDatabase; #[Test] - public function screenshotIsSavedByJob(): void + public function screenshot_is_saved_by_job(): void { Storage::fake('public'); $guzzleMock = new MockHandler([ @@ -86,7 +86,7 @@ class SaveScreenshotJobTest extends TestCase } #[Test] - public function screenshotJobHandlesUnfinishedTasks(): void + public function screenshot_job_handles_unfinished_tasks(): void { Storage::fake('public'); $guzzleMock = new MockHandler([ diff --git a/tests/Unit/Jobs/SendWebMentionJobTest.php b/tests/Unit/Jobs/SendWebMentionJobTest.php index 9eef719b..7bfd24a1 100644 --- a/tests/Unit/Jobs/SendWebMentionJobTest.php +++ b/tests/Unit/Jobs/SendWebMentionJobTest.php @@ -16,7 +16,7 @@ use Tests\TestCase; class SendWebMentionJobTest extends TestCase { #[Test] - public function discoverWebmentionEndpointOnOwnDomain(): void + public function discover_webmention_endpoint_on_own_domain(): void { $note = new Note; $job = new SendWebMentions($note); @@ -25,7 +25,7 @@ class SendWebMentionJobTest extends TestCase } #[Test] - public function discoverWebmentionEndpointFromHeaderLinks(): void + public function discover_webmention_endpoint_from_header_links(): void { $url = 'https://example.org/webmention'; $mock = new MockHandler([ @@ -40,7 +40,7 @@ class SendWebMentionJobTest extends TestCase } #[Test] - public function discoverWebmentionEndpointFromHtmlLinkTags(): void + public function discover_webmention_endpoint_from_html_link_tags(): void { $html = ''; $mock = new MockHandler([ @@ -58,7 +58,7 @@ class SendWebMentionJobTest extends TestCase } #[Test] - public function discoverWebmentionEndpointFromLegacyHtmlMarkup(): void + public function discover_webmention_endpoint_from_legacy_html_markup(): void { $html = ''; $mock = new MockHandler([ @@ -76,14 +76,14 @@ class SendWebMentionJobTest extends TestCase } #[Test] - public function ensureEmptyNoteDoesNotTriggerAnyActions(): void + public function ensure_empty_note_does_not_trigger_any_actions(): void { $job = new SendWebMentions(new Note); $this->assertNull($job->handle()); } #[Test] - public function weResolveRelativeUris(): void + public function we_resolve_relative_uris(): void { $uri = '/blog/post'; $base = 'https://example.org/'; @@ -92,7 +92,7 @@ class SendWebMentionJobTest extends TestCase } #[Test] - public function weSendAWebmentionForANote(): void + public function we_send_a_webmention_for_a_note(): void { $html = ''; $mock = new MockHandler([ @@ -112,7 +112,7 @@ class SendWebMentionJobTest extends TestCase } #[Test] - public function linksInNotesCanNotSupportWebmentions(): void + public function links_in_notes_can_not_support_webmentions(): void { $mock = new MockHandler([ // URLs with commas currently break the parse function I’m using diff --git a/tests/Unit/Jobs/SyndicateNoteToBlueskyJobTest.php b/tests/Unit/Jobs/SyndicateNoteToBlueskyJobTest.php index 2dbae153..e225cbf2 100644 --- a/tests/Unit/Jobs/SyndicateNoteToBlueskyJobTest.php +++ b/tests/Unit/Jobs/SyndicateNoteToBlueskyJobTest.php @@ -19,7 +19,7 @@ class SyndicateNoteToBlueskyJobTest extends TestCase use RefreshDatabase; #[Test] - public function weSyndicateNotesToBluesky(): void + public function we_syndicate_notes_to_bluesky(): void { config(['bridgy.bluesky_token' => 'test']); $faker = Factory::create(); @@ -40,7 +40,7 @@ class SyndicateNoteToBlueskyJobTest extends TestCase } #[Test] - public function weSyndicateTheOriginalMarkdownToBluesky(): void + public function we_syndicate_the_original_markdown_to_bluesky(): void { config(['bridgy.bluesky_token' => 'test']); $faker = Factory::create(); diff --git a/tests/Unit/Jobs/SyndicateNoteToMastodonJobTest.php b/tests/Unit/Jobs/SyndicateNoteToMastodonJobTest.php index d7215223..47ecdd97 100644 --- a/tests/Unit/Jobs/SyndicateNoteToMastodonJobTest.php +++ b/tests/Unit/Jobs/SyndicateNoteToMastodonJobTest.php @@ -19,7 +19,7 @@ class SyndicateNoteToMastodonJobTest extends TestCase use RefreshDatabase; #[Test] - public function weSyndicateNotesToMastodon(): void + public function we_syndicate_notes_to_mastodon(): void { config(['bridgy.mastodon_token' => 'test']); $faker = Factory::create(); @@ -40,7 +40,7 @@ class SyndicateNoteToMastodonJobTest extends TestCase } #[Test] - public function weSyndicateTheOriginalMarkdown(): void + public function we_syndicate_the_original_markdown(): void { config(['bridgy.mastodon_token' => 'test']); $faker = Factory::create(); diff --git a/tests/Unit/LikesTest.php b/tests/Unit/LikesTest.php index 073d1ca4..74412833 100644 --- a/tests/Unit/LikesTest.php +++ b/tests/Unit/LikesTest.php @@ -14,7 +14,7 @@ class LikesTest extends TestCase use RefreshDatabase; #[Test] - public function weCanSetTheAuthorUrl(): void + public function we_can_set_the_author_url(): void { $like = new Like; $like->author_url = 'https://joe.bloggs/'; @@ -22,7 +22,7 @@ class LikesTest extends TestCase } #[Test] - public function weDoNotModifyPlainTextContent(): void + public function we_do_not_modify_plain_text_content(): void { $like = new Like; $like->url = 'https://example.org/post/123'; @@ -33,7 +33,7 @@ class LikesTest extends TestCase } #[Test] - public function weCanHandleBlankContent(): void + public function we_can_handle_blank_content(): void { $like = new Like; $like->url = 'https://example.org/post/123'; @@ -44,7 +44,7 @@ class LikesTest extends TestCase } #[Test] - public function htmlLikeContentIsFiltered(): void + public function html_like_content_is_filtered(): void { $htmlEvil = <<<'HTML'
diff --git a/tests/Unit/MediaTest.php b/tests/Unit/MediaTest.php index 4dd4c256..642d797f 100644 --- a/tests/Unit/MediaTest.php +++ b/tests/Unit/MediaTest.php @@ -15,7 +15,7 @@ class MediaTest extends TestCase use RefreshDatabase; #[Test] - public function getTheNoteThatMediaInstanceBelongsTo(): void + public function get_the_note_that_media_instance_belongs_to(): void { $media = Media::factory()->for(Note::factory())->create(); @@ -23,7 +23,7 @@ class MediaTest extends TestCase } #[Test] - public function absoluteUrlsAreReturnedUnmodified(): void + public function absolute_urls_are_returned_unmodified(): void { $absoluteUrl = 'https://instagram-cdn.com/image/uuid'; $media = new Media; diff --git a/tests/Unit/MicropubClientsTest.php b/tests/Unit/MicropubClientsTest.php index d3bc0e01..c6c2d322 100644 --- a/tests/Unit/MicropubClientsTest.php +++ b/tests/Unit/MicropubClientsTest.php @@ -15,7 +15,7 @@ class MicropubClientsTest extends TestCase use RefreshDatabase; #[Test] - public function weCanGetNotesRelatingToClient(): void + public function we_can_get_notes_relating_to_client(): void { $client = MicropubClient::factory()->make(); diff --git a/tests/Unit/NotesTest.php b/tests/Unit/NotesTest.php index 6cf0b5e5..e71f513a 100644 --- a/tests/Unit/NotesTest.php +++ b/tests/Unit/NotesTest.php @@ -28,7 +28,7 @@ class NotesTest extends TestCase * relevant sub-methods. */ #[Test] - public function getNoteAttributeMethodCallsSubMethods(): void + public function get_note_attribute_method_calls_sub_methods(): void { // phpcs:ignore $expected = '

Having a at the local. 🍺

' . PHP_EOL; @@ -42,7 +42,7 @@ class NotesTest extends TestCase * Look for a default image in the contact’s h-card for the makeHCards method. */ #[Test] - public function defaultImageUsedAsFallbackInMakehcardsMethod(): void + public function default_image_used_as_fallback_in_makehcards_method(): void { // phpcs:ignore $expected = '

Hi @@ -71,7 +71,7 @@ class NotesTest extends TestCase * Look for a specific profile image in the contact’s h-card. */ #[Test] - public function specificProfileImageUsedInMakehcardsMethod(): void + public function specific_profile_image_used_in_makehcards_method(): void { Contact::factory()->create([ 'nick' => 'aaron', @@ -106,7 +106,7 @@ class NotesTest extends TestCase * Look for twitter URL when there’s no associated contact. */ #[Test] - public function twitterLinkIsCreatedWhenNoContactFound(): void + public function twitter_link_is_created_when_no_contact_found(): void { $expected = '

Hi @bob

' . PHP_EOL; $note = Note::factory()->create([ @@ -116,7 +116,7 @@ class NotesTest extends TestCase } #[Test] - public function weGetLatitudeLongitudeValuesOfAssociatedPlaceOfNote(): void + public function we_get_latitude_longitude_values_of_associated_place_of_note(): void { $place = Place::factory()->create([ 'latitude' => '53.4983', @@ -130,7 +130,7 @@ class NotesTest extends TestCase } #[Test] - public function whenNoAssociatedPlaceWeGetNullForLatitudeLongitudeValues(): void + public function when_no_associated_place_we_get_null_for_latitude_longitude_values(): void { $note = Note::factory()->create(); $this->assertNull($note->latitude); @@ -138,7 +138,7 @@ class NotesTest extends TestCase } #[Test] - public function weCanGetAddressAttributeForAssociatedPlace(): void + public function we_can_get_address_attribute_for_associated_place(): void { $place = Place::factory()->create([ 'name' => 'The Bridgewater Pub', @@ -152,7 +152,7 @@ class NotesTest extends TestCase } #[Test] - public function deletingNotesAlsoDeletesTagsViaTheEventObserver(): void + public function deleting_notes_also_deletes_tags_via_the_event_observer(): void { // first we’ll create a temporary note to delete $note = Note::create(['note' => 'temporary #temp']); @@ -167,7 +167,7 @@ class NotesTest extends TestCase } #[Test] - public function saveBlankNotesAsNull(): void + public function save_blank_notes_as_null(): void { $note = new Note(['note' => '']); @@ -175,7 +175,7 @@ class NotesTest extends TestCase } #[Test] - public function reverseGeocodeAnAttraction(): void + public function reverse_geocode_an_attraction(): void { // phpcs:disable Generic.Files.LineLength.TooLong $json = <<create([ 'type' => 'image', @@ -317,7 +317,7 @@ class NotesTest extends TestCase } #[Test] - public function addVideoElementToNoteContentWhenMediaAssociated(): void + public function add_video_element_to_note_content_when_media_associated(): void { $media = Media::factory()->create([ 'type' => 'video', @@ -334,7 +334,7 @@ class NotesTest extends TestCase } #[Test] - public function addAudioElementToNoteContentWhenMediaAssociated(): void + public function add_audio_element_to_note_content_when_media_associated(): void { $media = Media::factory()->create([ 'type' => 'audio', @@ -354,7 +354,7 @@ class NotesTest extends TestCase * @todo Why do we need to provide text? */ #[Test] - public function provideTextForBlankContent(): void + public function provide_text_for_blank_content(): void { $note = new Note; @@ -387,7 +387,7 @@ class NotesTest extends TestCase * For now, just reply on a cached object instead of actually querying Twitter. */ #[Test] - public function checkInReplyToIsTwitterLink(): void + public function check_in_reply_to_is_twitter_link(): void { $tempContent = (object) [ 'html' => 'something random', @@ -402,7 +402,7 @@ class NotesTest extends TestCase } #[Test] - public function latitudeAndLongitudeCanBeParsedFromPlainLocation(): void + public function latitude_and_longitude_can_be_parsed_from_plain_location(): void { $note = Note::factory()->create([ 'location' => '1.23,4.56', @@ -413,7 +413,7 @@ class NotesTest extends TestCase } #[Test] - public function addressAttributeCanBeRetrievedFromPlainLocation(): void + public function address_attribute_can_be_retrieved_from_plain_location(): void { Cache::put('1.23,4.56', 'Antarctica'); @@ -425,7 +425,7 @@ class NotesTest extends TestCase } #[Test] - public function mastodonUsernamesAreParsedCorrectly(): void + public function mastodon_usernames_are_parsed_correctly(): void { $expected = '

Hi @freekmurze@phpc.social how are you?

' . PHP_EOL; $note = Note::factory()->create([ diff --git a/tests/Unit/PlacesTest.php b/tests/Unit/PlacesTest.php index 470cc869..cb100ee1 100644 --- a/tests/Unit/PlacesTest.php +++ b/tests/Unit/PlacesTest.php @@ -18,7 +18,7 @@ class PlacesTest extends TestCase use RefreshDatabase; #[Test] - public function canRetrieveAssociatedNotes(): void + public function can_retrieve_associated_notes(): void { $place = Place::factory()->create(); Note::factory(5)->create([ @@ -29,7 +29,7 @@ class PlacesTest extends TestCase } #[Test] - public function nearMethodReturnsCollection(): void + public function near_method_returns_collection(): void { Place::factory()->create([ 'name' => 'The Bridgewater Pub', @@ -41,7 +41,7 @@ class PlacesTest extends TestCase } #[Test] - public function getUri(): void + public function get_uri(): void { $place = Place::factory()->create([ 'name' => 'The Bridgewater Pub', @@ -50,7 +50,7 @@ class PlacesTest extends TestCase } #[Test] - public function placeServiceReturnsExistingPlaceBasedOnExternalUrlsSearch(): void + public function place_service_returns_existing_place_based_on_external_urls_search(): void { Place::factory(10)->create(); @@ -70,7 +70,7 @@ class PlacesTest extends TestCase } #[Test] - public function placeServiceRequiresNameWhenCreatingNewPlace(): void + public function place_service_requires_name_when_creating_new_place(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Missing required name'); @@ -80,7 +80,7 @@ class PlacesTest extends TestCase } #[Test] - public function placeServiceRequiresLatitudeWhenCreatingNewPlace(): void + public function place_service_requires_latitude_when_creating_new_place(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Missing required longitude/latitude'); @@ -90,7 +90,7 @@ class PlacesTest extends TestCase } #[Test] - public function placeServiceCanUpdateExternalUrls(): void + public function place_service_can_update_external_urls(): void { $place = Place::factory()->create([ 'name' => 'The Bridgewater Pub', diff --git a/tests/Unit/TagsTest.php b/tests/Unit/TagsTest.php index 4d9dcdd0..2dd76911 100644 --- a/tests/Unit/TagsTest.php +++ b/tests/Unit/TagsTest.php @@ -17,7 +17,7 @@ class TagsTest extends TestCase use RefreshDatabase; #[Test] - public function canGetAssociatedNotes(): void + public function can_get_associated_notes(): void { $note = Note::factory()->create(); $tag = Tag::factory()->create(); @@ -26,7 +26,7 @@ class TagsTest extends TestCase } #[Test] - public function canGetAssociatedBookmarks(): void + public function can_get_associated_bookmarks(): void { $bookmark = Bookmark::factory()->create(); $tag = Tag::factory()->create(); @@ -36,7 +36,7 @@ class TagsTest extends TestCase #[Test] #[DataProvider('tagsProvider')] - public function canNormalize(string $input, string $expected): void + public function can_normalize(string $input, string $expected): void { $this->assertSame($expected, Tag::normalize($input)); } diff --git a/tests/Unit/WebMentionTest.php b/tests/Unit/WebMentionTest.php index 7a6ce471..edfd4026 100644 --- a/tests/Unit/WebMentionTest.php +++ b/tests/Unit/WebMentionTest.php @@ -18,7 +18,7 @@ class WebMentionTest extends TestCase use RefreshDatabase; #[Test] - public function commentableMethodLinksToNotes(): void + public function commentable_method_links_to_notes(): void { $note = Note::factory()->create(); $webmention = WebMention::factory()->make([ @@ -29,7 +29,7 @@ class WebMentionTest extends TestCase } #[Test] - public function publishedAttributeUsesUpdatedAtWhenNoRelevantMf2Data(): void + public function published_attribute_uses_updated_at_when_no_relevant_mf2_data(): void { $webmention = new WebMention; $updated_at = Carbon::now(); @@ -38,7 +38,7 @@ class WebMentionTest extends TestCase } #[Test] - public function publishedAttributeUsesUpdatedAtWhenErrorParsingMf2Data(): void + public function published_attribute_uses_updated_at_when_error_parsing_mf2_data(): void { $webmention = new WebMention; $updated_at = Carbon::now(); @@ -56,7 +56,7 @@ class WebMentionTest extends TestCase } #[Test] - public function createPhotoLinkDoesNothingWithGenericUrlAndNoLocallySavedImage(): void + public function create_photo_link_does_nothing_with_generic_url_and_no_locally_saved_image(): void { $webmention = new WebMention; $homepage = 'https://example.org/profile.png'; @@ -65,7 +65,7 @@ class WebMentionTest extends TestCase } #[Test] - public function createPhotoLinkReturnsLocallySavedImageUrlIfItExists(): void + public function create_photo_link_returns_locally_saved_image_url_if_it_exists(): void { $webmention = new WebMention; $homepage = 'https://aaronparecki.com/profile.png'; @@ -74,7 +74,7 @@ class WebMentionTest extends TestCase } #[Test] - public function createPhotoLinkDealsWithSpecialCaseOfDirectTwitterPhotoLinks(): void + public function create_photo_link_deals_with_special_case_of_direct_twitter_photo_links(): void { $webmention = new WebMention; $twitterProfileImage = 'http://pbs.twimg.com/1234'; @@ -83,7 +83,7 @@ class WebMentionTest extends TestCase } #[Test] - public function createPhotoLinkReturnsCachedTwitterPhotoLinks(): void + public function create_photo_link_returns_cached_twitter_photo_links(): void { $webmention = new WebMention; $twitterURL = 'https://twitter.com/example'; @@ -93,7 +93,7 @@ class WebMentionTest extends TestCase } #[Test] - public function createPhotoLinkResolvesTwitterPhotoLinks(): void + public function create_photo_link_resolves_twitter_photo_links(): void { $info = (object) [ 'profile_image_url_https' => 'https://pbs.twimg.com/static_profile_link.jpg', @@ -118,14 +118,14 @@ class WebMentionTest extends TestCase } #[Test] - public function getReplyAttributeDefaultsToNull(): void + public function get_reply_attribute_defaults_to_null(): void { $webmention = new WebMention; $this->assertNull($webmention->reply); } #[Test] - public function getReplyAttributeWithMf2WithoutHtmlReturnsNull(): void + public function get_reply_attribute_with_mf2_without_html_returns_null(): void { $webmention = new WebMention; $webmention->mf2 = json_encode(['no_html' => 'found_here']); -- 2.49.0