Remove references to short domain

This commit is contained in:
Jonny Barnes 2025-04-06 17:22:36 +01:00
parent 328c9badb4
commit 7a58287b34
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8
27 changed files with 215 additions and 404 deletions

View file

@ -64,7 +64,7 @@ class FeedsTest extends TestCase
'author' => [
'type' => 'card',
'name' => config('user.display_name'),
'url' => config('url.longurl'),
'url' => config('app.url'),
],
'children' => [[
'type' => 'entry',
@ -122,7 +122,7 @@ class FeedsTest extends TestCase
'author' => [
'type' => 'card',
'name' => config('user.display_name'),
'url' => config('url.longurl'),
'url' => config('app.url'),
],
'children' => [[
'type' => 'entry',

View file

@ -299,7 +299,7 @@ class MicropubControllerTest extends TestCase
'type' => ['h-entry'],
'properties' => [
'content' => [$note],
'location' => [$place->longurl],
'location' => [$place->uri],
],
],
['HTTP_Authorization' => 'Bearer ' . $this->getToken()]
@ -499,7 +499,7 @@ class MicropubControllerTest extends TestCase
'/api/post',
[
'action' => 'update',
'url' => $note->longurl,
'url' => $note->uri,
'replace' => [
'content' => ['replaced content'],
],
@ -519,7 +519,7 @@ class MicropubControllerTest extends TestCase
'/api/post',
[
'action' => 'update',
'url' => $note->longurl,
'url' => $note->uri,
'add' => [
'syndication' => [
'https://www.swarmapp.com/checkin/123',
@ -546,7 +546,7 @@ class MicropubControllerTest extends TestCase
'/api/post',
[
'action' => 'update',
'url' => $note->longurl,
'url' => $note->uri,
'add' => [
'photo' => ['https://example.org/photo.jpg'],
],
@ -607,7 +607,7 @@ class MicropubControllerTest extends TestCase
'/api/post',
[
'action' => 'update',
'url' => $note->longurl,
'url' => $note->uri,
'morph' => [ // or any other unsupported update type
'syndication' => ['https://www.swarmapp.com/checkin/123'],
],
@ -646,7 +646,7 @@ class MicropubControllerTest extends TestCase
'/api/post',
[
'action' => 'update',
'url' => $note->longurl,
'url' => $note->uri,
'replace' => [
'syndication' => [
'https://www.swarmapp.com/checkin/the-id',

View file

@ -31,7 +31,7 @@ class NotesControllerTest extends TestCase
public function specificNotePageLoads(): void
{
$note = Note::factory()->create();
$response = $this->get($note->longurl);
$response = $this->get($note->uri);
$response->assertViewHas('note');
}
@ -51,7 +51,7 @@ class NotesControllerTest extends TestCase
{
$note = Note::factory()->create();
$response = $this->get('/note/' . $note->id);
$response->assertRedirect($note->longurl);
$response->assertRedirect($note->uri);
}
/**

View file

@ -30,7 +30,7 @@ class PlacesTest extends TestCase
public function singlePlacePageLoads(): void
{
$place = Place::factory()->create();
$response = $this->get($place->longurl);
$response = $this->get($place->uri);
$response->assertViewHas('place', $place);
}

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

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

@ -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,7 +117,7 @@ class ProcessWebMentionJobTest extends TestCase
'source' => $source,
'type' => 'in-reply-to',
// phpcs:ignore Generic.Files.LineLength.TooLong
'mf2' => '{"rels": [], "items": [{"type": ["h-entry"], "properties": {"content": [{"html": "Updated reply", "value": "Updated reply"}], "in-reply-to": ["' . $note->longurl . '"]}}], "rel-urls": []}',
'mf2' => '{"rels": [], "items": [{"type": ["h-entry"], "properties": {"content": [{"html": "Updated reply", "value": "Updated reply"}], "in-reply-to": ["' . $note->uri . '"]}}], "rel-urls": []}',
]);
}

View file

@ -115,14 +115,6 @@ class NotesTest extends TestCase
$this->assertEquals($expected, $note->note);
}
#[Test]
public function shorturlMethodReturnsExpectedValue(): void
{
$note = Note::factory()->make();
$note->id = 14;
$this->assertEquals(config('url.shorturl') . '/notes/E', $note->shorturl);
}
#[Test]
public function weGetLatitudeLongitudeValuesOfAssociatedPlaceOfNote(): void
{
@ -382,11 +374,11 @@ class NotesTest extends TestCase
public function markdown_content_gets_converted(): void
{
$note = Note::factory()->create([
'note' => 'The best search engine? https://duckduckgo.com',
'note' => 'The best search engine? https://kagi.com',
]);
$this->assertSame(
'<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
);
}

View file

@ -40,24 +40,6 @@ class PlacesTest extends TestCase
$this->assertEquals('the-bridgewater-pub', $nearby[0]->slug);
}
#[Test]
public function getLongurl(): void
{
$place = Place::factory()->create([
'name' => 'The Bridgewater Pub',
]);
$this->assertEquals(config('app.url') . '/places/the-bridgewater-pub', $place->longurl);
}
#[Test]
public function getShorturl()
{
$place = Place::factory()->create([
'name' => 'The Bridgewater Pub',
]);
$this->assertEquals(config('url.shorturl') . '/places/the-bridgewater-pub', $place->shorturl);
}
#[Test]
public function getUri(): void
{