Rename the tests to pass phpcs checks

This commit is contained in:
Jonny Barnes 2021-03-17 18:38:18 +00:00
parent 3946e9aac4
commit d5bbed1eac
52 changed files with 1329 additions and 1062 deletions

View file

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