Fix files with Laravel Pint
This commit is contained in:
parent
c714457604
commit
e36f15d391
116 changed files with 409 additions and 378 deletions
|
@ -18,8 +18,9 @@ class HelpersTest extends TestCase
|
|||
/**
|
||||
* @test
|
||||
* @dataProvider urlProvider
|
||||
* @param string $input
|
||||
* @param string $output
|
||||
*
|
||||
* @param string $input
|
||||
* @param string $output
|
||||
*/
|
||||
public function normalizeUrlOnDataProvider(string $input, string $output): void
|
||||
{
|
||||
|
@ -30,12 +31,12 @@ class HelpersTest extends TestCase
|
|||
public function prettyPrintJson(): void
|
||||
{
|
||||
// phpcs:disable Generic.Files.LineLength.TooLong
|
||||
$json = <<<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;
|
||||
// phpcs:enable Generic.Files.LineLength.TooLong
|
||||
|
||||
$expected = <<<EXPECTED
|
||||
$expected = <<<'EXPECTED'
|
||||
{
|
||||
"glossary": {
|
||||
"title": "example glossary",
|
||||
|
|
|
@ -28,7 +28,7 @@ class DownloadWebMentionJobTest extends TestCase
|
|||
{
|
||||
$this->assertFileDoesNotExist(storage_path('HTML/https'));
|
||||
$source = 'https://example.org/reply/1';
|
||||
$html = <<<HTML
|
||||
$html = <<<'HTML'
|
||||
<div class="h-entry">
|
||||
<a class="u-like-of" href=""></a>
|
||||
</div>
|
||||
|
@ -56,12 +56,12 @@ class DownloadWebMentionJobTest extends TestCase
|
|||
{
|
||||
$this->assertFileDoesNotExist(storage_path('HTML/https'));
|
||||
$source = 'https://example.org/reply/1';
|
||||
$html = <<<HTML
|
||||
$html = <<<'HTML'
|
||||
<div class="h-entry">
|
||||
<a class="u-like-of" href=""></a>
|
||||
</div>
|
||||
HTML;
|
||||
$html2 = <<<HTML
|
||||
$html2 = <<<'HTML'
|
||||
<div class="h-entry">
|
||||
<a class="u-like-of" href=""></a>
|
||||
<a class="u-repost-of" href=""></a>
|
||||
|
@ -91,7 +91,7 @@ class DownloadWebMentionJobTest extends TestCase
|
|||
{
|
||||
$this->assertFileDoesNotExist(storage_path('HTML/https'));
|
||||
$source = 'https://example.org/reply-one/';
|
||||
$html = <<<HTML
|
||||
$html = <<<'HTML'
|
||||
<div class="h-entry">
|
||||
<a class="u-like-of" href=""></a>
|
||||
</div>
|
||||
|
|
|
@ -58,7 +58,7 @@ class ProcessWebMentionJobTest extends TestCase
|
|||
|
||||
$parser = new Parser();
|
||||
|
||||
$html = <<<HTML
|
||||
$html = <<<'HTML'
|
||||
<div class="h-entry">
|
||||
I liked <a class="u-like-of" href="/notes/1">a note</a>.
|
||||
</div>
|
||||
|
@ -125,7 +125,7 @@ class ProcessWebMentionJobTest extends TestCase
|
|||
{
|
||||
$parser = new Parser();
|
||||
|
||||
$html = <<<HTML
|
||||
$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>
|
||||
|
@ -162,7 +162,7 @@ class ProcessWebMentionJobTest extends TestCase
|
|||
{
|
||||
$parser = new Parser();
|
||||
|
||||
$html = <<<HTML
|
||||
$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>
|
||||
|
@ -199,7 +199,7 @@ class ProcessWebMentionJobTest extends TestCase
|
|||
{
|
||||
$parser = new Parser();
|
||||
|
||||
$html = <<<HTML
|
||||
$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>
|
||||
|
|
|
@ -23,7 +23,7 @@ class SyndicateBookmarkToTwitterJobTest extends TestCase
|
|||
$faker = \Faker\Factory::create();
|
||||
$randomNumber = $faker->randomNumber();
|
||||
$json = json_encode([
|
||||
'url' => 'https://twitter.com/' . $randomNumber
|
||||
'url' => 'https://twitter.com/' . $randomNumber,
|
||||
]);
|
||||
$mock = new MockHandler([
|
||||
new Response(201, ['Content-Type' => 'application/json'], $json),
|
||||
|
|
|
@ -45,7 +45,7 @@ class LikesTest extends TestCase
|
|||
/** @test */
|
||||
public function htmlLikeContentIsFiltered(): void
|
||||
{
|
||||
$htmlEvil = <<<HTML
|
||||
$htmlEvil = <<<'HTML'
|
||||
<div class="h-entry">
|
||||
<div class="e-content">
|
||||
<p>Hello</p>
|
||||
|
@ -53,7 +53,7 @@ class LikesTest extends TestCase
|
|||
</div>
|
||||
</div>
|
||||
HTML;
|
||||
$htmlFiltered = <<<HTML
|
||||
$htmlFiltered = <<<'HTML'
|
||||
<p>Hello</p>
|
||||
<img />
|
||||
HTML;
|
||||
|
|
|
@ -4,14 +4,18 @@ declare(strict_types=1);
|
|||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\Models\{Contact, Media, Note, Place, Tag};
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use App\Models\Contact;
|
||||
use App\Models\Media;
|
||||
use App\Models\Note;
|
||||
use App\Models\Place;
|
||||
use App\Models\Tag;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use GuzzleHttp\HandlerStack;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Tests\TestCase;
|
||||
|
||||
class NotesTest extends TestCase
|
||||
|
@ -23,6 +27,7 @@ class NotesTest extends TestCase
|
|||
* relevant sub-methods.
|
||||
*
|
||||
* @test
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function getNoteAttributeMethodCallsSubMethods(): void
|
||||
|
@ -39,6 +44,7 @@ class NotesTest extends TestCase
|
|||
* Look for a default image in the contact’s h-card for the makeHCards method.
|
||||
*
|
||||
* @test
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function defaultImageUsedAsFallbackInMakehcardsMethod(): void
|
||||
|
@ -62,6 +68,7 @@ class NotesTest extends TestCase
|
|||
* Look for a specific profile image in the contact’s h-card.
|
||||
*
|
||||
* @test
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function specificProfileImageUsedInMakehcardsMethod(): void
|
||||
|
@ -75,7 +82,7 @@ class NotesTest extends TestCase
|
|||
]);
|
||||
$fileSystem = new Filesystem();
|
||||
$fileSystem->ensureDirectoryExists(public_path('/assets/profile-images/aaronparecki.com'));
|
||||
if (!$fileSystem->exists(public_path('/assets/profile-images/aaronparecki.com/image'))) {
|
||||
if (! $fileSystem->exists(public_path('/assets/profile-images/aaronparecki.com/image'))) {
|
||||
$fileSystem->copy('./tests/aaron.png', public_path('/assets/profile-images/aaronparecki.com/image'));
|
||||
}
|
||||
$note = Note::factory()->create([
|
||||
|
@ -91,6 +98,7 @@ class NotesTest extends TestCase
|
|||
* Look for twitter URL when there’s no associated contact.
|
||||
*
|
||||
* @test
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function twitterLinkIsCreatedWhenNoContactFound(): void
|
||||
|
@ -306,8 +314,8 @@ class NotesTest extends TestCase
|
|||
]);
|
||||
$note->media()->save($media);
|
||||
|
||||
$expected = "<p>A nice image</p>
|
||||
<img src=\"" . config('filesystems.disks.s3.url') . "/test.png\" alt=\"\">";
|
||||
$expected = '<p>A nice image</p>
|
||||
<img src="' . config('filesystems.disks.s3.url') . '/test.png" alt="">';
|
||||
$this->assertEquals($expected, $note->content);
|
||||
}
|
||||
|
||||
|
@ -323,8 +331,8 @@ class NotesTest extends TestCase
|
|||
]);
|
||||
$note->media()->save($media);
|
||||
|
||||
$expected = "<p>A nice video</p>
|
||||
<video src=\"" . config('filesystems.disks.s3.url') . "/test.mkv\">";
|
||||
$expected = '<p>A nice video</p>
|
||||
<video src="' . config('filesystems.disks.s3.url') . '/test.mkv">';
|
||||
$this->assertEquals($expected, $note->content);
|
||||
}
|
||||
|
||||
|
@ -340,13 +348,14 @@ class NotesTest extends TestCase
|
|||
]);
|
||||
$note->media()->save($media);
|
||||
|
||||
$expected = "<p>Some nice audio</p>
|
||||
<audio src=\"" . config('filesystems.disks.s3.url') . "/test.flac\">";
|
||||
$expected = '<p>Some nice audio</p>
|
||||
<audio src="' . config('filesystems.disks.s3.url') . '/test.flac">';
|
||||
$this->assertEquals($expected, $note->content);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @todo Why do we need to provide text?
|
||||
*/
|
||||
public function provideTextForBlankContent(): void
|
||||
|
@ -392,7 +401,7 @@ class NotesTest extends TestCase
|
|||
Cache::put('933662564587855877', $tempContent);
|
||||
|
||||
$note = Note::factory()->create([
|
||||
'in_reply_to' => 'https://twitter.com/someRando/status/933662564587855877'
|
||||
'in_reply_to' => 'https://twitter.com/someRando/status/933662564587855877',
|
||||
]);
|
||||
|
||||
$this->assertSame($tempContent, $note->twitter);
|
||||
|
|
|
@ -9,7 +9,6 @@ use App\Models\Place;
|
|||
use App\Services\PlaceService;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use InvalidArgumentException;
|
||||
use Tests\TestCase;
|
||||
|
||||
|
@ -82,7 +81,7 @@ class PlacesTest extends TestCase
|
|||
$ret = $service->createPlaceFromCheckin([
|
||||
'properties' => [
|
||||
'url' => ['https://www.openstreetmap.org/way/1234'],
|
||||
]
|
||||
],
|
||||
]);
|
||||
$this->assertInstanceOf('App\Models\Place', $ret);
|
||||
$this->assertCount(11, Place::all());
|
||||
|
|
|
@ -35,8 +35,9 @@ class TagsTest extends TestCase
|
|||
/**
|
||||
* @test
|
||||
* @dataProvider tagsProvider
|
||||
* @param string $input
|
||||
* @param string $expected
|
||||
*
|
||||
* @param string $input
|
||||
* @param string $expected
|
||||
*/
|
||||
public function canNormalize(string $input, string $expected): void
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue