diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000000..6e7754e928c --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,72 @@ +# This is a comment. +# Each line is a file pattern followed by one or more owners. + +# These owners will be the default owners for everything in +# the repo. Unless a later match takes precedence, +# @global-owner1 and @global-owner2 will be requested for +# review when someone opens a pull request. + +# Default owner for everything in the repo are members of the reviewers team. + +* @LycheeOrg/reviewers + +# Comments bellow are kept for reference + +# Order is important; the last matching pattern takes the most +# precedence. When someone opens a pull request that only +# modifies JS files, only @js-owner and not the global +# owner(s) will be requested for a review. +# *.js @js-owner #This is an inline comment. + +# You can also use email addresses if you prefer. They'll be +# used to look up users just like we do for commit author +# emails. +# *.go docs@example.com + +# Teams can be specified as code owners as well. Teams should +# be identified in the format @org/team-name. Teams must have +# explicit write access to the repository. In this example, +# the octocats team in the octo-org organization owns all .txt files. +# *.txt @octo-org/octocats + +# In this example, @doctocat owns any files in the build/logs +# directory at the root of the repository and any of its +# subdirectories. +# /build/logs/ @doctocat + +# The `docs/*` pattern will match files like +# `docs/getting-started.md` but not further nested files like +# `docs/build-app/troubleshooting.md`. +# docs/* docs@example.com + +# In this example, @octocat owns any file in an apps directory +# anywhere in your repository. +# apps/ @octocat + +# In this example, @doctocat owns any file in the `/docs` +# directory in the root of your repository and any of its +# subdirectories. +# /docs/ @doctocat + +# In this example, any change inside the `/scripts` directory +# will require approval from @doctocat or @octocat. +# /scripts/ @doctocat @octocat + +# In this example, @octocat owns any file in a `/logs` directory such as +# `/build/logs`, `/scripts/logs`, and `/deeply/nested/logs`. Any changes +# in a `/logs` directory will require approval from @octocat. +# **/logs @octocat + +# In this example, @octocat owns any file in the `/apps` +# directory in the root of your repository except for the `/apps/github` +# subdirectory, as its owners are left empty. Without an owner, changes +# to `apps/github` can be made with the approval of any user who has +# write access to the repository. +# /apps/ @octocat +# /apps/github + +# In this example, @octocat owns any file in the `/apps` +# directory in the root of your repository except for the `/apps/github` +# subdirectory, as this subdirectory has its own owner @doctocat +# /apps/ @octocat +# /apps/github @doctocat \ No newline at end of file diff --git a/phpstan.neon b/phpstan.neon index 6f5bceed5da..27aaaca03c9 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -39,7 +39,6 @@ parameters: - '#Dynamic call to static method (Illuminate\\Database\\Query\\Builder|Illuminate\\Database\\Eloquent\\(Builder|Relations\\.*)|App\\Models\\Builders\\.*|App\\Eloquent\\FixedQueryBuilder|App\\Relations\\.*)(<.*>)?::where(Not)?(Null|In|Between|Exists|Column|Year|Month|Day)?\(\).#' - '#Dynamic call to static method (Illuminate\\Database\\Query\\Builder|Illuminate\\Database\\Eloquent\\(Builder|Relations\\.*)|App\\Models\\Builders\\.*|App\\Eloquent\\FixedQueryBuilder|App\\Relations\\.*)(<.*>)?::delete\(\)#' - '#Dynamic call to static method (Illuminate\\Database\\Query\\Builder|Illuminate\\Database\\Eloquent\\(Builder|Relations\\.*)|App\\Models\\Builders\\.*|App\\Eloquent\\FixedQueryBuilder|App\\Relations\\.*)(<.*>)?::without\(\)#' - # - '#Dynamic call to static method (Illuminate\\Database\\Query\\Builder|Illuminate\\Database\\Eloquent\\(Builder|Relations\\.*)|App\\Models\\Builders\\.*|App\\Eloquent\\FixedQueryBuilder|App\\Relations\\.*)(<.*>)?::with\(\)#' - '#Dynamic call to static method (Illuminate\\Database\\Query\\Builder|Illuminate\\Database\\Eloquent\\(Builder|Relations\\.*)|App\\Models\\Builders\\.*|App\\Eloquent\\FixedQueryBuilder|App\\Relations\\.*)(<.*>)?::count\(\).#' - '#Dynamic call to static method (Illuminate\\Database\\Query\\Builder|Illuminate\\Database\\Eloquent\\(Builder|Relations\\.*)|App\\Models\\Builders\\.*|App\\Eloquent\\FixedQueryBuilder|App\\Relations\\.*)(<.*>)?::update\(\).#' - '#Dynamic call to static method (Illuminate\\Database\\Query\\Builder|Illuminate\\Database\\Eloquent\\(Builder|Relations\\.*)|App\\Models\\Builders\\.*|App\\Eloquent\\FixedQueryBuilder|App\\Relations\\.*)(<.*>)?::inRandomOrder\(\).#' @@ -50,18 +49,9 @@ parameters: - '#Dynamic call to static method (Illuminate\\Database\\Query\\Builder|Illuminate\\Database\\Eloquent\\(Builder|Relations\\.*)|App\\Models\\Builders\\.*|App\\Eloquent\\FixedQueryBuilder|App\\Relations\\.*)(<.*>)?::exists\(\).#' - '#Dynamic call to static method App\\Models\\Builders\\.*::orderByDesc\(\).#' - '#Dynamic call to static method App\\Models\\Builders\\.*::selectRaw\(\).#' - # - '#Call to an undefined method Illuminate\\Database\\Eloquent\\.*::with(Only)?\(\)#' - # - '#Call to an undefined method App\\Relations\\HasManyPhotosRecursively::whereNotNull\(\)#' - # - '#Call to an undefined method Illuminate\\Database\\Eloquent\\Builder|Illuminate\\Database\\Eloquent\\Relations\\Relation::whereNotNull\(\).#' - '#Call to protected method asDateTime\(\) of class Illuminate\\Database\\Eloquent\\Model.#' # Covariance - LSP princinple: https://en.wikipedia.org/wiki/Liskov_substitution_principle - # - - # message: '#Parameter \#1 \$column \(array\|Closure\|Illuminate\\Database\\Query\\Expression\|string\) of method .* should be contravariant with parameter \$column \(array\|\(Closure.*\)\|\(Closure.*\)\|Illuminate\\Contracts\\Database\\Query\\Expression\|string\) of method .*#' - # paths: - # - app/Eloquent/FixedQueryBuilderTrait.php - # - '#Parameter \#1 \$models .* of method .*::initRelation\(\) should be contravariant with parameter \$models .* of method .*::initRelation\(\)#' - # - '#Parameter \#(1|2) \$(models|albums|photos|results) .* of method .*::(match|addEagerConstraints)\(\) should be contravariant with parameter \$(models|albums|photos|results) .* of method .*::(match|addEagerConstraints)\(\)#' - '#Parameter .* of method .*::replicate\(\) should be contravariant with parameter .* of method .*::replicate\(\)#' - '#Parameter .* of method .*::save\(\) should be contravariant with parameter .* of method .*::save\(\)#' - '#Parameter .* of method .*::newEloquentBuilder\(\) should be contravariant with parameter .* of method Kalnoy\\Nestedset\\Node<.*>::newEloquentBuilder\(\)#' @@ -75,23 +65,9 @@ parameters: - '#Dynamic call to static method Illuminate\\Foundation\\Application::getCachedConfigPath\(\).#' - '#Dynamic call to static method Illuminate\\Foundation\\Application::getCachedRoutesPath\(\).#' - - # - '#Access to an undefined property Laragear\\WebAuthn\\Models\\WebAuthnCredential::\$authenticatable_id#' - # False positive as stub code for PHP has not yet been updated to 2nd parameter, see https://github.com/php/doc-en/issues/1529 and https://www.php.net/imagick.writeimagefile # - '#Method Imagick::writeImageFile\(\) invoked with 2 parameters, 1 required#' - # Synth - # - - # message: '#Variable property access on .*#' - # paths: - # - app/Livewire/Synth - - # - - # message: '#Parameter .* of method App\\Livewire\\Synth\\.* should be contravariant with parameter .* of method Livewire\\Mechanisms\\HandleComponents\\Synthesizers\\Synth::.*#' - # paths: - # - app/Livewire/Synth - # Migrations - message: '#Function define is unsafe to use.#' @@ -117,26 +93,6 @@ parameters: message: '#no value type specified in iterable type array.#' paths: - tests - # - - # message: '#Dynamic call to static method Illuminate\\Testing\\TestResponse::assert(Forbidden|ViewIs|Unauthorized|Ok|Status)#' - # paths: - # - tests - # - - # message: '#Call to an undefined method Illuminate\\Testing\\TestResponse::(assert)?(SeeLivewire|dispatch|call|Set|Count)#' - # paths: - # - tests - - - message: '#Dynamic call to static method PHPUnit\\Framework\\Assert::assert(Is)?(Not)?(True|False|Equals|Int|Null|Empty|Count)\(\)#' - paths: - - tests - - - message: '#Dynamic call to static method PHPUnit\\Framework\\Assert::assertFile(DoesNot)?Exists?\(\)#' - paths: - - tests - - - message: '#Dynamic call to static method PHPUnit\\Framework\\Assert::assertString(Not)?(Contains|Ends|Starts)(String|With)\(\)#' - paths: - - tests - message: '#Dynamic call to static method Symfony\\Component\\HttpFoundation\\Response::get(Content|StatusCode)\(\)#' paths: @@ -149,7 +105,6 @@ parameters: message: '#Cannot call method .* on Illuminate\\Testing\\PendingCommand\|int.#' paths: - tests - - message: '#Access to private property App\\Models\\Extensions\\SizeVariants::\$(original|small(2x)?|thumb(2x)?|medium(2x)?|placeholder)#' paths: diff --git a/scripts/delete_legacy.sh b/scripts/delete_legacy.sh index 82a22728e53..5507ec9e5f0 100644 --- a/scripts/delete_legacy.sh +++ b/scripts/delete_legacy.sh @@ -39,6 +39,6 @@ rm -fr routes/web-admin-v1.php sed -i "\#^.*login_required_v1#d" ./app/Http/Kernel.php sed -i '11d;50,56d;60,64d;68,75d' ./app/Providers/RouteServiceProvider.php -sed -i '42d;54d;55d;79d;84,94d;132,135d;136,139d;148,152d;153,156d' phpstan.neon +sed -i '104,111d' phpstan.neon diff --git a/tests/Feature_v1/AlbumTest.php b/tests/Feature_v1/AlbumTest.php index faa987b8d8e..ef3364d0c91 100644 --- a/tests/Feature_v1/AlbumTest.php +++ b/tests/Feature_v1/AlbumTest.php @@ -785,15 +785,15 @@ public function testSetCoverByOwner() $this->albums_tests->set_cover($albumID, $photoID1); $coverID = $this->albums_tests->get($albumID)->offsetGet('cover_id'); - $this->assertEquals($photoID1, $coverID); + self::assertEquals($photoID1, $coverID); $this->albums_tests->set_cover($albumID, $photoID2); $coverID = $this->albums_tests->get($albumID)->offsetGet('cover_id'); - $this->assertEquals($photoID2, $coverID); + self::assertEquals($photoID2, $coverID); $this->albums_tests->set_cover($albumID, null); $coverID = $this->albums_tests->get($albumID)->offsetGet('cover_id'); - $this->assertEquals($initialCoverID, $coverID); + self::assertEquals($initialCoverID, $coverID); Auth::logout(); Session::flush(); @@ -847,15 +847,15 @@ public function testSetHeaderByOwner() $this->albums_tests->set_header($albumID, $photoID1); $headerID = $this->albums_tests->get($albumID)->offsetGet('header_id'); - $this->assertEquals($photoID1, $headerID); + self::assertEquals($photoID1, $headerID); $this->albums_tests->set_header($albumID, $photoID2); $headerID = $this->albums_tests->get($albumID)->offsetGet('header_id'); - $this->assertEquals($photoID2, $headerID); + self::assertEquals($photoID2, $headerID); $this->albums_tests->set_header($albumID, null); $headerID = $this->albums_tests->get($albumID)->offsetGet('header_id'); - $this->assertEquals($initialHeaderID, $headerID); + self::assertEquals($initialHeaderID, $headerID); Auth::logout(); Session::flush(); diff --git a/tests/Feature_v1/BasePhotosAddHandler.php b/tests/Feature_v1/BasePhotosAddHandler.php index df74c66b7a9..4f49b87ed99 100644 --- a/tests/Feature_v1/BasePhotosAddHandler.php +++ b/tests/Feature_v1/BasePhotosAddHandler.php @@ -241,7 +241,7 @@ public function testPNGUpload(): void $photo = static::convertJsonToObject($this->photos_tests->upload( AbstractTestCase::createUploadedFile(TestConstants::SAMPLE_FILE_PNG) )); - $this->assertStringEndsWith('.png', $photo->size_variants->original->url); + self::assertStringEndsWith('.png', $photo->size_variants->original->url); } public function testGIFUpload(): void @@ -250,7 +250,7 @@ public function testGIFUpload(): void $photo = static::convertJsonToObject($this->photos_tests->upload( AbstractTestCase::createUploadedFile(TestConstants::SAMPLE_FILE_GIF) )); - $this->assertStringEndsWith('.gif', $photo->size_variants->original->url); + self::assertStringEndsWith('.gif', $photo->size_variants->original->url); } public function testWEBPUpload(): void @@ -259,7 +259,7 @@ public function testWEBPUpload(): void $photo = static::convertJsonToObject($this->photos_tests->upload( AbstractTestCase::createUploadedFile(TestConstants::SAMPLE_FILE_WEBP) )); - $this->assertStringEndsWith('.webp', $photo->size_variants->original->url); + self::assertStringEndsWith('.webp', $photo->size_variants->original->url); } /** @@ -281,11 +281,11 @@ public function testAppleLivePhotoUpload1(): void null, [200, 201] )); - $this->assertEquals($photo->id, $video->id); - $this->assertEquals('E905E6C6-C747-4805-942F-9904A0281F02', $video->live_photo_content_id); - $this->assertStringEndsWith('.mov', $video->live_photo_url); - $this->assertEquals(pathinfo($video->live_photo_url, PATHINFO_DIRNAME), pathinfo($video->size_variants->original->url, PATHINFO_DIRNAME)); - $this->assertEquals(pathinfo($video->live_photo_url, PATHINFO_FILENAME), pathinfo($video->size_variants->original->url, PATHINFO_FILENAME)); + self::assertEquals($photo->id, $video->id); + self::assertEquals('E905E6C6-C747-4805-942F-9904A0281F02', $video->live_photo_content_id); + self::assertStringEndsWith('.mov', $video->live_photo_url); + self::assertEquals(pathinfo($video->live_photo_url, PATHINFO_DIRNAME), pathinfo($video->size_variants->original->url, PATHINFO_DIRNAME)); + self::assertEquals(pathinfo($video->live_photo_url, PATHINFO_FILENAME), pathinfo($video->size_variants->original->url, PATHINFO_FILENAME)); } /** @@ -307,13 +307,13 @@ public function testAppleLivePhotoUpload2(): void null, [200, 201] // associated image to video. )); - $this->assertEquals('E905E6C6-C747-4805-942F-9904A0281F02', $photo->live_photo_content_id); - $this->assertStringEndsWith('.mov', $photo->live_photo_url); - $this->assertEquals(pathinfo($photo->live_photo_url, PATHINFO_DIRNAME), pathinfo($photo->size_variants->original->url, PATHINFO_DIRNAME)); - $this->assertEquals(pathinfo($photo->live_photo_url, PATHINFO_FILENAME), pathinfo($photo->size_variants->original->url, PATHINFO_FILENAME)); + self::assertEquals('E905E6C6-C747-4805-942F-9904A0281F02', $photo->live_photo_content_id); + self::assertStringEndsWith('.mov', $photo->live_photo_url); + self::assertEquals(pathinfo($photo->live_photo_url, PATHINFO_DIRNAME), pathinfo($photo->size_variants->original->url, PATHINFO_DIRNAME)); + self::assertEquals(pathinfo($photo->live_photo_url, PATHINFO_FILENAME), pathinfo($photo->size_variants->original->url, PATHINFO_FILENAME)); // The initially uploaded video should have been deleted - $this->assertEquals(0, DB::table('photos')->where('id', '=', $video->id)->count()); + self::assertEquals(0, DB::table('photos')->where('id', '=', $video->id)->count()); } /** @@ -331,9 +331,9 @@ public function testGoogleMotionPhotoUpload(): void AbstractTestCase::createUploadedFile(TestConstants::SAMPLE_FILE_GMP_IMAGE) )); - $this->assertStringEndsWith('.mov', $photo->live_photo_url); - $this->assertEquals(pathinfo($photo->live_photo_url, PATHINFO_DIRNAME), pathinfo($photo->size_variants->original->url, PATHINFO_DIRNAME)); - $this->assertEquals(pathinfo($photo->live_photo_url, PATHINFO_FILENAME), pathinfo($photo->size_variants->original->url, PATHINFO_FILENAME)); + self::assertStringEndsWith('.mov', $photo->live_photo_url); + self::assertEquals(pathinfo($photo->live_photo_url, PATHINFO_DIRNAME), pathinfo($photo->size_variants->original->url, PATHINFO_DIRNAME)); + self::assertEquals(pathinfo($photo->live_photo_url, PATHINFO_FILENAME), pathinfo($photo->size_variants->original->url, PATHINFO_FILENAME)); } /** diff --git a/tests/Feature_v1/CommandFixPermissionsTest.php b/tests/Feature_v1/CommandFixPermissionsTest.php index 20383cc447b..0b8b4ee6fe8 100644 --- a/tests/Feature_v1/CommandFixPermissionsTest.php +++ b/tests/Feature_v1/CommandFixPermissionsTest.php @@ -56,8 +56,8 @@ public function testFixPermissions(): void $this->artisan(self::COMMAND, ['--dry-run' => 0])->assertSuccessful(); clearstatcache(true); - $this->assertEquals(00664, fileperms($filePath) & 07777); - $this->assertEquals(02775, fileperms($dirPath) & 07777); + self::assertEquals(00664, fileperms($filePath) & 07777); + self::assertEquals(02775, fileperms($dirPath) & 07777); chmod($filePath, 00777); chmod($dirPath, 06777); @@ -65,7 +65,7 @@ public function testFixPermissions(): void $this->artisan(self::COMMAND, ['--dry-run' => 0])->assertSuccessful(); clearstatcache(true); - $this->assertEquals(00664, fileperms($filePath) & 07777); - $this->assertEquals(02775, fileperms($dirPath) & 07777); + self::assertEquals(00664, fileperms($filePath) & 07777); + self::assertEquals(02775, fileperms($dirPath) & 07777); } } diff --git a/tests/Feature_v1/CommandGenerateThumbsTest.php b/tests/Feature_v1/CommandGenerateThumbsTest.php index d6e8af8a152..5c70d3fd26b 100644 --- a/tests/Feature_v1/CommandGenerateThumbsTest.php +++ b/tests/Feature_v1/CommandGenerateThumbsTest.php @@ -70,9 +70,9 @@ public function testThumbRecreation(): void // Get updated photo and check if size variant has been re-created /** @var \App\Models\Photo $photo2 */ $photo2 = static::convertJsonToObject($this->photos_tests->get($photo1->id)); - $this->assertNotNull($photo2->size_variants->small); - $this->assertEquals($photo1->size_variants->small->width, $photo2->size_variants->small->width); - $this->assertEquals($photo1->size_variants->small->height, $photo2->size_variants->small->height); - $this->assertFileExists(public_path($this->dropUrlPrefix($photo2->size_variants->small->url))); + self::assertNotNull($photo2->size_variants->small); + self::assertEquals($photo1->size_variants->small->width, $photo2->size_variants->small->width); + self::assertEquals($photo1->size_variants->small->height, $photo2->size_variants->small->height); + self::assertFileExists(public_path($this->dropUrlPrefix($photo2->size_variants->small->url))); } } diff --git a/tests/Feature_v1/CommandGhostbusterTest.php b/tests/Feature_v1/CommandGhostbusterTest.php index e4d13dc63d9..5d3ce639c82 100644 --- a/tests/Feature_v1/CommandGhostbusterTest.php +++ b/tests/Feature_v1/CommandGhostbusterTest.php @@ -44,7 +44,7 @@ public function testRemoveOrphanedFiles(): void $this->dropUrlPrefix($photo->size_variants->thumb2x?->url), $this->dropUrlPrefix($photo->size_variants->thumb->url), ], [null]); - $this->assertNotEmpty($fileURLs); + self::assertNotEmpty($fileURLs); // Remove photo and size variants from DB manually; note we must // not use an API call as this would also remove the files, and we @@ -58,7 +58,7 @@ public function testRemoveOrphanedFiles(): void // Ensure that files are still there foreach ($fileURLs as $fileURL) { - $this->assertFileExists(public_path($fileURL)); + self::assertFileExists(public_path($fileURL)); } // Ghostbuster, ... @@ -69,7 +69,7 @@ public function testRemoveOrphanedFiles(): void // Ensure that files are gone foreach ($fileURLs as $fileURL) { - $this->assertFileDoesNotExist(public_path($fileURL)); + self::assertFileDoesNotExist(public_path($fileURL)); } } @@ -93,7 +93,7 @@ public function testRemoveZombiePhotos(): void $this->dropUrlPrefix($photo->size_variants->thumb2x?->url), $this->dropUrlPrefix($photo->size_variants->thumb->url), ], [null]); - $this->assertNotEmpty($fileURLs); + self::assertNotEmpty($fileURLs); // Remove original file \Safe\unlink(public_path($this->dropUrlPrefix($originalFileURL))); @@ -106,20 +106,20 @@ public function testRemoveZombiePhotos(): void ->assertSuccessful(); // Ensure that photo, size variants and all other size variants are gone - $this->assertEquals( + self::assertEquals( 0, DB::table('photos') ->where('id', '=', $photo->id) ->count() ); - $this->assertEquals( + self::assertEquals( 0, DB::table('size_variants') ->where('photo_id', '=', $photo->id) ->count() ); foreach ($fileURLs as $fileURL) { - $this->assertFileDoesNotExist(public_path($fileURL)); + self::assertFileDoesNotExist(public_path($fileURL)); } } } diff --git a/tests/Feature_v1/CommandTakeDateTest.php b/tests/Feature_v1/CommandTakeDateTest.php index da8fcdcc993..366b9ec95b3 100644 --- a/tests/Feature_v1/CommandTakeDateTest.php +++ b/tests/Feature_v1/CommandTakeDateTest.php @@ -56,6 +56,6 @@ public function testSetUploadTimeFromFileTime(): void $file_time = \Safe\filemtime(public_path($this->dropUrlPrefix($photo->size_variants->original->url))); $carbon = new Carbon($photo->created_at); - $this->assertEquals($file_time, $carbon->getTimestamp()); + self::assertEquals($file_time, $carbon->getTimestamp()); } } diff --git a/tests/Feature_v1/CommandVideoDataTest.php b/tests/Feature_v1/CommandVideoDataTest.php index d75bb65664c..182df65acc9 100644 --- a/tests/Feature_v1/CommandVideoDataTest.php +++ b/tests/Feature_v1/CommandVideoDataTest.php @@ -50,9 +50,9 @@ public function testThumbRecreation(): void // Get updated video and check if thumb has been re-created /** @var \App\Models\Photo $photo2 */ $photo2 = static::convertJsonToObject($this->photos_tests->get($photo1->id)); - $this->assertNotNull($photo2->size_variants->thumb); - $this->assertEquals($photo1->size_variants->thumb->width, $photo2->size_variants->thumb->width); - $this->assertEquals($photo1->size_variants->thumb->height, $photo2->size_variants->thumb->height); - $this->assertFileExists(public_path($this->dropUrlPrefix($photo2->size_variants->thumb->url))); + self::assertNotNull($photo2->size_variants->thumb); + self::assertEquals($photo1->size_variants->thumb->width, $photo2->size_variants->thumb->width); + self::assertEquals($photo1->size_variants->thumb->height, $photo2->size_variants->thumb->height); + self::assertFileExists(public_path($this->dropUrlPrefix($photo2->size_variants->thumb->url))); } } diff --git a/tests/Feature_v1/InstallTest.php b/tests/Feature_v1/InstallTest.php index 7b0fdd12e59..7978f8665f5 100644 --- a/tests/Feature_v1/InstallTest.php +++ b/tests/Feature_v1/InstallTest.php @@ -132,7 +132,7 @@ public function testInstall(): void $response->assertViewIs('install.setup-success'); // try to login with newly created admin - $this->assertTrue(Auth::attempt(['username' => 'admin', 'password' => 'password'])); + self::assertTrue(Auth::attempt(['username' => 'admin', 'password' => 'password'])); Auth::logout(); /** diff --git a/tests/Feature_v1/PhotosAddHandlerImagickTest.php b/tests/Feature_v1/PhotosAddHandlerImagickTest.php index ce38f2ffa4c..0fc327b4619 100644 --- a/tests/Feature_v1/PhotosAddHandlerImagickTest.php +++ b/tests/Feature_v1/PhotosAddHandlerImagickTest.php @@ -61,9 +61,9 @@ public function testAcceptedRawUpload(): void AbstractTestCase::createUploadedFile(TestConstants::SAMPLE_FILE_TIFF) )); - $this->assertStringEndsWith('.tif', $photo->size_variants->original->url); - $this->assertEquals(TestConstants::MIME_TYPE_IMG_TIFF, $photo->type); - $this->assertNotNull($photo->size_variants->thumb); + self::assertStringEndsWith('.tif', $photo->size_variants->original->url); + self::assertEquals(TestConstants::MIME_TYPE_IMG_TIFF, $photo->type); + self::assertNotNull($photo->size_variants->thumb); } finally { static::setAcceptedRawFormats($acceptedRawFormats); } diff --git a/tests/Feature_v1/PhotosAddMethodsTest.php b/tests/Feature_v1/PhotosAddMethodsTest.php index 7c7b065fea4..103eb308f43 100644 --- a/tests/Feature_v1/PhotosAddMethodsTest.php +++ b/tests/Feature_v1/PhotosAddMethodsTest.php @@ -41,7 +41,7 @@ public function testImportViaMove(): void { // import the photo copy(base_path(TestConstants::SAMPLE_FILE_NIGHT_IMAGE), static::importPath('night.jpg')); - $this->assertEquals(true, file_exists(static::importPath('night.jpg'))); + self::assertEquals(true, file_exists(static::importPath('night.jpg'))); $this->photos_tests->importFromServer( path: static::importPath(), album_id: null, @@ -49,7 +49,7 @@ public function testImportViaMove(): void skip_duplicates: false, import_via_symlink: false); // check if the file has been moved - $this->assertEquals(false, file_exists(static::importPath('night.jpg'))); + self::assertEquals(false, file_exists(static::importPath('night.jpg'))); } public function testImportViaCopy(): void @@ -64,7 +64,7 @@ public function testImportViaCopy(): void import_via_symlink: false); // check if the file is still there - $this->assertEquals(true, file_exists(static::importPath('night.jpg'))); + self::assertEquals(true, file_exists(static::importPath('night.jpg'))); } public function testImportViaSymlink(): void @@ -76,7 +76,7 @@ public function testImportViaSymlink(): void $this->photos_tests->importFromServer(static::importPath(), null, false, false, true); // check if the file is still there - $this->assertEquals(true, file_exists(static::importPath('night.jpg'))); + self::assertEquals(true, file_exists(static::importPath('night.jpg'))); // get the path of the photo object and check whether it is truly a symbolic link $ids_after = static::getRecentPhotoIDs(); @@ -85,7 +85,7 @@ public function testImportViaSymlink(): void $photo = static::convertJsonToObject($this->photos_tests->get($photo_id)); /** @disregard */ $symlink_path = public_path($this->dropUrlPrefix($photo->size_variants->original->url)); - $this->assertEquals(true, is_link($symlink_path)); + self::assertEquals(true, is_link($symlink_path)); } public function testImportSkipDuplicateWithResync(): void @@ -109,8 +109,8 @@ public function testImportSkipDuplicateWithResync(): void // import the photo a second time and request re-sync copy(base_path(TestConstants::SAMPLE_FILE_NIGHT_IMAGE), static::importPath('night.jpg')); $report = $this->photos_tests->importFromServer(static::importPath(), null, false, true, false, true); - $this->assertStringNotContainsString('PhotoSkippedException', $report); - $this->assertStringContainsString('PhotoResyncedException', $report); + self::assertStringNotContainsString('PhotoSkippedException', $report); + self::assertStringContainsString('PhotoResyncedException', $report); // The first photo is expected to have changed $response = $this->photos_tests->get($first_id); @@ -131,8 +131,8 @@ public function testImportSkipDuplicateWithoutResync(): void // import the photo a second time and skip the duplicate copy(base_path(TestConstants::SAMPLE_FILE_NIGHT_IMAGE), static::importPath('night.jpg')); $report = $this->photos_tests->importFromServer(static::importPath(), null, false, true, false, false); - $this->assertStringContainsString('PhotoSkippedException', $report); - $this->assertStringNotContainsString('PhotoResyncedException', $report); + self::assertStringContainsString('PhotoSkippedException', $report); + self::assertStringNotContainsString('PhotoResyncedException', $report); } public function testImportDuplicateWithoutResync(): void @@ -163,8 +163,8 @@ public function testImportDuplicateWithoutResync(): void copy(base_path(TestConstants::SAMPLE_FILE_NIGHT_IMAGE), static::importPath('night.jpg')); $this->photos_tests->importFromServer(static::importPath(), null, false, false); $report = $this->photos_tests->importFromServer(static::importPath(), null, false, false); - $this->assertStringNotContainsString('PhotoSkippedException', $report); - $this->assertStringNotContainsString('PhotoResyncedException', $report); + self::assertStringNotContainsString('PhotoSkippedException', $report); + self::assertStringNotContainsString('PhotoResyncedException', $report); // The original photo (which has been duplicated) should still // miss the meta-data which we removed intentionally @@ -193,27 +193,27 @@ public function testAppleLivePhotoImportViaSymlink(): void $this->photos_tests->importFromServer(static::importPath(), null, false, false, true); // check if the files are still there - $this->assertEquals(true, file_exists(static::importPath('train.jpg'))); - $this->assertEquals(true, file_exists(static::importPath('train.mov'))); + self::assertEquals(true, file_exists(static::importPath('train.jpg'))); + self::assertEquals(true, file_exists(static::importPath('train.mov'))); // get the path of the photo object $ids_after = static::getRecentPhotoIDs(); $photo_id = $ids_after->diff($ids_before)->first(); /** @var \App\Models\Photo $photo */ $photo = static::convertJsonToObject($this->photos_tests->get($photo_id)); - $this->assertEquals('E905E6C6-C747-4805-942F-9904A0281F02', $photo->live_photo_content_id); - $this->assertStringEndsWith('.mov', $photo->live_photo_url); + self::assertEquals('E905E6C6-C747-4805-942F-9904A0281F02', $photo->live_photo_content_id); + self::assertStringEndsWith('.mov', $photo->live_photo_url); /** @disregard */ - $this->assertEquals(pathinfo($photo->live_photo_url, PATHINFO_DIRNAME), pathinfo($photo->size_variants->original->url, PATHINFO_DIRNAME)); + self::assertEquals(pathinfo($photo->live_photo_url, PATHINFO_DIRNAME), pathinfo($photo->size_variants->original->url, PATHINFO_DIRNAME)); /** @disregard */ - $this->assertEquals(pathinfo($photo->live_photo_url, PATHINFO_FILENAME), pathinfo($photo->size_variants->original->url, PATHINFO_FILENAME)); + self::assertEquals(pathinfo($photo->live_photo_url, PATHINFO_FILENAME), pathinfo($photo->size_variants->original->url, PATHINFO_FILENAME)); // get the paths of the original size variant and the live photo and check whether they are truly symbolic links /** @disregard */ $symlink_path1 = public_path($this->dropUrlPrefix($photo->size_variants->original->url)); $symlink_path2 = public_path($this->dropUrlPrefix($photo->live_photo_url)); - $this->assertEquals(true, is_link($symlink_path1)); - $this->assertEquals(true, is_link($symlink_path2)); + self::assertEquals(true, is_link($symlink_path1)); + self::assertEquals(true, is_link($symlink_path2)); } public function testImportFromUrl(): void diff --git a/tests/Feature_v1/PhotosDownloadTest.php b/tests/Feature_v1/PhotosDownloadTest.php index e2037b9cead..937a00066e9 100644 --- a/tests/Feature_v1/PhotosDownloadTest.php +++ b/tests/Feature_v1/PhotosDownloadTest.php @@ -193,7 +193,7 @@ public function testPhotoDownloadWithMultiByteFilename(): void 'Photo.jpg' )); $fileContent = $download->streamedContent(); - $this->assertEquals(file_get_contents(base_path(TestConstants::SAMPLE_FILE_SUNSET_IMAGE)), $fileContent); + self::assertEquals(file_get_contents(base_path(TestConstants::SAMPLE_FILE_SUNSET_IMAGE)), $fileContent); } /** diff --git a/tests/Feature_v1/SettingsTest.php b/tests/Feature_v1/SettingsTest.php index 130b87cfa40..621845b3ae2 100644 --- a/tests/Feature_v1/SettingsTest.php +++ b/tests/Feature_v1/SettingsTest.php @@ -194,7 +194,7 @@ public function testSetCSS(): void { $this->send('/Settings::setCSS', ['css' => 'test']); $css = File::get(base_path('public/dist/user.css')); - $this->assertEquals('test', $css); + self::assertEquals('test', $css); $this->send('/Settings::setCSS', ['css' => '']); } diff --git a/tests/Feature_v1/UpdateTest.php b/tests/Feature_v1/UpdateTest.php index b54d3dc4241..703b9717750 100644 --- a/tests/Feature_v1/UpdateTest.php +++ b/tests/Feature_v1/UpdateTest.php @@ -120,7 +120,7 @@ public function testApplyMigration(): void // check that Legacy did change the username $adminUser = User::query()->findOrFail(1); - $this->assertEquals('test_login', $adminUser->username); + self::assertEquals('test_login', $adminUser->username); // clean up Auth::logout(); diff --git a/tests/Feature_v1/UsersTest.php b/tests/Feature_v1/UsersTest.php index 774919b21bc..c29f2cefe5e 100644 --- a/tests/Feature_v1/UsersTest.php +++ b/tests/Feature_v1/UsersTest.php @@ -107,7 +107,7 @@ public function testUsers(): void // 4 $content = $response->getContent(); - $this->assertNotFalse($content); + self::assertNotFalse($content); $t = json_decode($content); $id = end($t)->id; $response->assertJsonFragment([ @@ -142,7 +142,7 @@ public function testUsers(): void mayEditOwnSettings: false); $response = $users_test->list(); $content = $response->getContent(); - $this->assertNotFalse($content); + self::assertNotFalse($content); $t = json_decode($content); $id2 = end($t)->id; @@ -237,8 +237,8 @@ public function testUsers(): void expectedStatusCode: 409, assertSee: 'Username already exists'); - $this->assertEquals($user->password, Auth::user()->password); - $this->assertTrue(Hash::check('password_testing', Auth::user()->password)); + self::assertEquals($user->password, Auth::user()->password); + self::assertTrue(Hash::check('password_testing', Auth::user()->password)); // 26 $sessions_test->update_login( diff --git a/tests/Feature_v2/Album/AlbumUpdateTest.php b/tests/Feature_v2/Album/AlbumUpdateTest.php index 0295fecb79e..9ac4cf0e38b 100644 --- a/tests/Feature_v2/Album/AlbumUpdateTest.php +++ b/tests/Feature_v2/Album/AlbumUpdateTest.php @@ -145,7 +145,7 @@ public function testUpdateTagAlbumAuthorized(): void 'photos' => [], ], ]); - $this->assertCount(0, $response->json('resource.photos')); + self::assertCount(0, $response->json('resource.photos')); } public function testUpdateProtectionPolicyUnauthorizedForbidden(): void @@ -229,7 +229,7 @@ public function testUpdateProtectionPolicyAuthorized(): void // Check that album is indeed public $response = $this->getJson('Albums'); $this->assertOk($response); - $this->assertCount(0, $response->json('smart_albums')); + self::assertCount(0, $response->json('smart_albums')); $response->assertSee($this->album1->id); // Set as nsfw @@ -257,7 +257,7 @@ public function testUpdateProtectionPolicyAuthorized(): void $response = $this->getJson('Albums'); $this->assertOk($response); - $this->assertCount(0, $response->json('smart_albums')); + self::assertCount(0, $response->json('smart_albums')); $response->assertJson([ 'albums' => [ [ @@ -302,7 +302,7 @@ public function testUpdateProtectionPolicyAuthorized(): void // Check that album is indeed hidden $response = $this->getJson('Albums'); $this->assertOk($response); - $this->assertCount(0, $response->json('smart_albums')); + self::assertCount(0, $response->json('smart_albums')); $response->assertDontSee($this->album1->id); // Set with password @@ -332,7 +332,7 @@ public function testUpdateProtectionPolicyAuthorized(): void // Check that album is indeed visible but locked $response = $this->getJson('Albums'); $this->assertOk($response); - $this->assertCount(0, $response->json('smart_albums')); + self::assertCount(0, $response->json('smart_albums')); $response->assertJson([ 'albums' => [ [ diff --git a/tests/Feature_v2/Album/AlbumsTest.php b/tests/Feature_v2/Album/AlbumsTest.php index 8c6de0de757..133386abd67 100644 --- a/tests/Feature_v2/Album/AlbumsTest.php +++ b/tests/Feature_v2/Album/AlbumsTest.php @@ -26,7 +26,7 @@ public function testGetAnon(): void { $response = $this->getJson('Albums'); $this->assertOk($response); - $this->assertCount(0, $response->json('smart_albums')); + self::assertCount(0, $response->json('smart_albums')); $response->assertSee($this->album4->id); $response->assertJson([ 'smart_albums' => [], @@ -59,7 +59,7 @@ public function testGetAsUserMayUpload1(): void { $response = $this->actingAs($this->userMayUpload1)->getJson('Albums'); $this->assertOk($response); - $this->assertCount(4, $response->json('smart_albums')); + self::assertCount(4, $response->json('smart_albums')); $response->assertSee($this->album1->id); $response->assertSee($this->album4->id); $response->assertJson([ diff --git a/tests/Feature_v2/Maintenance/RegisterTest.php b/tests/Feature_v2/Maintenance/RegisterTest.php index edeaee67e50..1a44935da61 100644 --- a/tests/Feature_v2/Maintenance/RegisterTest.php +++ b/tests/Feature_v2/Maintenance/RegisterTest.php @@ -47,6 +47,6 @@ public function testAdmin(): void 'key' => 'invalid', ]); $this->assertCreated($response); - $this->assertFalse($response->json('success')); + self::assertFalse($response->json('success')); } } \ No newline at end of file diff --git a/tests/Feature_v2/PagesTest.php b/tests/Feature_v2/PagesTest.php index 9fa0cf316ec..55631536e9e 100644 --- a/tests/Feature_v2/PagesTest.php +++ b/tests/Feature_v2/PagesTest.php @@ -62,6 +62,6 @@ public function testRedirect(): void public function testVueCrash(): void { $response = $this->get('/gallery/1234567890'); - $this->assertNotFound($response); + self::assertNotFound($response); } } \ No newline at end of file diff --git a/tests/Feature_v2/Statistics/AlbumSpaceTest.php b/tests/Feature_v2/Statistics/AlbumSpaceTest.php index 6a3025c529d..25f9b0f16f7 100644 --- a/tests/Feature_v2/Statistics/AlbumSpaceTest.php +++ b/tests/Feature_v2/Statistics/AlbumSpaceTest.php @@ -36,23 +36,23 @@ public function testAlbumSpaceTestAuthorized(): void { $response = $this->withoutMiddleware(VerifySupporterStatus::class)->actingAs($this->userMayUpload1)->getJson('Statistics::albumSpace'); $this->assertOk($response); - $this->assertCount(2, $response->json()); - $this->assertEquals($this->album1->title, $response->json()[0]['title']); - $this->assertEquals($this->subAlbum1->title, $response->json()[1]['title']); + self::assertCount(2, $response->json()); + self::assertEquals($this->album1->title, $response->json()[0]['title']); + self::assertEquals($this->subAlbum1->title, $response->json()[1]['title']); $response = $this->withoutMiddleware(VerifySupporterStatus::class)->actingAs($this->userMayUpload1)->getJson('Statistics::albumSpace?album_id=' . $this->album1->id); $this->assertOk($response); - $this->assertCount(2, $response->json()); - $this->assertEquals($this->album1->title, $response->json()[0]['title']); - $this->assertEquals($this->subAlbum1->title, $response->json()[1]['title']); + self::assertCount(2, $response->json()); + self::assertEquals($this->album1->title, $response->json()[0]['title']); + self::assertEquals($this->subAlbum1->title, $response->json()[1]['title']); $response = $this->withoutMiddleware(VerifySupporterStatus::class)->actingAs($this->userMayUpload1)->getJson('Statistics::albumSpace?album_id=' . $this->subAlbum1->id); $this->assertOk($response); - $this->assertCount(1, $response->json()); - $this->assertEquals($this->subAlbum1->title, $response->json()[0]['title']); + self::assertCount(1, $response->json()); + self::assertEquals($this->subAlbum1->title, $response->json()[0]['title']); $response = $this->withoutMiddleware(VerifySupporterStatus::class)->actingAs($this->admin)->getJson('Statistics::albumSpace'); $this->assertOk($response); - $this->assertCount(7, $response->json()); + self::assertCount(7, $response->json()); } } \ No newline at end of file diff --git a/tests/Feature_v2/Statistics/SizeVariantSpaceTest.php b/tests/Feature_v2/Statistics/SizeVariantSpaceTest.php index c926ce6860a..e71149fa25b 100644 --- a/tests/Feature_v2/Statistics/SizeVariantSpaceTest.php +++ b/tests/Feature_v2/Statistics/SizeVariantSpaceTest.php @@ -37,13 +37,13 @@ public function testSizeVariantSpaceAuthorized(): void { $response = $this->withoutMiddleware(VerifySupporterStatus::class)->actingAs($this->userMayUpload1)->getJson('Statistics::sizeVariantSpace'); $this->assertOk($response); - $this->assertCount(7, $response->json()); - $this->assertEquals(SizeVariantType::ORIGINAL->value, $response->json()[0]['type']); - $this->assertEquals(SizeVariantType::MEDIUM2X->value, $response->json()[1]['type']); - $this->assertEquals(SizeVariantType::MEDIUM->value, $response->json()[2]['type']); - $this->assertEquals(SizeVariantType::SMALL2X->value, $response->json()[3]['type']); - $this->assertEquals(SizeVariantType::SMALL->value, $response->json()[4]['type']); - $this->assertEquals(SizeVariantType::THUMB2X->value, $response->json()[5]['type']); - $this->assertEquals(SizeVariantType::THUMB->value, $response->json()[6]['type']); + self::assertCount(7, $response->json()); + self::assertEquals(SizeVariantType::ORIGINAL->value, $response->json()[0]['type']); + self::assertEquals(SizeVariantType::MEDIUM2X->value, $response->json()[1]['type']); + self::assertEquals(SizeVariantType::MEDIUM->value, $response->json()[2]['type']); + self::assertEquals(SizeVariantType::SMALL2X->value, $response->json()[3]['type']); + self::assertEquals(SizeVariantType::SMALL->value, $response->json()[4]['type']); + self::assertEquals(SizeVariantType::THUMB2X->value, $response->json()[5]['type']); + self::assertEquals(SizeVariantType::THUMB->value, $response->json()[6]['type']); } } \ No newline at end of file diff --git a/tests/Feature_v2/Statistics/TotalAlbumSpaceTest.php b/tests/Feature_v2/Statistics/TotalAlbumSpaceTest.php index 5184295bf9f..5118c142407 100644 --- a/tests/Feature_v2/Statistics/TotalAlbumSpaceTest.php +++ b/tests/Feature_v2/Statistics/TotalAlbumSpaceTest.php @@ -36,17 +36,17 @@ public function testTotalAlbumSpaceTestAuthorized(): void { $response = $this->withoutMiddleware(VerifySupporterStatus::class)->actingAs($this->userMayUpload1)->getJson('Statistics::totalAlbumSpace'); $this->assertOk($response); - $this->assertCount(2, $response->json()); - $this->assertEquals($this->album1->title, $response->json()[0]['title']); - $this->assertEquals($this->subAlbum1->title, $response->json()[1]['title']); + self::assertCount(2, $response->json()); + self::assertEquals($this->album1->title, $response->json()[0]['title']); + self::assertEquals($this->subAlbum1->title, $response->json()[1]['title']); $response = $this->withoutMiddleware(VerifySupporterStatus::class)->actingAs($this->userMayUpload1)->getJson('Statistics::totalAlbumSpace?album_id=' . $this->album1->id); $this->assertOk($response); - $this->assertCount(1, $response->json()); - $this->assertEquals($this->album1->title, $response->json()[0]['title']); + self::assertCount(1, $response->json()); + self::assertEquals($this->album1->title, $response->json()[0]['title']); $response = $this->withoutMiddleware(VerifySupporterStatus::class)->actingAs($this->admin)->getJson('Statistics::totalAlbumSpace'); $this->assertOk($response); - $this->assertCount(7, $response->json()); + self::assertCount(7, $response->json()); } } \ No newline at end of file diff --git a/tests/Feature_v2/Statistics/UserSpaceTest.php b/tests/Feature_v2/Statistics/UserSpaceTest.php index ebb79453aca..4e4f4fbee0a 100644 --- a/tests/Feature_v2/Statistics/UserSpaceTest.php +++ b/tests/Feature_v2/Statistics/UserSpaceTest.php @@ -36,8 +36,8 @@ public function testUserSpaceAuthorized(): void { $response = $this->withoutMiddleware(VerifySupporterStatus::class)->actingAs($this->userMayUpload1)->getJson('Statistics::userSpace'); $this->assertOk($response); - $this->assertCount(1, $response->json()); - $this->assertEquals($this->userMayUpload1->username(), $response->json()[0]['username']); + self::assertCount(1, $response->json()); + self::assertEquals($this->userMayUpload1->username(), $response->json()[0]['username']); } public function testUserSpaceAdmin(): void @@ -45,6 +45,6 @@ public function testUserSpaceAdmin(): void $response = $this->withoutMiddleware(VerifySupporterStatus::class)->actingAs($this->admin)->getJson('Statistics::userSpace'); $this->assertOk($response); // We have 5 registered users during the tests. - $this->assertCount(5, $response->json()); + self::assertCount(5, $response->json()); } } \ No newline at end of file diff --git a/tests/Feature_v2/UserManagement/DeleteUserTest.php b/tests/Feature_v2/UserManagement/DeleteUserTest.php index b842d93a244..41473bf7583 100644 --- a/tests/Feature_v2/UserManagement/DeleteUserTest.php +++ b/tests/Feature_v2/UserManagement/DeleteUserTest.php @@ -46,7 +46,7 @@ public function testDeleteUserAdmin(): void 'id' => $this->userNoUpload->id, ]); $this->assertNoContent($response); - $this->assertEquals($num_users - 1, User::count()); + self::assertEquals($num_users - 1, User::count()); $response = $this->actingAs($this->admin)->getJson('UserManagement'); $this->assertOk($response); diff --git a/tests/Feature_v2/WebAuthTest.php b/tests/Feature_v2/WebAuthTest.php index bd8ee714aec..813056c780e 100644 --- a/tests/Feature_v2/WebAuthTest.php +++ b/tests/Feature_v2/WebAuthTest.php @@ -421,7 +421,7 @@ public function testWebAuthEditDeleteAutorized(): void $responseList = $this->getJson('WebAuthn'); $this->assertOk($responseList); - $this->assertEquals('something', $responseList->json()[0]['alias']); + self::assertEquals('something', $responseList->json()[0]['alias']); $responseDelete = $this->deleteJson('WebAuthn', ['id' => '_Xlz-khgFhDdkvOWyy_YqC54ExkYyp1o6HAQiybqLST-9RGBndpgI06TQygIYI7ZL2dayCMYm6J1-bXyl72obA']); $this->assertNoContent($responseDelete); diff --git a/tests/Unit/FeaturesUnitTest.php b/tests/Unit/FeaturesUnitTest.php index 645ed3f4e4b..b0887f563e6 100644 --- a/tests/Unit/FeaturesUnitTest.php +++ b/tests/Unit/FeaturesUnitTest.php @@ -26,31 +26,31 @@ class FeaturesUnitTest extends AbstractTestCase { public function testAllAreActive(): void { - $this->assertFalse(Features::allAreActive(['use-s3'])); - $this->assertTrue(Features::allAreActive(['vuejs'])); + self::assertFalse(Features::allAreActive(['use-s3'])); + self::assertTrue(Features::allAreActive(['vuejs'])); } public function testSomeAreActive(): void { - $this->assertFalse(Features::someAreActive(['use-s3'])); - $this->assertTrue(Features::someAreActive(['vuejs', 'use-s3'])); + self::assertFalse(Features::someAreActive(['use-s3'])); + self::assertTrue(Features::someAreActive(['vuejs', 'use-s3'])); } public function testAllAreInactive(): void { - $this->assertTrue(Features::allAreInactive(['use-s3'])); - $this->assertFalse(Features::allAreInactive(['vuejs'])); + self::assertTrue(Features::allAreInactive(['use-s3'])); + self::assertFalse(Features::allAreInactive(['vuejs'])); } public function testSomeAreInactive(): void { - $this->assertFalse(Features::someAreInactive(['vuejs'])); - $this->assertTrue(Features::someAreInactive(['vuejs', 'use-s3'])); + self::assertFalse(Features::someAreInactive(['vuejs'])); + self::assertTrue(Features::someAreInactive(['vuejs', 'use-s3'])); } public function testWhenArray(): void { - $this->assertTrue(Features::when(['vuejs'], fn () => true, fn () => false)); + self::assertTrue(Features::when(['vuejs'], fn () => true, fn () => false)); } public function testThrow(): void diff --git a/tests/Unit/GitRemoteTest.php b/tests/Unit/GitRemoteTest.php index cb5a3c36887..b3a1d14a566 100644 --- a/tests/Unit/GitRemoteTest.php +++ b/tests/Unit/GitRemoteTest.php @@ -35,15 +35,15 @@ public function testCommits(): void $data = json_decode(File::get(base_path('tests/Samples/commits.json'))); $countBehind = $remote->countBehind($data, 'fail'); - $this->assertEquals(30, $countBehind); + self::assertEquals(30, $countBehind); $countBehind = $remote->countBehind([], 'fail'); - $this->assertFalse($countBehind); + self::assertFalse($countBehind); $countBehind = $remote->countBehind($data, 'f3854cf'); - $this->assertEquals(1, $countBehind); + self::assertEquals(1, $countBehind); - $this->assertEquals('commits', $remote->getType()); + self::assertEquals('commits', $remote->getType()); } public function testTags(): void @@ -55,21 +55,21 @@ public function testTags(): void $data = json_decode(File::get(base_path('tests/Samples/tags.json'))); $countBehind = $remote->countBehind($data, 'fail'); - $this->assertEquals(30, $countBehind); + self::assertEquals(30, $countBehind); $countBehind = $remote->countBehind($data, '1144961'); - $this->assertEquals(4, $countBehind); + self::assertEquals(4, $countBehind); // This test will fail in the future when v4.6.2 is further than 30 versions away. $countBehind = $remote->countBehind($data, '296db84'); - $this->assertNotEquals(30, $countBehind); + self::assertNotEquals(30, $countBehind); $tagName = $remote->getTagName($data, '296db84'); - $this->assertEquals('v4.6.2', $tagName); + self::assertEquals('v4.6.2', $tagName); $tagName = $remote->getTagName([], 'fail'); - $this->assertEquals('', $tagName); + self::assertEquals('', $tagName); - $this->assertEquals('tags', $remote->getType()); + self::assertEquals('tags', $remote->getType()); } } \ No newline at end of file diff --git a/tests/Unit/Middleware/LoginRequiredTest.php b/tests/Unit/Middleware/LoginRequiredTest.php index 4e3e51638db..d2dcfff103b 100644 --- a/tests/Unit/Middleware/LoginRequiredTest.php +++ b/tests/Unit/Middleware/LoginRequiredTest.php @@ -46,7 +46,7 @@ public function testExceptionLoginNotRequired(): void Configs::invalidateCache(); $request = $this->mock(Request::class); $middleware = new LoginRequired(); - $this->assertEquals(1, $middleware->handle($request, fn () => 1, 'album')); + self::assertEquals(1, $middleware->handle($request, fn () => 1, 'album')); } public function testExceptionWrongParam(): void diff --git a/tests/Unit/Middleware/MigrationStatusTest.php b/tests/Unit/Middleware/MigrationStatusTest.php index f348843c045..b88d965153f 100644 --- a/tests/Unit/Middleware/MigrationStatusTest.php +++ b/tests/Unit/Middleware/MigrationStatusTest.php @@ -59,7 +59,7 @@ public function testExceptionMigrationIncomplete(): void $request = $this->mock(Request::class); $middleware = new MigrationStatus($mock); - $this->assertEquals(1, $middleware->handle($request, fn () => 1, 'incomplete'), MigrationAlreadyCompletedException::class); + self::assertEquals(1, $middleware->handle($request, fn () => 1, 'incomplete'), MigrationAlreadyCompletedException::class); } public function testExceptionWrongParam(): void diff --git a/tests/Unit/Redirections/ToAdminSetterTest.php b/tests/Unit/Redirections/ToAdminSetterTest.php index 4640129d6c1..001c080a14d 100644 --- a/tests/Unit/Redirections/ToAdminSetterTest.php +++ b/tests/Unit/Redirections/ToAdminSetterTest.php @@ -26,6 +26,6 @@ class ToAdminSetterTest extends AbstractTestCase public function testRedirection(): void { $response = ToAdminSetter::go(); - $this->assertEquals(307, $response->getStatusCode()); + self::assertEquals(307, $response->getStatusCode()); } } \ No newline at end of file diff --git a/tests/Unit/Redirections/ToHomeTest.php b/tests/Unit/Redirections/ToHomeTest.php index 096289d2d48..6cca1f98367 100644 --- a/tests/Unit/Redirections/ToHomeTest.php +++ b/tests/Unit/Redirections/ToHomeTest.php @@ -26,7 +26,7 @@ class ToHomeTest extends AbstractTestCase public function testRedirection(): void { $response = ToHome::go(); - $this->assertEquals(307, $response->getStatusCode()); - $this->assertEquals(route('home'), $response->headers->get('Location')); + self::assertEquals(307, $response->getStatusCode()); + self::assertEquals(route('home'), $response->headers->get('Location')); } } \ No newline at end of file diff --git a/tests/Unit/Redirections/ToMigrationTest.php b/tests/Unit/Redirections/ToMigrationTest.php index 49e81451e27..23c53e72b41 100644 --- a/tests/Unit/Redirections/ToMigrationTest.php +++ b/tests/Unit/Redirections/ToMigrationTest.php @@ -26,7 +26,7 @@ class ToMigrationTest extends AbstractTestCase public function testRedirection(): void { $response = ToMigration::go(); - $this->assertEquals(307, $response->getStatusCode()); - $this->assertEquals(route('migrate'), $response->headers->get('Location')); + self::assertEquals(307, $response->getStatusCode()); + self::assertEquals(route('migrate'), $response->headers->get('Location')); } } \ No newline at end of file diff --git a/tests/Unit/VersionDTOUnitTest.php b/tests/Unit/VersionDTOUnitTest.php index 566570ce9c2..ba2b59764e4 100644 --- a/tests/Unit/VersionDTOUnitTest.php +++ b/tests/Unit/VersionDTOUnitTest.php @@ -54,8 +54,8 @@ public function testInvalidVersionString(): void public function testValidVersionString(): void { $version = Version::createFromString('40306'); - $this->assertEquals(4, $version->major); - $this->assertEquals(3, $version->minor); - $this->assertEquals(6, $version->patch); + self::assertEquals(4, $version->major); + self::assertEquals(3, $version->minor); + self::assertEquals(6, $version->patch); } } \ No newline at end of file