Rename the tests to pass phpcs checks
This commit is contained in:
parent
3946e9aac4
commit
d5bbed1eac
52 changed files with 1329 additions and 1062 deletions
|
@ -1,16 +1,19 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use Tests\TestCase;
|
||||
use App\Models\Article;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ArticlesTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
public function test_sluggable_method()
|
||||
/** @test */
|
||||
public function titleSlugIsGeneratedAutomatically(): void
|
||||
{
|
||||
$article = new Article();
|
||||
$article->title = 'My Title';
|
||||
|
@ -20,15 +23,17 @@ class ArticlesTest extends TestCase
|
|||
$this->assertEquals('my-title', $article->titleurl);
|
||||
}
|
||||
|
||||
public function test_markdown_conversion()
|
||||
/** @test */
|
||||
public function markdownContentIsConverted(): void
|
||||
{
|
||||
$article = new Article();
|
||||
$article->main = 'Some *markdown*';
|
||||
|
||||
$this->assertEquals('<p>Some <em>markdown</em></p>'.PHP_EOL, $article->html);
|
||||
$this->assertEquals('<p>Some <em>markdown</em></p>' . PHP_EOL, $article->html);
|
||||
}
|
||||
|
||||
public function test_time_attributes()
|
||||
/** @test */
|
||||
public function weGenerateTheDifferentTimeAttributes(): void
|
||||
{
|
||||
$article = Article::create([
|
||||
'title' => 'Test',
|
||||
|
@ -41,7 +46,8 @@ class ArticlesTest extends TestCase
|
|||
$this->assertEquals($article->pubdate, $article->updated_at->toRSSString());
|
||||
}
|
||||
|
||||
public function test_link_accessor()
|
||||
/** @test */
|
||||
public function weGenerateTheArticleLinkFromTheSlug(): void
|
||||
{
|
||||
$article = Article::create([
|
||||
'title' => 'Test',
|
||||
|
@ -55,7 +61,8 @@ class ArticlesTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function test_date_scope()
|
||||
/** @test */
|
||||
public function dateScopeReturnsExpectedArticles(): void
|
||||
{
|
||||
$yearAndMonth = Article::date(date('Y'), date('m'))->get();
|
||||
$this->assertTrue(count($yearAndMonth) === 1);
|
||||
|
|
|
@ -1,27 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use Tests\TestCase;
|
||||
use App\Exceptions\InternetArchiveException;
|
||||
use App\Services\BookmarkService;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use GuzzleHttp\HandlerStack;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use App\Services\BookmarkService;
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use App\Exceptions\InternetArchiveException;
|
||||
use Tests\TestCase;
|
||||
|
||||
class BookmarksTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @test
|
||||
* @group puppeteer
|
||||
*/
|
||||
public function test_screenshot_of_google()
|
||||
*
|
||||
public function takeScreenshotOfDuckDuckGo()
|
||||
{
|
||||
$uuid = (new BookmarkService())->saveScreenshot('https://www.google.co.uk');
|
||||
$uuid = (new BookmarkService())->saveScreenshot('https://duckduckgo.com');
|
||||
$this->assertTrue(file_exists(public_path() . '/assets/img/bookmarks/' . $uuid . '.png'));
|
||||
}
|
||||
}*/
|
||||
|
||||
public function test_archive_link_method()
|
||||
/** @test */
|
||||
public function archiveLinkMethodCallsArchiveService(): void
|
||||
{
|
||||
$mock = new MockHandler([
|
||||
new Response(200, ['Content-Location' => '/web/1234/example.org']),
|
||||
|
@ -33,7 +37,8 @@ class BookmarksTest extends TestCase
|
|||
$this->assertEquals('/web/1234/example.org', $url);
|
||||
}
|
||||
|
||||
public function test_archive_link_method_archive_site_error_exception()
|
||||
/** @test */
|
||||
public function archiveLinkMethodThrowsAnExceptionOnError(): void
|
||||
{
|
||||
$this->expectException(InternetArchiveException::class);
|
||||
|
||||
|
@ -43,10 +48,11 @@ class BookmarksTest extends TestCase
|
|||
$handler = HandlerStack::create($mock);
|
||||
$client = new Client(['handler' => $handler]);
|
||||
$this->app->instance(Client::class, $client);
|
||||
$url = (new BookmarkService())->getArchiveLink('https://example.org');
|
||||
(new BookmarkService())->getArchiveLink('https://example.org');
|
||||
}
|
||||
|
||||
public function test_archive_link_method_archive_site_no_location_exception()
|
||||
/** @test */
|
||||
public function archiveLinkMethodThrowsAnExceptionIfNoLocationReturned(): void
|
||||
{
|
||||
$this->expectException(InternetArchiveException::class);
|
||||
|
||||
|
@ -56,6 +62,6 @@ class BookmarksTest extends TestCase
|
|||
$handler = HandlerStack::create($mock);
|
||||
$client = new Client(['handler' => $handler]);
|
||||
$this->app->instance(Client::class, $client);
|
||||
$url = (new BookmarkService())->getArchiveLink('https://example.org');
|
||||
(new BookmarkService())->getArchiveLink('https://example.org');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,72 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use Tests\TestCase;
|
||||
|
||||
class HelpersTest extends TestCase
|
||||
{
|
||||
public function test_normalize_url_is_idempotent()
|
||||
/** @test */
|
||||
public function normalizeUrlIsIdempotent(): void
|
||||
{
|
||||
$input = 'http://example.org:80/index.php?foo=bar&baz=1';
|
||||
$this->assertEquals(normalize_url(normalize_url($input)), normalize_url($input));
|
||||
}
|
||||
|
||||
public function urlProvider()
|
||||
/**
|
||||
* @test
|
||||
* @dataProvider urlProvider
|
||||
* @param string $input
|
||||
* @param string $output
|
||||
*/
|
||||
public function normalizeUrlOnDataProvider(string $input, string $output): void
|
||||
{
|
||||
$this->assertEquals($output, normalize_url($input));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function prettyPrintJson(): void
|
||||
{
|
||||
// phpcs:disable Generic.Files.LineLength.TooLong
|
||||
$json = <<<JSON
|
||||
{"glossary": {"title": "example glossary", "GlossDiv": {"title": "S", "GlossList": {"GlossEntry": {"ID": "SGML", "SortAs": "SGML", "GlossTerm": "Standard Generalized Markup Language", "Acronym": "SGML", "Abbrev": "ISO 8879:1986", "GlossDef": {"para": "A meta-markup language, used to create markup languages such as DocBook.", "GlossSeeAlso": ["GML", "XML"]}, "GlossSee": "markup"}}}}}
|
||||
JSON;
|
||||
// phpcs:enable Generic.Files.LineLength.TooLong
|
||||
|
||||
$expected = <<<EXPECTED
|
||||
{
|
||||
"glossary": {
|
||||
"title": "example glossary",
|
||||
"GlossDiv": {
|
||||
"title": "S",
|
||||
"GlossList": {
|
||||
"GlossEntry": {
|
||||
"ID": "SGML",
|
||||
"SortAs": "SGML",
|
||||
"GlossTerm": "Standard Generalized Markup Language",
|
||||
"Acronym": "SGML",
|
||||
"Abbrev": "ISO 8879:1986",
|
||||
"GlossDef": {
|
||||
"para": "A meta-markup language, used to create markup languages such as DocBook.",
|
||||
"GlossSeeAlso": [
|
||||
"GML",
|
||||
"XML"
|
||||
]
|
||||
},
|
||||
"GlossSee": "markup"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
EXPECTED;
|
||||
|
||||
$this->assertEquals($expected, prettyPrintJson($json));
|
||||
}
|
||||
|
||||
public function urlProvider(): array
|
||||
{
|
||||
return [
|
||||
['https://example.org/', 'https://example.org'],
|
||||
|
@ -25,48 +79,4 @@ class HelpersTest extends TestCase
|
|||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider urlProvider
|
||||
* @group temp
|
||||
*/
|
||||
public function test_normalize_url($input, $output)
|
||||
{
|
||||
$this->assertEquals($output, normalize_url($input));
|
||||
}
|
||||
|
||||
public function test_pretty_print_json()
|
||||
{
|
||||
$json = <<<JSON
|
||||
{"glossary": {"title": "example glossary", "GlossDiv": {"title": "S", "GlossList": {"GlossEntry": {"ID": "SGML", "SortAs": "SGML", "GlossTerm": "Standard Generalized Markup Language", "Acronym": "SGML", "Abbrev": "ISO 8879:1986", "GlossDef": {"para": "A meta-markup language, used to create markup languages such as DocBook.", "GlossSeeAlso": ["GML", "XML"]}, "GlossSee": "markup"}}}}}
|
||||
JSON;
|
||||
$expected = <<<EXPECTED
|
||||
{
|
||||
"glossary": {
|
||||
"title": "example glossary",
|
||||
"GlossDiv": {
|
||||
"title": "S",
|
||||
"GlossList": {
|
||||
"GlossEntry": {
|
||||
"ID": "SGML",
|
||||
"SortAs": "SGML",
|
||||
"GlossTerm": "Standard Generalized Markup Language",
|
||||
"Acronym": "SGML",
|
||||
"Abbrev": "ISO 8879:1986",
|
||||
"GlossDef": {
|
||||
"para": "A meta-markup language, used to create markup languages such as DocBook.",
|
||||
"GlossSeeAlso": [
|
||||
"GML",
|
||||
"XML"
|
||||
]
|
||||
},
|
||||
"GlossSee": "markup"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
EXPECTED;
|
||||
$this->assertEquals($expected, prettyPrintJson($json));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,19 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Jobs;
|
||||
|
||||
use Tests\TestCase;
|
||||
use App\Jobs\AddClientToDatabase;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AddClientToDatabaseJobTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
public function test_job_adds_client()
|
||||
/** @test */
|
||||
public function clientIsAddedToDatabaseByJob(): void
|
||||
{
|
||||
$job = new AddClientToDatabase('https://example.org/client');
|
||||
$job->handle();
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Jobs;
|
||||
|
||||
use Tests\TestCase;
|
||||
use App\Jobs\DownloadWebMention;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use GuzzleHttp\HandlerStack;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use App\Jobs\DownloadWebMention;
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use Illuminate\FileSystem\FileSystem;
|
||||
use Tests\TestCase;
|
||||
|
||||
class DownloadWebMentionJobTest extends TestCase
|
||||
{
|
||||
|
@ -21,15 +23,16 @@ class DownloadWebMentionJobTest extends TestCase
|
|||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function test_the_job_saves_html()
|
||||
/** @test */
|
||||
public function htmlIsSavedByJob(): void
|
||||
{
|
||||
$this->assertFileDoesNotExist(storage_path('HTML/https'));
|
||||
$source = 'https://example.org/reply/1';
|
||||
$html = <<<HTML
|
||||
<div class="h-entry">
|
||||
<a class="u-like-of" href=""></a>
|
||||
</div>
|
||||
HTML;
|
||||
<div class="h-entry">
|
||||
<a class="u-like-of" href=""></a>
|
||||
</div>
|
||||
HTML;
|
||||
$html = str_replace('href=""', 'href="' . config('app.url') . '/notes/A"', $html);
|
||||
$mock = new MockHandler([
|
||||
new Response(200, ['X-Foo' => 'Bar'], $html),
|
||||
|
@ -48,21 +51,22 @@ HTML;
|
|||
$this->assertFileDoesNotExist(storage_path('HTML/https/example.org/reply') . '/1.' . date('Y-m-d') . '.backup');
|
||||
}
|
||||
|
||||
public function test_the_job_saves_html_and_backup()
|
||||
/** @test */
|
||||
public function htmlAndBackupSavedByJob(): void
|
||||
{
|
||||
$this->assertFileDoesNotExist(storage_path('HTML/https'));
|
||||
$source = 'https://example.org/reply/1';
|
||||
$html = <<<HTML
|
||||
<div class="h-entry">
|
||||
<a class="u-like-of" href=""></a>
|
||||
</div>
|
||||
HTML;
|
||||
<div class="h-entry">
|
||||
<a class="u-like-of" href=""></a>
|
||||
</div>
|
||||
HTML;
|
||||
$html2 = <<<HTML
|
||||
<div class="h-entry">
|
||||
<a class="u-like-of" href=""></a>
|
||||
<a class="u-repost-of" href=""></a>
|
||||
</div>
|
||||
HTML;
|
||||
<div class="h-entry">
|
||||
<a class="u-like-of" href=""></a>
|
||||
<a class="u-repost-of" href=""></a>
|
||||
</div>
|
||||
HTML;
|
||||
$html = str_replace('href=""', 'href="' . config('app.url') . '/notes/A"', $html);
|
||||
$html2 = str_replace('href=""', 'href="' . config('app.url') . '/notes/A"', $html2);
|
||||
$mock = new MockHandler([
|
||||
|
@ -82,15 +86,16 @@ HTML;
|
|||
$this->assertFileExists(storage_path('HTML/https/example.org/reply') . '/1.' . date('Y-m-d') . '.backup');
|
||||
}
|
||||
|
||||
public function test_an_index_html_file()
|
||||
/** @test */
|
||||
public function indexHtmlFileIsSavedByJobForUrlsEndingWithSlash(): void
|
||||
{
|
||||
$this->assertFileDoesNotExist(storage_path('HTML/https'));
|
||||
$source = 'https://example.org/reply-one/';
|
||||
$html = <<<HTML
|
||||
<div class="h-entry">
|
||||
<a class="u-like-of" href=""></a>
|
||||
</div>
|
||||
HTML;
|
||||
<div class="h-entry">
|
||||
<a class="u-like-of" href=""></a>
|
||||
</div>
|
||||
HTML;
|
||||
$html = str_replace('href=""', 'href="' . config('app.url') . '/notes/A"', $html);
|
||||
$mock = new MockHandler([
|
||||
new Response(200, ['X-Foo' => 'Bar'], $html),
|
||||
|
|
|
@ -1,24 +1,23 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Jobs;
|
||||
|
||||
use Tests\TestCase;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use GuzzleHttp\Client;
|
||||
use App\Models\Bookmark;
|
||||
use GuzzleHttp\HandlerStack;
|
||||
use App\Jobs\ProcessBookmark;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use App\Services\BookmarkService;
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use App\Exceptions\InternetArchiveException;
|
||||
use App\Jobs\ProcessBookmark;
|
||||
use App\Models\Bookmark;
|
||||
use App\Services\BookmarkService;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ProcessBookmarkJobTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
public function test_screenshot_and_archive_link_are_saved()
|
||||
/** @test */
|
||||
public function screenshotAndArchiveLinkAreSavedByJob(): void
|
||||
{
|
||||
$bookmark = Bookmark::find(1);
|
||||
$uuid = Uuid::uuid4();
|
||||
|
@ -38,7 +37,8 @@ class ProcessBookmarkJobTest extends TestCase
|
|||
]);
|
||||
}
|
||||
|
||||
public function test_exception_casesu_null_value_for_archive_link()
|
||||
/** @test */
|
||||
public function archiveLinkSavedAsNullWhenExceptionThrown(): void
|
||||
{
|
||||
$bookmark = Bookmark::find(1);
|
||||
$uuid = Uuid::uuid4();
|
||||
|
@ -46,7 +46,7 @@ class ProcessBookmarkJobTest extends TestCase
|
|||
$service->method('saveScreenshot')
|
||||
->willReturn($uuid->toString());
|
||||
$service->method('getArchiveLink')
|
||||
->will($this->throwException(new InternetArchiveException));
|
||||
->will($this->throwException(new InternetArchiveException()));
|
||||
$this->app->instance(BookmarkService::class, $service);
|
||||
|
||||
$job = new ProcessBookmark($bookmark);
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Jobs;
|
||||
|
||||
use Storage;
|
||||
use Tests\TestCase;
|
||||
use App\Jobs\ProcessMedia;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Intervention\Image\ImageManager;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ProcessMediaJobTest extends TestCase
|
||||
{
|
||||
public function test_job_does_nothing_to_non_image()
|
||||
/** @test */
|
||||
public function nonMediaFilesAreNotSaved(): void
|
||||
{
|
||||
Storage::fake('s3');
|
||||
$manager = app()->make(ImageManager::class);
|
||||
|
@ -20,18 +23,20 @@ class ProcessMediaJobTest extends TestCase
|
|||
$this->assertFalse(file_exists(storage_path('app') . '/file.txt'));
|
||||
}
|
||||
|
||||
public function test_job_does_nothing_to_small_images()
|
||||
/** @test */
|
||||
public function smallImagesAreNotResized(): void
|
||||
{
|
||||
Storage::fake('s3');
|
||||
$manager = app()->make(ImageManager::class);
|
||||
Storage::disk('local')->put('aaron.png', file_get_contents(__DIR__.'/../../aaron.png'));
|
||||
Storage::disk('local')->put('aaron.png', file_get_contents(__DIR__ . '/../../aaron.png'));
|
||||
$job = new ProcessMedia('aaron.png');
|
||||
$job->handle($manager);
|
||||
|
||||
$this->assertFalse(file_exists(storage_path('app') . '/aaron.png'));
|
||||
}
|
||||
|
||||
public function test_large_images_have_smaller_files_created()
|
||||
/** @test */
|
||||
public function largeImagesHaveSmallerImagesCreated(): void
|
||||
{
|
||||
$manager = app()->make(ImageManager::class);
|
||||
Storage::disk('local')->put('test-image.jpg', file_get_contents(__DIR__.'/../../test-image.jpg'));
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Jobs;
|
||||
|
||||
use Tests\TestCase;
|
||||
use App\Exceptions\RemoteContentNotFoundException;
|
||||
use App\Jobs\ProcessWebMention;
|
||||
use App\Jobs\SaveProfileImage;
|
||||
use App\Models\Note;
|
||||
use GuzzleHttp\Client;
|
||||
use App\Models\WebMention;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use GuzzleHttp\HandlerStack;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use App\Jobs\SaveProfileImage;
|
||||
use App\Jobs\ProcessWebMention;
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use Illuminate\FileSystem\FileSystem;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Support\Facades\Queue;
|
||||
use Jonnybarnes\WebmentionsParser\Parser;
|
||||
use App\Exceptions\RemoteContentNotFoundException;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ProcessWebMentionJobTest extends TestCase
|
||||
{
|
||||
|
@ -30,7 +32,8 @@ class ProcessWebMentionJobTest extends TestCase
|
|||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function test_for_exception_from_failure_to_get_webmention()
|
||||
/** @test */
|
||||
public function failureGettingWebmentionThrowsAnException(): void
|
||||
{
|
||||
$this->expectException(RemoteContentNotFoundException::class);
|
||||
|
||||
|
@ -48,17 +51,18 @@ class ProcessWebMentionJobTest extends TestCase
|
|||
$job->handle($parser, $client);
|
||||
}
|
||||
|
||||
public function test_a_new_webmention_gets_saved()
|
||||
/** @test */
|
||||
public function newWebmentionGetsSavedByJob(): void
|
||||
{
|
||||
Queue::fake();
|
||||
|
||||
$parser = new Parser();
|
||||
|
||||
$html = <<<HTML
|
||||
<div class="h-entry">
|
||||
I liked <a class="u-like-of" href="/notes/1">a note</a>.
|
||||
</div>
|
||||
HTML;
|
||||
<div class="h-entry">
|
||||
I liked <a class="u-like-of" href="/notes/1">a note</a>.
|
||||
</div>
|
||||
HTML;
|
||||
$html = str_replace('href="', 'href="' . config('app.url'), $html);
|
||||
$mock = new MockHandler([
|
||||
new Response(200, [], $html),
|
||||
|
@ -79,18 +83,19 @@ HTML;
|
|||
]);
|
||||
}
|
||||
|
||||
public function test_existing_webmention_gets_updated()
|
||||
/** @test */
|
||||
public function existingWebmentionGetsUpdatedByJob(): void
|
||||
{
|
||||
Queue::fake();
|
||||
|
||||
$parser = new Parser();
|
||||
|
||||
$html = <<<HTML
|
||||
<div class="h-entry">
|
||||
<p>In reply to <a class="u-in-reply-to" href="/notes/E">a note</a></p>
|
||||
<div class="e-content">Updated reply</div>
|
||||
</div>
|
||||
HTML;
|
||||
<div class="h-entry">
|
||||
<p>In reply to <a class="u-in-reply-to" href="/notes/E">a note</a></p>
|
||||
<div class="e-content">Updated reply</div>
|
||||
</div>
|
||||
HTML;
|
||||
$html = str_replace('href="', 'href="' . config('app.url'), $html);
|
||||
$mock = new MockHandler([
|
||||
new Response(200, [], $html),
|
||||
|
@ -108,20 +113,22 @@ HTML;
|
|||
$this->assertDatabaseHas('webmentions', [
|
||||
'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": ["' . config('app.url') . '/notes/E"]}}], "rel-urls": []}',
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_webmention_reply_gets_deleted()
|
||||
/** @test */
|
||||
public function webmentionReplyGetsDeletedWhenReplyToValueChanges(): void
|
||||
{
|
||||
$parser = new Parser();
|
||||
|
||||
$html = <<<HTML
|
||||
<div class="h-entry">
|
||||
<p>In reply to <a class="u-in-reply-to" href="https://other.com/notes/E">a note</a></p>
|
||||
<div class="e-content">Replying to someone else</div>
|
||||
</div>
|
||||
HTML;
|
||||
<div class="h-entry">
|
||||
<p>In reply to <a class="u-in-reply-to" href="https://other.com/notes/E">a note</a></p>
|
||||
<div class="e-content">Replying to someone else</div>
|
||||
</div>
|
||||
HTML;
|
||||
$mock = new MockHandler([
|
||||
new Response(200, [], $html),
|
||||
]);
|
||||
|
@ -148,16 +155,17 @@ HTML;
|
|||
]);
|
||||
}
|
||||
|
||||
public function test_webmention_like_gets_deleted()
|
||||
/** @test */
|
||||
public function webmentionLikeGetsDeletedWhenLikeOfValueChanges(): void
|
||||
{
|
||||
$parser = new Parser();
|
||||
|
||||
$html = <<<HTML
|
||||
<div class="h-entry">
|
||||
<p>In reply to <a class="u-like-of" href="https://other.com/notes/E">a note</a></p>
|
||||
<div class="e-content">I like someone else now</div>
|
||||
</div>
|
||||
HTML;
|
||||
<div class="h-entry">
|
||||
<p>In reply to <a class="u-like-of" href="https://other.com/notes/E">a note</a></p>
|
||||
<div class="e-content">I like someone else now</div>
|
||||
</div>
|
||||
HTML;
|
||||
$mock = new MockHandler([
|
||||
new Response(200, [], $html),
|
||||
]);
|
||||
|
@ -184,16 +192,17 @@ HTML;
|
|||
]);
|
||||
}
|
||||
|
||||
public function test_webmention_repost_gets_deleted()
|
||||
/** @test */
|
||||
public function webmentionRepostGetsDeletedWhenRepostOfValueChanges(): void
|
||||
{
|
||||
$parser = new Parser();
|
||||
|
||||
$html = <<<HTML
|
||||
<div class="h-entry">
|
||||
<p>In reply to <a class="u-repost-of" href="https://other.com/notes/E">a note</a></p>
|
||||
<div class="e-content">Reposting someone else</div>
|
||||
</div>
|
||||
HTML;
|
||||
<div class="h-entry">
|
||||
<p>In reply to <a class="u-repost-of" href="https://other.com/notes/E">a note</a></p>
|
||||
<div class="e-content">Reposting someone else</div>
|
||||
</div>
|
||||
HTML;
|
||||
$mock = new MockHandler([
|
||||
new Response(200, [], $html),
|
||||
]);
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Jobs;
|
||||
|
||||
use Tests\TestCase;
|
||||
use App\Jobs\SaveProfileImage;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use GuzzleHttp\HandlerStack;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use App\Jobs\SaveProfileImage;
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use Jonnybarnes\WebmentionsParser\Authorship;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Jonnybarnes\WebmentionsParser\Exceptions\AuthorshipParserException;
|
||||
use Tests\TestCase;
|
||||
|
||||
class SaveProfileImageJobTest extends TestCase
|
||||
{
|
||||
|
@ -22,18 +23,21 @@ class SaveProfileImageJobTest extends TestCase
|
|||
}
|
||||
parent::tearDown();
|
||||
}
|
||||
public function test_authorship_algo_exception_return_null()
|
||||
|
||||
/** @test */
|
||||
public function authorshipAlgorithmReturnsNullOnException(): void
|
||||
{
|
||||
$mf = ['items' => []];
|
||||
$authorship = $this->createMock(Authorship::class);
|
||||
$authorship->method('findAuthor')
|
||||
->will($this->throwException(new AuthorshipParserException));
|
||||
->will($this->throwException(new AuthorshipParserException()));
|
||||
$job = new SaveProfileImage($mf);
|
||||
|
||||
$this->assertNull($job->handle($authorship));
|
||||
}
|
||||
|
||||
public function test_we_dont_process_twitter_images()
|
||||
/** @test */
|
||||
public function weDoNotProcessTwitterImages(): void
|
||||
{
|
||||
$mf = ['items' => []];
|
||||
$author = [
|
||||
|
@ -50,7 +54,8 @@ class SaveProfileImageJobTest extends TestCase
|
|||
$this->assertNull($job->handle($authorship));
|
||||
}
|
||||
|
||||
public function test_saving_of_remote_image()
|
||||
/** @test */
|
||||
public function remoteAuthorImagesAreSavedLocally(): void
|
||||
{
|
||||
$mock = new MockHandler([
|
||||
new Response(200, ['Content-Type' => 'image/jpeg'], 'fake jpeg image'),
|
||||
|
@ -74,7 +79,8 @@ class SaveProfileImageJobTest extends TestCase
|
|||
$this->assertFileExists(public_path() . '/assets/profile-images/example.org/image');
|
||||
}
|
||||
|
||||
public function test_copying_of_local_image()
|
||||
/** @test */
|
||||
public function localDefaultAuthorImageIsUsedAsFallback(): void
|
||||
{
|
||||
$mock = new MockHandler([
|
||||
new Response(404),
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Jobs;
|
||||
|
||||
use Tests\TestCase;
|
||||
use App\Jobs\SendWebMentions;
|
||||
use App\Models\Note;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\HandlerStack;
|
||||
use App\Jobs\SendWebMentions;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use GuzzleHttp\HandlerStack;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use Tests\TestCase;
|
||||
|
||||
class SendWebMentionJobTest extends TestCase
|
||||
{
|
||||
public function test_dicover_endoint_method_on_self()
|
||||
/** @test */
|
||||
public function discoverWebmentionEndpointOnOwnDomain(): void
|
||||
{
|
||||
$note = new Note();
|
||||
$job = new SendWebMentions($note);
|
||||
|
@ -21,7 +23,8 @@ class SendWebMentionJobTest extends TestCase
|
|||
$this->assertNull($job->discoverWebmentionEndpoint('/notes/tagged/test'));
|
||||
}
|
||||
|
||||
public function test_discover_endpoint_gets_link_from_headers()
|
||||
/** @test */
|
||||
public function discoverWebmentionEndpointFromHeaderLinks(): void
|
||||
{
|
||||
$url = 'https://example.org/webmention';
|
||||
$mock = new MockHandler([
|
||||
|
@ -35,7 +38,8 @@ class SendWebMentionJobTest extends TestCase
|
|||
$this->assertEquals($url, $job->discoverWebmentionEndpoint('https://example.org'));
|
||||
}
|
||||
|
||||
public function test_discover_endpoint_correctly_parses_html()
|
||||
/** @test */
|
||||
public function discoverWebmentionEndpointFromHtmlLinkTags(): void
|
||||
{
|
||||
$html = '<link rel="webmention" href="https://example.org/webmention">';
|
||||
$mock = new MockHandler([
|
||||
|
@ -52,7 +56,8 @@ class SendWebMentionJobTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function test_discover_endpoint_correctly_parses_html_legacy()
|
||||
/** @test */
|
||||
public function discoverWebmentionEndpointFromLegacyHtmlMarkup(): void
|
||||
{
|
||||
$html = '<link rel="http://webmention.org/" href="https://example.org/webmention">';
|
||||
$mock = new MockHandler([
|
||||
|
@ -69,13 +74,15 @@ class SendWebMentionJobTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function test_empty_note_does_nothing()
|
||||
/** @test */
|
||||
public function ensureEmptyNoteDoesNotTriggerAnyActions(): void
|
||||
{
|
||||
$job = new SendWebMentions(new Note());
|
||||
$this->assertNull($job->handle());
|
||||
}
|
||||
|
||||
public function test_resolve_uri()
|
||||
/** @test */
|
||||
public function weResolveRelativeUris(): void
|
||||
{
|
||||
$uri = '/blog/post';
|
||||
$base = 'https://example.org/';
|
||||
|
@ -83,7 +90,8 @@ class SendWebMentionJobTest extends TestCase
|
|||
$this->assertEquals('https://example.org/blog/post', $job->resolveUri($uri, $base));
|
||||
}
|
||||
|
||||
public function test_the_job()
|
||||
/** @test */
|
||||
public function weSendAWebmentionForANote(): void
|
||||
{
|
||||
$html = '<link rel="http://webmention.org/" href="https://example.org/webmention">';
|
||||
$mock = new MockHandler([
|
||||
|
@ -98,6 +106,7 @@ class SendWebMentionJobTest extends TestCase
|
|||
$note->note = 'Hi [Aaron](https://aaronparecki.com)';
|
||||
$note->save();
|
||||
$job = new SendWebMentions($note);
|
||||
$this->assertNull($job->handle());
|
||||
$job->handle();
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +1,24 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Jobs;
|
||||
|
||||
use Tests\TestCase;
|
||||
use GuzzleHttp\Client;
|
||||
use App\Jobs\SyndicateBookmarkToTwitter;
|
||||
use App\Models\Bookmark;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use GuzzleHttp\HandlerStack;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use App\Jobs\SyndicateBookmarkToTwitter;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Tests\TestCase;
|
||||
|
||||
class SyndicateBookmarkToTwitterJobTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
public function test_the_job()
|
||||
/** @test */
|
||||
public function weSendBookmarksToTwitter(): void
|
||||
{
|
||||
$json = json_encode([
|
||||
'url' => 'https://twitter.com/123'
|
||||
|
|
|
@ -2,20 +2,21 @@
|
|||
|
||||
namespace Tests\Unit\Jobs;
|
||||
|
||||
use Tests\TestCase;
|
||||
use App\Jobs\SyndicateNoteToTwitter;
|
||||
use App\Models\Note;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use GuzzleHttp\HandlerStack;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use App\Jobs\SyndicateNoteToTwitter;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Tests\TestCase;
|
||||
|
||||
class SyndicateNoteToTwitterJobTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
public function test_the_job()
|
||||
/** @test */
|
||||
public function weSyndicateNotesToTwitter(): void
|
||||
{
|
||||
$json = json_encode([
|
||||
'url' => 'https://twitter.com/i/web/status/123'
|
||||
|
|
|
@ -1,23 +1,27 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use Tests\TestCase;
|
||||
use App\Models\Like;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Tests\TestCase;
|
||||
|
||||
class LikesTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
public function test_setting_author_url()
|
||||
/** @test */
|
||||
public function weCanSetTheAuthorUrl(): void
|
||||
{
|
||||
$like = new Like();
|
||||
$like->author_url = 'https://joe.bloggs/';
|
||||
$this->assertEquals('https://joe.bloggs', $like->author_url);
|
||||
}
|
||||
|
||||
public function test_plaintext_like_content()
|
||||
/** @test */
|
||||
public function weDoNotModifyPlainTextContent(): void
|
||||
{
|
||||
$like = new Like();
|
||||
$like->url = 'https://example.org/post/123';
|
||||
|
@ -27,27 +31,28 @@ class LikesTest extends TestCase
|
|||
$this->assertEquals('some plaintext content', $like->content);
|
||||
}
|
||||
|
||||
public function test_html_like_content_is_filtered()
|
||||
/** @test */
|
||||
public function htmlLikeContentIsFiltered(): void
|
||||
{
|
||||
$htmlEvil = <<<HTML
|
||||
<div class="h-entry">
|
||||
<div class="e-content">
|
||||
<p>Hello</p>
|
||||
<img src="javascript:evil();" onload="evil();" />
|
||||
</div>
|
||||
</div>
|
||||
HTML;
|
||||
<div class="h-entry">
|
||||
<div class="e-content">
|
||||
<p>Hello</p>
|
||||
<img src="javascript:evil();" onload="evil();" />
|
||||
</div>
|
||||
</div>
|
||||
HTML;
|
||||
$htmlFiltered = <<<HTML
|
||||
<p>Hello</p>
|
||||
<img />
|
||||
HTML;
|
||||
<p>Hello</p>
|
||||
<img />
|
||||
HTML;
|
||||
$like = new Like();
|
||||
$like->url = 'https://example.org/post/123';
|
||||
$like->content = $htmlEvil;
|
||||
$like->save();
|
||||
|
||||
// HTMLPurifer will leave the whitespace before the <img> tag
|
||||
// trim it, saving whitespace in $htmlFilteres can get removed by text editors
|
||||
// HTMLPurifier will leave the whitespace before the <img> tag
|
||||
// trim it, saving whitespace in $htmlFiltered can get removed by text editors
|
||||
$this->assertEquals($htmlFiltered, trim($like->content));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,24 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use Tests\TestCase;
|
||||
use App\Models\Media;
|
||||
use Tests\TestCase;
|
||||
|
||||
class MediaTest extends TestCase
|
||||
{
|
||||
public function test_get_note_from_media()
|
||||
/** @test */
|
||||
public function getTheNoteThatMediaInstanceBelongsTo(): void
|
||||
{
|
||||
$media = Media::find(1);
|
||||
$note = $media->note;
|
||||
$this->assertInstanceOf('App\Models\Note', $note);
|
||||
}
|
||||
|
||||
public function test_media_absolute_url_returned_unmodified()
|
||||
/** @test */
|
||||
public function absoluteUrlsAreReturnedUnmodified(): void
|
||||
{
|
||||
$absoluteUrl = 'https://instagram-cdn.com/image/uuid';
|
||||
$media = new Media();
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use Tests\TestCase;
|
||||
use App\Models\MicropubClient;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class MicropbClientsTest extends TestCase
|
||||
class MicropubClientsTest extends TestCase
|
||||
{
|
||||
public function test_notes_relationship()
|
||||
/** @test */
|
||||
public function weCanGetNotesRelatingToClient(): void
|
||||
{
|
||||
$client = MicropubClient::find(1);
|
||||
$this->assertInstanceOf(Collection::class, $client->notes);
|
|
@ -1,14 +1,16 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use Tests\TestCase;
|
||||
use App\Models\{Media, Note, Tag};
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use GuzzleHttp\HandlerStack;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use App\Models\{Media, Note, Tag};
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Tests\TestCase;
|
||||
|
||||
class NotesTest extends TestCase
|
||||
{
|
||||
|
@ -18,10 +20,12 @@ class NotesTest extends TestCase
|
|||
* Test the getNoteAttribute method. This will then also call the
|
||||
* relevant sub-methods.
|
||||
*
|
||||
* @test
|
||||
* @return void
|
||||
*/
|
||||
public function test_get_note_attribute_method()
|
||||
public function getNoteAttributeMethodCallsSubMethods(): 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;
|
||||
$note = Note::find(2);
|
||||
$this->assertEquals($expected, $note->note);
|
||||
|
@ -30,10 +34,12 @@ class NotesTest extends TestCase
|
|||
/**
|
||||
* Look for a default image in the contact’s h-card for the makeHCards method.
|
||||
*
|
||||
* @test
|
||||
* @return void
|
||||
*/
|
||||
public function test_default_image_used_in_makehcards_method()
|
||||
public function defaultImageUsedAsFallbackInMakehcardsMethod(): void
|
||||
{
|
||||
// phpcs:ignore
|
||||
$expected = '<p>Hi <span class="u-category h-card mini-h-card"><a class="u-url p-name" href="http://tantek.com">Tantek Çelik</a><span class="hovercard"> <a class="u-url" href="https://twitter.com/t"><img class="social-icon" src="/assets/img/social-icons/twitter.svg"> t</a><img class="u-photo" alt="" src="/assets/profile-images/default-image"></span></span></p>' . PHP_EOL;
|
||||
$note = Note::find(4);
|
||||
$this->assertEquals($expected, $note->note);
|
||||
|
@ -42,10 +48,12 @@ class NotesTest extends TestCase
|
|||
/**
|
||||
* Look for a specific profile image in the contact’s h-card.
|
||||
*
|
||||
* @test
|
||||
* @return void
|
||||
*/
|
||||
public function test_specific_profile_image_used_in_makehcards_method()
|
||||
public function specificProfileImageUsedInMakehcardsMethod(): void
|
||||
{
|
||||
// phpcs:ignore
|
||||
$expected = '<p>Hi <span class="u-category h-card mini-h-card"><a class="u-url p-name" href="https://aaronparecki.com">Aaron Parecki</a><span class="hovercard"><a class="u-url" href="https://www.facebook.com/123456"><img class="social-icon" src="/assets/img/social-icons/facebook.svg"> Facebook</a> <img class="u-photo" alt="" src="/assets/profile-images/aaronparecki.com/image"></span></span></p>' . PHP_EOL;
|
||||
$note = Note::find(5);
|
||||
$this->assertEquals($expected, $note->note);
|
||||
|
@ -54,42 +62,48 @@ class NotesTest extends TestCase
|
|||
/**
|
||||
* Look for twitter URL when there’s no associated contact.
|
||||
*
|
||||
* @test
|
||||
* @return void
|
||||
*/
|
||||
public function test_twitter_link_created_when_no_contact_found()
|
||||
public function twitterLinkIsCreatedWhenNoContactFound(): void
|
||||
{
|
||||
$expected = '<p>Hi <a href="https://twitter.com/bob">@bob</a></p>' . PHP_EOL;
|
||||
$note = Note::find(6);
|
||||
$this->assertEquals($expected, $note->note);
|
||||
}
|
||||
|
||||
public function test_shorturl_method()
|
||||
/** @test */
|
||||
public function shorturlMethodReturnsExpectedValue(): void
|
||||
{
|
||||
$note = Note::find(14);
|
||||
$this->assertEquals(config('app.shorturl') . '/notes/E', $note->shorturl);
|
||||
}
|
||||
|
||||
public function test_latlng_of_associated_place()
|
||||
/** @test */
|
||||
public function weGetLatitudeLongitudeValuesOfAssociatedPlaceOfNote(): void
|
||||
{
|
||||
$note = Note::find(2); // should be having beer at bridgewater note
|
||||
$this->assertEquals('53.4983', $note->latitude);
|
||||
$this->assertEquals('-2.3805', $note->longitude);
|
||||
}
|
||||
|
||||
public function test_latlng_returns_null_otherwise()
|
||||
/** @test */
|
||||
public function whenNoAssociatedPlaceWeGetNullForLatitudeLongitudeValues(): void
|
||||
{
|
||||
$note = Note::find(5);
|
||||
$this->assertNull($note->latitude);
|
||||
$this->assertNull($note->longitude);
|
||||
}
|
||||
|
||||
public function test_address_attribute_for_places()
|
||||
/** @test */
|
||||
public function weCanGetAddressAttributeForAssociatedPlace(): void
|
||||
{
|
||||
$note = Note::find(2);
|
||||
$this->assertEquals('The Bridgewater Pub', $note->address);
|
||||
}
|
||||
|
||||
public function test_deleting_event_observer()
|
||||
/** @test */
|
||||
public function deletingNotesAlsoDeletesTagsViaTheEventObserver(): void
|
||||
{
|
||||
// first we’ll create a temporary note to delete
|
||||
$note = Note::create(['note' => 'temporary #temp']);
|
||||
|
@ -104,7 +118,7 @@ class NotesTest extends TestCase
|
|||
}
|
||||
|
||||
/** @test */
|
||||
public function blank_note_should_be_saved_as_null()
|
||||
public function saveBlankNotesAsNull(): void
|
||||
{
|
||||
$note = new Note(['note' => '']);
|
||||
|
||||
|
@ -112,11 +126,13 @@ class NotesTest extends TestCase
|
|||
}
|
||||
|
||||
/** @test */
|
||||
public function reverse_geocode_an_attraction()
|
||||
public function reverseGeocodeAnAttraction(): void
|
||||
{
|
||||
// phpcs:disable Generic.Files.LineLength.TooLong
|
||||
$json = <<<JSON
|
||||
{"place_id":"198791063","licence":"Data © OpenStreetMap contributors, ODbL 1.0. https:\/\/osm.org\/copyright","osm_type":"relation","osm_id":"5208404","lat":"51.50084125","lon":"-0.142990166340849","display_name":"Buckingham Palace, Ambassador's Court, St. James's, Victoria, Westminster, London, Greater London, England, SW1E 6LA, United Kingdom","address":{"attraction":"Buckingham Palace","road":"Ambassador's Court","neighbourhood":"St. James's","suburb":"Victoria","city":"London","state_district":"Greater London","state":"England","postcode":"SW1E 6LA","country":"UK","country_code":"gb"},"boundingbox":["51.4997342","51.5019473","-0.143984","-0.1413002"]}
|
||||
JSON;
|
||||
{"place_id":"198791063","licence":"Data © OpenStreetMap contributors, ODbL 1.0. https:\/\/osm.org\/copyright","osm_type":"relation","osm_id":"5208404","lat":"51.50084125","lon":"-0.142990166340849","display_name":"Buckingham Palace, Ambassador's Court, St. James's, Victoria, Westminster, London, Greater London, England, SW1E 6LA, United Kingdom","address":{"attraction":"Buckingham Palace","road":"Ambassador's Court","neighbourhood":"St. James's","suburb":"Victoria","city":"London","state_district":"Greater London","state":"England","postcode":"SW1E 6LA","country":"UK","country_code":"gb"},"boundingbox":["51.4997342","51.5019473","-0.143984","-0.1413002"]}
|
||||
JSON;
|
||||
// phpcs:enable Generic.Files.LineLength.TooLong
|
||||
$mock = new MockHandler([
|
||||
new Response(200, ['Content-Type' => 'application/json'], $json),
|
||||
]);
|
||||
|
@ -128,15 +144,20 @@ JSON;
|
|||
$note = new Note();
|
||||
$address = $note->reverseGeoCode(51.50084, -0.14264);
|
||||
|
||||
$this->assertEquals('<span class="p-locality">Victoria, London</span>, <span class="p-country-name">UK</span>', $address);
|
||||
$this->assertEquals(
|
||||
'<span class="p-locality">Victoria, London</span>, <span class="p-country-name">UK</span>',
|
||||
$address
|
||||
);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function reverse_geocode_a_suburb()
|
||||
public function reverseGeocodeASuburb(): void
|
||||
{
|
||||
// phpcs:disable Generic.Files.LineLength.TooLong
|
||||
$json = <<<JSON
|
||||
{"place_id":"96518506","licence":"Data © OpenStreetMap contributors, ODbL 1.0. https:\/\/osm.org\/copyright","osm_type":"way","osm_id":"94107885","lat":"51.0225764535969","lon":"0.906664040464189","display_name":"Melon Lane, Newchurch, Shepway, Kent, South East, England, TN29 0AS, United Kingdom","address":{"road":"Melon Lane","suburb":"Newchurch","city":"Shepway","county":"Kent","state_district":"South East","state":"England","postcode":"TN29 0AS","country":"UK","country_code":"gb"},"boundingbox":["51.0140377","51.0371494","0.8873312","0.9109506"]}
|
||||
JSON;
|
||||
{"place_id":"96518506","licence":"Data © OpenStreetMap contributors, ODbL 1.0. https:\/\/osm.org\/copyright","osm_type":"way","osm_id":"94107885","lat":"51.0225764535969","lon":"0.906664040464189","display_name":"Melon Lane, Newchurch, Shepway, Kent, South East, England, TN29 0AS, United Kingdom","address":{"road":"Melon Lane","suburb":"Newchurch","city":"Shepway","county":"Kent","state_district":"South East","state":"England","postcode":"TN29 0AS","country":"UK","country_code":"gb"},"boundingbox":["51.0140377","51.0371494","0.8873312","0.9109506"]}
|
||||
JSON;
|
||||
// phpcs:enable Generic.Files.LineLength.TooLong
|
||||
$mock = new MockHandler([
|
||||
new Response(200, ['Content-Type' => 'application/json'], $json),
|
||||
]);
|
||||
|
@ -148,17 +169,22 @@ JSON;
|
|||
$note = new Note();
|
||||
$address = $note->reverseGeoCode(51.02, 0.91);
|
||||
|
||||
$this->assertEquals('<span class="p-locality">Newchurch, Shepway</span>, <span class="p-country-name">UK</span>', $address);
|
||||
$this->assertEquals(
|
||||
'<span class="p-locality">Newchurch, Shepway</span>, <span class="p-country-name">UK</span>',
|
||||
$address
|
||||
);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function reverse_geocode_a_city()
|
||||
public function reverseGeocodeACity(): void
|
||||
{
|
||||
// Note I’ve modified this JSON response so it only contains the
|
||||
// city the Uni is in
|
||||
// phpcs:disable Generic.Files.LineLength.TooLong
|
||||
$json = <<<JSON
|
||||
{"place_id":"198561071","licence":"Data © OpenStreetMap contributors, ODbL 1.0. https:\/\/osm.org\/copyright","osm_type":"relation","osm_id":"1839026","lat":"53.46600455","lon":"-2.23300880782987","display_name":"University of Manchester - Main Campus, Brunswick Street, Curry Mile, Ardwick, Manchester, Greater Manchester, North West England, England, M13 9NR, United Kingdom","address":{"university":"University of Manchester - Main Campus","city":"Manchester","county":"Greater Manchester","state_district":"North West England","state":"England","postcode":"M13 9NR","country":"UK","country_code":"gb"},"boundingbox":["53.4598667","53.4716848","-2.2390346","-2.2262754"]}
|
||||
JSON;
|
||||
{"place_id":"198561071","licence":"Data © OpenStreetMap contributors, ODbL 1.0. https:\/\/osm.org\/copyright","osm_type":"relation","osm_id":"1839026","lat":"53.46600455","lon":"-2.23300880782987","display_name":"University of Manchester - Main Campus, Brunswick Street, Curry Mile, Ardwick, Manchester, Greater Manchester, North West England, England, M13 9NR, United Kingdom","address":{"university":"University of Manchester - Main Campus","city":"Manchester","county":"Greater Manchester","state_district":"North West England","state":"England","postcode":"M13 9NR","country":"UK","country_code":"gb"},"boundingbox":["53.4598667","53.4716848","-2.2390346","-2.2262754"]}
|
||||
JSON;
|
||||
// phpcs:enable Generic.Files.LineLength.TooLong
|
||||
$mock = new MockHandler([
|
||||
new Response(200, ['Content-Type' => 'application/json'], $json),
|
||||
]);
|
||||
|
@ -170,17 +196,22 @@ JSON;
|
|||
$note = new Note();
|
||||
$address = $note->reverseGeoCode(53.466277988406, -2.2304474827445);
|
||||
|
||||
$this->assertEquals('<span class="p-locality">Manchester</span>, <span class="p-country-name">UK</span>', $address);
|
||||
$this->assertEquals(
|
||||
'<span class="p-locality">Manchester</span>, <span class="p-country-name">UK</span>',
|
||||
$address
|
||||
);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function reverse_geocode_a_county()
|
||||
public function reverseGeocodeACounty(): void
|
||||
{
|
||||
// Note I’ve removed everything below county to test for querires where
|
||||
// that’s all that is returned
|
||||
// phpcs:disable Generic.Files.LineLength.TooLong
|
||||
$json = <<<JSON
|
||||
{"place_id":"98085404","licence":"Data © OpenStreetMap contributors, ODbL 1.0. https:\/\/osm.org\/copyright","osm_type":"way","osm_id":"103703318","lat":"51.0997470194065","lon":"0.609897771085209","display_name":"Biddenden, Ashford, Kent, South East, England, TN27 8ET, United Kingdom","address":{"county":"Kent","state_district":"South East","state":"England","postcode":"TN27 8ET","country":"UK","country_code":"gb"},"boundingbox":["51.0986632","51.104459","0.5954434","0.6167775"]}
|
||||
JSON;
|
||||
{"place_id":"98085404","licence":"Data © OpenStreetMap contributors, ODbL 1.0. https:\/\/osm.org\/copyright","osm_type":"way","osm_id":"103703318","lat":"51.0997470194065","lon":"0.609897771085209","display_name":"Biddenden, Ashford, Kent, South East, England, TN27 8ET, United Kingdom","address":{"county":"Kent","state_district":"South East","state":"England","postcode":"TN27 8ET","country":"UK","country_code":"gb"},"boundingbox":["51.0986632","51.104459","0.5954434","0.6167775"]}
|
||||
JSON;
|
||||
// phpcs:enable Generic.Files.LineLength.TooLong
|
||||
$mock = new MockHandler([
|
||||
new Response(200, ['Content-Type' => 'application/json'], $json),
|
||||
]);
|
||||
|
@ -196,13 +227,15 @@ JSON;
|
|||
}
|
||||
|
||||
/** @test */
|
||||
public function reverse_geocode_a_country()
|
||||
public function reverseGeocodeACountry(): void
|
||||
{
|
||||
// Note I’ve removed everything below country to test for querires where
|
||||
// that’s all that is returned
|
||||
// phpcs:disable Generic.Files.LineLength.TooLong
|
||||
$json = <<<JSON
|
||||
{"place_id":"120553244","licence":"Data © OpenStreetMap contributors, ODbL 1.0. https:\/\/osm.org\/copyright","osm_type":"way","osm_id":"191508282","lat":"54.3004150140189","lon":"-9.39993720828084","display_name":"R314, Doonfeeny Lower, Ballycastle ED, Ballina, County Mayo, Connacht, Ireland","address":{"country":"Ireland","country_code":"ie"},"boundingbox":["54.2964027","54.3045856","-9.4337961","-9.3960403"]}
|
||||
JSON;
|
||||
{"place_id":"120553244","licence":"Data © OpenStreetMap contributors, ODbL 1.0. https:\/\/osm.org\/copyright","osm_type":"way","osm_id":"191508282","lat":"54.3004150140189","lon":"-9.39993720828084","display_name":"R314, Doonfeeny Lower, Ballycastle ED, Ballina, County Mayo, Connacht, Ireland","address":{"country":"Ireland","country_code":"ie"},"boundingbox":["54.2964027","54.3045856","-9.4337961","-9.3960403"]}
|
||||
JSON;
|
||||
// phpcs:enable Generic.Files.LineLength.TooLong
|
||||
$mock = new MockHandler([
|
||||
new Response(200, ['Content-Type' => 'application/json'], $json),
|
||||
]);
|
||||
|
@ -218,12 +251,12 @@ JSON;
|
|||
}
|
||||
|
||||
/** @test */
|
||||
public function add_image_element_to_note_content()
|
||||
public function addImageElementToNoteContentWhenMediaAssociated(): void
|
||||
{
|
||||
$media = new Media([
|
||||
'type' => 'image',
|
||||
'path' => 'test.png']
|
||||
);
|
||||
'path' => 'test.png',
|
||||
]);
|
||||
$media->save();
|
||||
$note = new Note(['note' => 'A nice image']);
|
||||
$note->save();
|
||||
|
@ -235,12 +268,12 @@ JSON;
|
|||
}
|
||||
|
||||
/** @test */
|
||||
public function add_video_element_to_note_content()
|
||||
public function addVideoElementToNoteContentWhenMediaAssociated(): void
|
||||
{
|
||||
$media = new Media([
|
||||
'type' => 'video',
|
||||
'path' => 'test.mkv']
|
||||
);
|
||||
'path' => 'test.mkv',
|
||||
]);
|
||||
$media->save();
|
||||
$note = new Note(['note' => 'A nice video']);
|
||||
$note->save();
|
||||
|
@ -252,12 +285,12 @@ JSON;
|
|||
}
|
||||
|
||||
/** @test */
|
||||
public function add_audio_element_to_note_content()
|
||||
public function addAudioElementToNoteContentWhenMediaAssociated(): void
|
||||
{
|
||||
$media = new Media([
|
||||
'type' => 'audio',
|
||||
'path' => 'test.flac']
|
||||
);
|
||||
'path' => 'test.flac',
|
||||
]);
|
||||
$media->save();
|
||||
$note = new Note(['note' => 'Some nice audio']);
|
||||
$note->save();
|
||||
|
@ -268,24 +301,29 @@ JSON;
|
|||
$this->assertEquals($expected, $note->content);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function blank_note_content()
|
||||
/**
|
||||
* @test
|
||||
* @todo Why do we need to provide text?
|
||||
*/
|
||||
public function provideTextForBlankContent(): void
|
||||
{
|
||||
$note = new Note();
|
||||
|
||||
$this->assertEquals('A blank note', $note->content);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function twitter_content_is_null_when_oembed_error_occurs()
|
||||
// @todo Sort out twitter requests
|
||||
/** @test
|
||||
public function setTwitterContentToNullWhenOembedErrorOccurs(): void
|
||||
{
|
||||
$note = new Note();
|
||||
$note->in_reply_to = 'https://twitter.com/search';
|
||||
|
||||
$this->assertNull($note->twitter);
|
||||
}
|
||||
}*/
|
||||
|
||||
public function test_markdown_gets_converted()
|
||||
/** @test */
|
||||
public function markdownContentGetsConverted(): void
|
||||
{
|
||||
$note = Note::create([
|
||||
'note' => 'The best search engine? https://duckduckgo.com',
|
||||
|
|
|
@ -1,55 +1,57 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use Tests\TestCase;
|
||||
use App\Models\Place;
|
||||
use App\Services\PlaceService;
|
||||
use MStaack\LaravelPostgis\Geometries\Point;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use InvalidArgumentException;
|
||||
use Tests\TestCase;
|
||||
|
||||
class PlacesTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
public function test_notes_method()
|
||||
/** @test */
|
||||
public function canRetrieveAssociatedNotes(): void
|
||||
{
|
||||
$place = Place::find(1);
|
||||
$this->assertInstanceOf(Collection::class, $place->notes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the near method returns a collection.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_near_method()
|
||||
/** @test */
|
||||
public function nearMethodReturnsCollection(): void
|
||||
{
|
||||
$nearby = Place::near((object) ['latitude' => 53.5, 'longitude' => -2.38], 1000)->get();
|
||||
$this->assertEquals('the-bridgewater-pub', $nearby[0]->slug);
|
||||
}
|
||||
|
||||
public function test_longurl_method()
|
||||
/** @test */
|
||||
public function getLongurl(): void
|
||||
{
|
||||
$place = Place::find(1);
|
||||
$this->assertEquals(config('app.url') . '/places/the-bridgewater-pub', $place->longurl);
|
||||
}
|
||||
|
||||
public function test_uri_method()
|
||||
{
|
||||
$place = Place::find(1);
|
||||
$this->assertEquals(config('app.url') . '/places/the-bridgewater-pub', $place->uri);
|
||||
|
||||
}
|
||||
|
||||
public function test_shorturl_method()
|
||||
/** @test */
|
||||
public function getShorturl()
|
||||
{
|
||||
$place = Place::find(1);
|
||||
$this->assertEquals(config('app.shorturl') . '/places/the-bridgewater-pub', $place->shorturl);
|
||||
}
|
||||
|
||||
public function test_service_returns_existing_place()
|
||||
/** @test */
|
||||
public function getUri(): void
|
||||
{
|
||||
$place = Place::find(1);
|
||||
$this->assertEquals(config('app.url') . '/places/the-bridgewater-pub', $place->uri);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function placeServiceReturnsExistingPlaceBasedOnExternalUrlsSearch(): void
|
||||
{
|
||||
$place = new Place();
|
||||
$place->name = 'Temp Place';
|
||||
|
@ -64,28 +66,31 @@ class PlacesTest extends TestCase
|
|||
]
|
||||
]);
|
||||
$this->assertInstanceOf('App\Models\Place', $ret); // a place was returned
|
||||
$this->assertEquals(12, count(Place::all())); // still 2 places
|
||||
$this->assertCount(12, Place::all()); // still 12 places
|
||||
}
|
||||
|
||||
public function test_service_requires_name()
|
||||
/** @test */
|
||||
public function placeServiceRequiresNameWhenCreatingNewPlace(): void
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('Missing required name');
|
||||
|
||||
$service = new PlaceService();
|
||||
$service->createPlaceFromCheckin(['foo' => 'bar']);
|
||||
}
|
||||
|
||||
public function test_service_requires_latitude()
|
||||
/** @test */
|
||||
public function placeServiceRequiresLatitudeWhenCreatingNewPlace(): void
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('Missing required longitude/latitude');
|
||||
|
||||
$service = new PlaceService();
|
||||
$service->createPlaceFromCheckin(['properties' => ['name' => 'bar']]);
|
||||
}
|
||||
|
||||
public function test_updating_external_urls()
|
||||
/** @test */
|
||||
public function placeServcieCanupdateExternalUrls(): void
|
||||
{
|
||||
$place = Place::find(1);
|
||||
$place->external_urls = 'https://bridgewater.pub';
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\Models\Tag;
|
||||
|
@ -7,15 +9,17 @@ use Tests\TestCase;
|
|||
|
||||
class TagsTest extends TestCase
|
||||
{
|
||||
public function test_notes_method()
|
||||
/** @test */
|
||||
public function canGetAssociatedNotes(): void
|
||||
{
|
||||
$tag = Tag::find(1); // should be beer tag
|
||||
$this->assertEquals(1, count($tag->notes));
|
||||
$this->assertCount(1, $tag->notes);
|
||||
}
|
||||
|
||||
public function test_bookmarks_method()
|
||||
/** @test */
|
||||
public function canGetAssociatedBookmarks(): void
|
||||
{
|
||||
$tag = Tag::find(5); //should be first random tag for bookmarks
|
||||
$this->assertEquals(1, count($tag->bookmarks));
|
||||
$this->assertCount(1, $tag->bookmarks);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,32 +1,38 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use Codebird\Codebird;
|
||||
use Tests\TestCase;
|
||||
use App\Models\WebMention;
|
||||
use Thujohn\Twitter\Facades\Twitter;
|
||||
use Codebird\Codebird;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Tests\TestCase;
|
||||
|
||||
class WebMentionTest extends TestCase
|
||||
{
|
||||
public function test_commentable_method()
|
||||
/** @test */
|
||||
public function commentableMethodLinksToNotes(): void
|
||||
{
|
||||
$webmention = WebMention::find(1);
|
||||
$this->assertInstanceOf('App\Models\Note', $webmention->commentable);
|
||||
}
|
||||
public function test_published_attribute_when_no_relavent_mf2()
|
||||
|
||||
/** @test */
|
||||
public function publishedAttributeUsesUpdatedAtWhenNoRelevantMf2Data(): void
|
||||
{
|
||||
$webmention = new WebMention();
|
||||
$updated_at = carbon()->now();
|
||||
$updated_at = Carbon::now();
|
||||
$webmention->updated_at = $updated_at;
|
||||
$this->assertEquals($updated_at->toDayDateTimeString(), $webmention->published);
|
||||
}
|
||||
|
||||
public function test_published_attribute_when_error_parsing_mf2()
|
||||
/** @test */
|
||||
public function publishedAttributeUsesUpdatedAtWhenErrorParsingMf2Data(): void
|
||||
{
|
||||
$webmention = new WebMention();
|
||||
$updated_at = carbon()->now();
|
||||
$updated_at = Carbon::now();
|
||||
$webmention->updated_at = $updated_at;
|
||||
$webmention->mf2 = json_encode([
|
||||
'items' => [[
|
||||
|
@ -40,12 +46,8 @@ class WebMentionTest extends TestCase
|
|||
$this->assertEquals($updated_at->toDayDateTimeString(), $webmention->published);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a correct profile link is formed from a generic URL.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_create_photo_link_with_non_cached_image()
|
||||
/** @test */
|
||||
public function createPhotoLinkDoesNothingWithGenericUrlAndNoLocallySavedImage(): void
|
||||
{
|
||||
$webmention = new WebMention();
|
||||
$homepage = 'https://example.org/profile.png';
|
||||
|
@ -53,12 +55,8 @@ class WebMentionTest extends TestCase
|
|||
$this->assertEquals($expected, $webmention->createPhotoLink($homepage));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a correct profile link is formed from a generic URL (cached).
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_create_photo_link_with_cached_image()
|
||||
/** @test */
|
||||
public function createPhotoLinkReturnsLocallySavedImageUrlIfItExists(): void
|
||||
{
|
||||
$webmention = new WebMention();
|
||||
$homepage = 'https://aaronparecki.com/profile.png';
|
||||
|
@ -66,12 +64,8 @@ class WebMentionTest extends TestCase
|
|||
$this->assertEquals($expected, $webmention->createPhotoLink($homepage));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a correct profile link is formed from a twitter URL.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_create_photo_link_with_twimg_profile_image_url()
|
||||
/** @test */
|
||||
public function createPhotoLinkDealsWithSpecialCaseOfDirectTwitterPhotoLinks(): void
|
||||
{
|
||||
$webmention = new WebMention();
|
||||
$twitterProfileImage = 'http://pbs.twimg.com/1234';
|
||||
|
@ -79,12 +73,8 @@ class WebMentionTest extends TestCase
|
|||
$this->assertEquals($expected, $webmention->createPhotoLink($twitterProfileImage));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test `null` is returned for a twitter profile.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_create_photo_link_with_cached_twitter_url()
|
||||
/** @test */
|
||||
public function createPhotoLinkReturnsCachedTwitterPhotoLinks(): void
|
||||
{
|
||||
$webmention = new WebMention();
|
||||
$twitterURL = 'https://twitter.com/example';
|
||||
|
@ -93,10 +83,12 @@ class WebMentionTest extends TestCase
|
|||
$this->assertEquals($expected, $webmention->createPhotoLink($twitterURL));
|
||||
}
|
||||
|
||||
public function test_create_photo_link_with_noncached_twitter_url()
|
||||
/** @test */
|
||||
public function createPhotoLinkResolvesTwitterPhotoLinks(): void
|
||||
{
|
||||
$info = new \stdClass();
|
||||
$info->profile_image_url_https = 'https://pbs.twimg.com/static_profile_link.jpg';
|
||||
$info = (object) [
|
||||
'profile_image_url_https' => 'https://pbs.twimg.com/static_profile_link.jpg',
|
||||
];
|
||||
$codebirdMock = $this->getMockBuilder(Codebird::class)
|
||||
->addMethods(['users_show'])
|
||||
->getMock();
|
||||
|
@ -117,13 +109,15 @@ class WebMentionTest extends TestCase
|
|||
$this->assertEquals($expected, $webmention->createPhotoLink($twitterURL));
|
||||
}
|
||||
|
||||
public function test_get_reply_attribute_returns_null()
|
||||
/** @test */
|
||||
public function getReplyAttributeDefaultsToNull(): void
|
||||
{
|
||||
$webmention = new WebMention();
|
||||
$this->assertNull($webmention->reply);
|
||||
}
|
||||
|
||||
public function test_get_reply_attribute_with_mf2_without_html_returns_null()
|
||||
/** @test */
|
||||
public function getReplyAttributeWithMf2WithoutHtmlReturnsNull(): void
|
||||
{
|
||||
$webmention = new WebMention();
|
||||
$webmention->mf2 = json_encode(['no_html' => 'found_here']);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue