Remove short domain #34

Merged
jonny merged 2 commits from remove_short_domain into develop 2025-04-06 18:27:13 +02:00
69 changed files with 514 additions and 703 deletions

View file

@ -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,
);

View file

@ -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, [

View file

@ -1,55 +0,0 @@
<?php
declare(strict_types=1);
namespace App\Http\Controllers;
use Illuminate\Http\RedirectResponse;
/**
* @psalm-suppress UnusedClass
*/
class ShortURLsController extends Controller
{
/*
|--------------------------------------------------------------------------
| Short URL Controller
|--------------------------------------------------------------------------
|
| This redirects the short urls to long ones
|
*/
/**
* Redirect from '/' to the long url.
*/
public function baseURL(): RedirectResponse
{
return redirect(config('app.url'));
}
/**
* Redirect from '/@' to a twitter profile.
*/
public function twitter(): RedirectResponse
{
return redirect('https://twitter.com/jonnybarnes');
}
/**
* Redirect a short url of this site out to a long one based on post type.
*
* Further redirects may happen.
*/
public function expandType(string $type, string $postId): RedirectResponse
{
if ($type === 't') {
$type = 'notes';
}
if ($type === 'b') {
$type = 'blog/s';
}
return redirect(config('app.url') . '/' . $type . '/' . $postId);
}
}

View file

@ -53,7 +53,7 @@ class ProcessWebMention implements ShouldQueue
// check webmention still references target
// we try each type of mention (reply/like/repost)
if ($webmention->type === 'in-reply-to') {
if ($parser->checkInReplyTo($microformats, $this->note->longurl) === false) {
if ($parser->checkInReplyTo($microformats, $this->note->uri) === false) {
// it doesnt 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 doesnt so delete
$webmention->delete();
@ -75,7 +75,7 @@ class ProcessWebMention implements ShouldQueue
} // note we dont 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 doesnt 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;

View file

@ -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
{
// lets 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/')) {

View file

@ -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,

View file

@ -124,7 +124,7 @@ class Note extends Model
public function getNoteAttribute(?string $value): ?string
{
if ($value === null && $this->place !== null) {
$value = '📍: <a href="' . $this->place->longurl . '">' . $this->place->name . '</a>';
$value = '📍: <a href="' . $this->place->uri . '">' . $this->place->name . '</a>';
}
// 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();

View file

@ -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'],
);
}

View file

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

View file

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

View file

@ -1,32 +0,0 @@
<?php
/*
* Here we set the long and short URLs our app shall use
* You can override these settings in the .env file
*/
return [
/*
|--------------------------------------------------------------------------
| Application Long URL
|--------------------------------------------------------------------------
|
| The long URL for the application
|
*/
'longurl' => env('APP_LONGURL', 'longurl.local'),
/*
|--------------------------------------------------------------------------
| Application Short URL
|--------------------------------------------------------------------------
|
| The short URL for the application
|
*/
'shorturl' => env('APP_SHORTURL', 'shorturl.local'),
];

View file

@ -3,7 +3,7 @@
<channel>
<title>{{ config('user.display_name') }}</title>
<atom:link href="{{ config('app.url') }}/blog/feed.rss" rel="self" type="application/rss+xml" />
<description>An RSS feed of the blog posts found on {{ config('url.longurl') }}</description>
<description>An RSS feed of the blog posts found on {{ config('app.url') }}</description>
<link>{{ config('app.url') }}/blog</link>
<lastBuildDate>{{ $buildDate }}</lastBuildDate>
<ttl>1800</ttl>

View file

@ -7,15 +7,15 @@
@foreach($bookmarks as $bookmark)
<div class="h-entry">
<div class="bookmark-link">
<a class="u-bookmark-of<?php if ($bookmark->name !== null) { echo ' h-cite'; } ?>" href="{{ $bookmark->url }}">
<a class="u-bookmark-of<?php if ($bookmark->name !== null) { echo ' h-cite'; } ?>" href="{{ $bookmark->uri }}">
@isset($bookmark->name)
{{ $bookmark->name }}
@endisset
@empty($bookmark->name)
{{ $bookmark->url }}
{{ $bookmark->uri }}
@endempty
</a> &nbsp; <a href="{{ $bookmark->longurl }}">🔗</a>
</a> &nbsp; <a href="{{ $bookmark->uri }}">🔗</a>
</div>
@isset($bookmark->content)
<p>{{ $bookmark->content }}</p>

View file

@ -8,15 +8,15 @@
@foreach($bookmarks as $bookmark)
<div class="h-entry">
<div class="bookmark-link">
<a class="u-bookmark-of<?php if ($bookmark->name !== null) { echo ' h-cite'; } ?>" href="{{ $bookmark->url }}">
<a class="u-bookmark-of<?php if ($bookmark->name !== null) { echo ' h-cite'; } ?>" href="{{ $bookmark->uri }}">
@isset($bookmark->name)
{{ $bookmark->name }}
@endisset
@empty($bookmark->name)
{{ $bookmark->url }}
{{ $bookmark->uri }}
@endempty
</a> &nbsp; <a href="{{ $bookmark->longurl }}">🔗</a>
</a> &nbsp; <a href="{{ $bookmark->uri }}">🔗</a>
</div>
@isset($bookmark->content)
<p>{{ $bookmark->content }}</p>

View file

@ -8,8 +8,8 @@
@foreach($notes as $note)
<entry>
<title>{{ strip_tags($note->note) }}</title>
<link href="{{ $note->longurl }}" />
<id>{{ $note->longurl }}</id>
<link href="{{ $note->uri }}" />
<id>{{ $note->uri }}</id>
<updated>{{ $note->updated_at->toAtomString() }}</updated>
<content type="html">{{ $note->note }}</content>
<author>

View file

@ -3,7 +3,7 @@
<channel>
<title>{{ config('user.display_name') }}</title>
<atom:link href="{{ config('app.url') }}/notes/feed.rss" rel="self" type="application/rss+xml" />
<description>An RSS feed of the notes found on {{ config('url.longurl') }}</description>
<description>An RSS feed of the notes found on {{ config('app.url') }}</description>
<link>{{ config('app.url') }}/notes</link>
<lastBuildDate>{{ $buildDate }}</lastBuildDate>
<ttl>1800</ttl>
@ -16,8 +16,8 @@
{!! $note->note !!}
]]>
</description>
<link>{{ $note->longurl }}</link>
<guid>{{ $note->longurl}}</guid>
<link>{{ $note->uri }}</link>
<guid>{{ $note->uri}}</guid>
<pubDate>{{ $note->pubdate }}</pubDate>
</item>
@endforeach

View file

@ -34,7 +34,7 @@
@if($note->client) via <a class="client" href="{{ $note->client->client_url }}">{{ $note->client->client_name }}</a>@endif
@if($note->place)
@if($note->getOriginal('note'))
in <span class="p-location h-card"><a class="p-name u-url" href="{{ $note->place->longurl }}">{{ $note->address }}</a><data class="p-latitude" value="{{ $note->place->latitude }}"></data><data class="p-longitude" value="{{ $note->place->longitude }}"></data></span>
in <span class="p-location h-card"><a class="p-name u-url" href="{{ $note->place->uri }}">{{ $note->address }}</a><data class="p-latitude" value="{{ $note->place->latitude }}"></data><data class="p-longitude" value="{{ $note->place->longitude }}"></data></span>
@endif
@elseif($note->address)
in <span class="p-location h-adr">{!! $note->address !!}<data class="p-latitude" value="{{ $note->latitude }}"></data><data class="p-longitude" value="{{ $note->longitude }}"></data></span>

View file

@ -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 authd 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 authd 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']);

View file

@ -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();

View file

@ -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');

View file

@ -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();

View file

@ -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();

View file

@ -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([

View file

@ -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'
<div class="h-card">
@ -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'
<div class="h-card">
@ -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',

View file

@ -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;

View file

@ -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();

View file

@ -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([

View file

@ -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();

View file

@ -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();

View file

@ -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();

View file

@ -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');

View file

@ -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');
@ -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',
@ -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');
@ -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',
@ -136,7 +136,7 @@ class FeedsTest extends TestCase
* and whichever one they have cant 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]);

View file

@ -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']);

View file

@ -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('/');

View file

@ -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',

View file

@ -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()

View file

@ -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();

View file

@ -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';
@ -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()]
@ -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,14 +492,14 @@ 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(
'/api/post',
[
'action' => 'update',
'url' => $note->longurl,
'url' => $note->uri,
'replace' => [
'content' => ['replaced content'],
],
@ -512,14 +512,14 @@ 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(
'/api/post',
[
'action' => 'update',
'url' => $note->longurl,
'url' => $note->uri,
'add' => [
'syndication' => [
'https://www.swarmapp.com/checkin/123',
@ -539,14 +539,14 @@ 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(
'/api/post',
[
'action' => 'update',
'url' => $note->longurl,
'url' => $note->uri,
'add' => [
'photo' => ['https://example.org/photo.jpg'],
],
@ -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,14 +600,14 @@ 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(
'/api/post',
[
'action' => 'update',
'url' => $note->longurl,
'url' => $note->uri,
'morph' => [ // or any other unsupported update type
'syndication' => ['https://www.swarmapp.com/checkin/123'],
],
@ -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,14 +639,14 @@ 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(
'/api/post',
[
'action' => 'update',
'url' => $note->longurl,
'url' => $note->uri,
'replace' => [
'syndication' => [
'https://www.swarmapp.com/checkin/the-id',
@ -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);

View file

@ -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 theres 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');

View file

@ -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,10 +28,10 @@ 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->longurl);
$response = $this->get($note->uri);
$response->assertViewHas('note');
}
@ -47,32 +47,32 @@ 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);
$response->assertRedirect($note->longurl);
$response->assertRedirect($note->uri);
}
/**
* 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();

View file

@ -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',

View file

@ -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',

View file

@ -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,15 +27,15 @@ 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->longurl);
$response = $this->get($place->uri);
$response->assertViewHas('place', $place);
}
#[Test]
public function unknownPlaceGives404()
public function unknown_place_gives404()
{
$response = $this->get('/places/unknown');
$response->assertNotFound();

View file

@ -17,7 +17,7 @@ class ReDownloadWebMentionsTest extends TestCase
use RefreshDatabase;
#[Test]
public function downloadJobGetsQueued(): void
public function download_job_gets_queued(): void
{
Queue::fake();

View file

@ -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']);

View file

@ -1,39 +0,0 @@
<?php
declare(strict_types=1);
namespace Tests\Feature;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class ShortURLsControllerTest extends TestCase
{
#[Test]
public function shortDomainRedirectsToLongDomain(): void
{
$response = $this->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');
}
}

View file

@ -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',

View file

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

View file

@ -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 doesnt 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();
@ -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);

View file

@ -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(),

View file

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

View file

@ -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'

View file

@ -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();

View file

@ -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/';

View file

@ -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();

View file

@ -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'));

View file

@ -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();
@ -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 = <<<HTML
<div class="h-entry">
<p>In reply to <a class="u-in-reply-to" href="{$note->longurl}">a note</a></p>
<p>In reply to <a class="u-in-reply-to" href="{$note->uri}">a note</a></p>
<div class="e-content">Updated reply</div>
</div>
HTML;
@ -117,12 +117,12 @@ 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": []}',
]);
}
#[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;

View file

@ -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'),

View file

@ -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([

View file

@ -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 = '<link rel="webmention" href="https://example.org/webmention">';
$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 = '<link rel="http://webmention.org/" href="https://example.org/webmention">';
$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 = '<link rel="http://webmention.org/" href="https://example.org/webmention">';
$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 Im using

View file

@ -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();

View file

@ -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();

View file

@ -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'
<div class="h-entry">

View file

@ -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;

View file

@ -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();

View file

@ -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 = '<p>Having a <a rel="tag" class="p-category" href="/notes/tagged/beer">#beer</a> at the local. 🍺</p>' . PHP_EOL;
@ -42,7 +42,7 @@ class NotesTest extends TestCase
* Look for a default image in the contacts 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 = '<p>Hi <span class="u-category h-card mini-h-card">
@ -71,7 +71,7 @@ class NotesTest extends TestCase
* Look for a specific profile image in the contacts 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 theres no associated contact.
*/
#[Test]
public function twitterLinkIsCreatedWhenNoContactFound(): void
public function twitter_link_is_created_when_no_contact_found(): void
{
$expected = '<p>Hi <a href="https://twitter.com/bob">@bob</a></p>' . PHP_EOL;
$note = Note::factory()->create([
@ -116,15 +116,7 @@ class NotesTest extends TestCase
}
#[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
public function we_get_latitude_longitude_values_of_associated_place_of_note(): void
{
$place = Place::factory()->create([
'latitude' => '53.4983',
@ -138,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);
@ -146,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',
@ -160,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 well create a temporary note to delete
$note = Note::create(['note' => 'temporary #temp']);
@ -175,7 +167,7 @@ class NotesTest extends TestCase
}
#[Test]
public function saveBlankNotesAsNull(): void
public function save_blank_notes_as_null(): void
{
$note = new Note(['note' => '']);
@ -183,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 = <<<JSON
@ -208,7 +200,7 @@ class NotesTest extends TestCase
}
#[Test]
public function reverseGeocodeASuburb(): void
public function reverse_geocode_a_suburb(): void
{
// phpcs:disable Generic.Files.LineLength.TooLong
$json = <<<JSON
@ -233,7 +225,7 @@ class NotesTest extends TestCase
}
#[Test]
public function reverseGeocodeACity(): void
public function reverse_geocode_a_city(): void
{
// Note Ive modified this JSON response so it only contains the
// city the Uni is in
@ -260,7 +252,7 @@ class NotesTest extends TestCase
}
#[Test]
public function reverseGeocodeACounty(): void
public function reverse_geocode_a_county(): void
{
// Note Ive removed everything below county to test for queries where
// thats all that is returned
@ -284,7 +276,7 @@ class NotesTest extends TestCase
}
#[Test]
public function reverseGeocodeACountry(): void
public function reverse_geocode_a_country(): void
{
// Note Ive removed everything below country to test for querires where
// thats all that is returned
@ -308,7 +300,7 @@ class NotesTest extends TestCase
}
#[Test]
public function addImageElementToNoteContentWhenMediaAssociated(): void
public function add_image_element_to_note_content_when_media_associated(): void
{
$media = Media::factory()->create([
'type' => 'image',
@ -325,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',
@ -342,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',
@ -362,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;
@ -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(
'<p>The best search engine? <a href="https://duckduckgo.com">https://duckduckgo.com</a></p>' . PHP_EOL,
'<p>The best search engine? <a href="https://kagi.com">https://kagi.com</a></p>' . PHP_EOL,
$note->note
);
}
@ -395,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',
@ -410,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',
@ -421,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', '<span class="p-country-name">Antarctica</span>');
@ -433,7 +425,7 @@ class NotesTest extends TestCase
}
#[Test]
public function mastodonUsernamesAreParsedCorrectly(): void
public function mastodon_usernames_are_parsed_correctly(): void
{
$expected = '<p>Hi <a href="https://phpc.social/@freekmurze">@freekmurze@phpc.social</a> how are you?</p>' . PHP_EOL;
$note = Note::factory()->create([

View file

@ -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,25 +41,7 @@ class PlacesTest extends TestCase
}
#[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
public function get_uri(): void
{
$place = Place::factory()->create([
'name' => 'The Bridgewater Pub',
@ -68,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();
@ -88,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');
@ -98,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');
@ -108,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',

View file

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

View file

@ -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']);