diff --git a/tests/Broadcasting/BroadcasterTest.php b/tests/Broadcasting/BroadcasterTest.php index 2e1bbe3625e2..38ac5a9d46e8 100644 --- a/tests/Broadcasting/BroadcasterTest.php +++ b/tests/Broadcasting/BroadcasterTest.php @@ -53,13 +53,13 @@ public function testExtractingParametersWhileCheckingForUserAccess() // }; $parameters = $this->broadcaster->extractAuthParameters('asd', 'asd', $callback); - $this->assertEquals([], $parameters); + $this->assertSame([], $parameters); $callback = function ($user, $something) { // }; $parameters = $this->broadcaster->extractAuthParameters('asd', 'asd', $callback); - $this->assertEquals([], $parameters); + $this->assertSame([], $parameters); // Test Explicit Binding... $container = new Container; diff --git a/tests/Cache/CacheManagerTest.php b/tests/Cache/CacheManagerTest.php index a4f0eca03693..0a1319b0daf2 100644 --- a/tests/Cache/CacheManagerTest.php +++ b/tests/Cache/CacheManagerTest.php @@ -190,7 +190,7 @@ public function testItSetsDefaultDriverChangesGlobalConfig() $cacheManager->setDefaultDriver('><((((@>'); - $this->assertEquals('><((((@>', $app->get('config')->get('cache.default')); + $this->assertSame('><((((@>', $app->get('config')->get('cache.default')); } public function testItPurgesMemoizedStoreObjects() diff --git a/tests/Cache/CacheSessionStoreTest.php b/tests/Cache/CacheSessionStoreTest.php index 89f1c230bc68..02dda73f6d6c 100755 --- a/tests/Cache/CacheSessionStoreTest.php +++ b/tests/Cache/CacheSessionStoreTest.php @@ -207,7 +207,7 @@ public function testCacheKey() public function testItemKey() { $store = new SessionStore(self::getSession(), 'custom_prefix'); - $this->assertEquals('custom_prefix.foo', $store->itemKey('foo')); + $this->assertSame('custom_prefix.foo', $store->itemKey('foo')); } public function testValuesAreStoredByReference() diff --git a/tests/Console/CacheCommandMutexTest.php b/tests/Console/CacheCommandMutexTest.php index 9654ee28033c..3675faaaff2f 100644 --- a/tests/Console/CacheCommandMutexTest.php +++ b/tests/Console/CacheCommandMutexTest.php @@ -166,7 +166,7 @@ public function testCommandMutexNameWithoutIsolatedMutexNameMethod() $this->cacheRepository->shouldReceive('add') ->once() ->withArgs(function ($key) { - $this->assertEquals('framework'.DIRECTORY_SEPARATOR.'command-command-name', $key); + $this->assertSame('framework'.DIRECTORY_SEPARATOR.'command-command-name', $key); return true; }) @@ -196,7 +196,7 @@ public function isolatableId() $this->cacheRepository->shouldReceive('add') ->once() ->withArgs(function ($key) { - $this->assertEquals('framework'.DIRECTORY_SEPARATOR.'command-command-name-isolated', $key); + $this->assertSame('framework'.DIRECTORY_SEPARATOR.'command-command-name-isolated', $key); return true; }) diff --git a/tests/Container/AfterResolvingAttributeCallbackTest.php b/tests/Container/AfterResolvingAttributeCallbackTest.php index ea3aa4744413..91e4f681b2ab 100644 --- a/tests/Container/AfterResolvingAttributeCallbackTest.php +++ b/tests/Container/AfterResolvingAttributeCallbackTest.php @@ -55,7 +55,7 @@ public function testCallbackIsCalledAfterClassWithConstructorAndAttributeIsResol $instance = $container->make(ContainerTestHasSelfConfiguringAttributeAndConstructor::class); $this->assertInstanceOf(ContainerTestHasSelfConfiguringAttributeAndConstructor::class, $instance); - $this->assertEquals('the-right-value', $instance->value); + $this->assertSame('the-right-value', $instance->value); } public function testCallbackIsCalledOnAppCall() diff --git a/tests/Container/ContainerCallTest.php b/tests/Container/ContainerCallTest.php index 74460d99a087..80c5f83b9900 100644 --- a/tests/Container/ContainerCallTest.php +++ b/tests/Container/ContainerCallTest.php @@ -129,7 +129,7 @@ public function testCallWithDependencies() }); $this->assertInstanceOf(stdClass::class, $result[0]); - $this->assertEquals([], $result[1]); + $this->assertSame([], $result[1]); $result = $container->call(function (stdClass $foo, $bar = []) { return func_get_args(); diff --git a/tests/Container/ContainerTest.php b/tests/Container/ContainerTest.php index 25f0ab464e0a..36f1cc03a440 100755 --- a/tests/Container/ContainerTest.php +++ b/tests/Container/ContainerTest.php @@ -661,7 +661,7 @@ public function testNestedParametersAreResetForFreshMake() return $config; }); - $this->assertEquals([], $container->make('foo', ['something'])); + $this->assertSame([], $container->make('foo', ['something'])); } public function testSingletonBindingsNotRespectedWithMakeParameters() @@ -920,7 +920,7 @@ public function testWithFactoryHasDependency() $this->assertInstanceOf(RequestDto::class, $r); $this->assertEquals(999, $r->userId); - $this->assertEquals('taylor@laravel.com', $r->email); + $this->assertSame('taylor@laravel.com', $r->email); } // public function testContainerCanCatchCircularDependency() @@ -1118,9 +1118,7 @@ class WildcardConcrete implements WildcardOnlyInterface { } -/* - * The order of these attributes matters because we want to ensure we only fallback to '*' when there's no more specific environment. - */ +// The order of these attributes matters because we want to ensure we only fallback to '*' when there's no more specific environment. #[Bind(FallbackConcrete::class)] #[Bind(ProdConcrete::class, environments: 'prod')] interface WildcardAndProdInterface diff --git a/tests/Container/ContextualAttributeBindingTest.php b/tests/Container/ContextualAttributeBindingTest.php index 78e321033f85..041f1087698e 100644 --- a/tests/Container/ContextualAttributeBindingTest.php +++ b/tests/Container/ContextualAttributeBindingTest.php @@ -100,7 +100,7 @@ public function testScalarDependencyCanBeResolvedFromAttributeBinding() $class = $container->make(ContainerTestHasConfigValueProperty::class); $this->assertInstanceOf(ContainerTestHasConfigValueProperty::class, $class); - $this->assertEquals('Europe/Paris', $class->timezone); + $this->assertSame('Europe/Paris', $class->timezone); } public function testScalarDependencyCanBeResolvedFromAttributeResolveMethod() @@ -115,7 +115,7 @@ public function testScalarDependencyCanBeResolvedFromAttributeResolveMethod() $class = $container->make(ContainerTestHasConfigValueWithResolveProperty::class); $this->assertInstanceOf(ContainerTestHasConfigValueWithResolveProperty::class, $class); - $this->assertEquals('production', $class->env); + $this->assertSame('production', $class->env); } public function testDependencyWithAfterCallbackAttributeCanBeResolved() @@ -124,7 +124,7 @@ public function testDependencyWithAfterCallbackAttributeCanBeResolved() $class = $container->make(ContainerTestHasConfigValueWithResolvePropertyAndAfterCallback::class); - $this->assertEquals('Developer', $class->person->role); + $this->assertSame('Developer', $class->person->role); } public function testAuthedAttribute() @@ -289,7 +289,7 @@ public function testInjectionWithAttributeOnAppCall() return $hasAttribute->person; }); - $this->assertEquals('Taylor', $person->name); + $this->assertSame('Taylor', $person->name); } public function testAttributeOnAppCall() @@ -306,7 +306,7 @@ public function testAttributeOnAppCall() return $value; }); - $this->assertEquals('Europe/Paris', $value); + $this->assertSame('Europe/Paris', $value); $value = $container->call(function (#[Config('app.locale')] ?string $value) { return $value; @@ -329,7 +329,7 @@ public function testNestedAttributeOnAppCall() return $object; }); - $this->assertEquals('Europe/Paris', $value->timezone); + $this->assertSame('Europe/Paris', $value->timezone); $value = $container->call(function (LocaleObject $object) { return $object; diff --git a/tests/Container/UtilTest.php b/tests/Container/UtilTest.php index 928e07ad8841..cd5cbf56b53a 100644 --- a/tests/Container/UtilTest.php +++ b/tests/Container/UtilTest.php @@ -26,7 +26,7 @@ public function testArrayWrap() $this->assertEquals(['a'], Util::arrayWrap($string)); $this->assertEquals($array, Util::arrayWrap($array)); $this->assertEquals([$object], Util::arrayWrap($object)); - $this->assertEquals([], Util::arrayWrap(null)); + $this->assertSame([], Util::arrayWrap(null)); $this->assertEquals([null], Util::arrayWrap([null])); $this->assertEquals([null, null], Util::arrayWrap([null, null])); $this->assertEquals([''], Util::arrayWrap('')); diff --git a/tests/Cookie/CookieTest.php b/tests/Cookie/CookieTest.php index ee68be316c18..519e85b091d0 100755 --- a/tests/Cookie/CookieTest.php +++ b/tests/Cookie/CookieTest.php @@ -82,7 +82,7 @@ public function testQueuedCookiesWithHandlingEmptyValues(): void $cookie = $this->getCreator(); $cookie->queue($cookie->make('foo', '')); $this->assertTrue($cookie->hasQueued('foo')); - $this->assertEquals('', $cookie->queued('foo')->getValue()); + $this->assertSame('', $cookie->queued('foo')->getValue()); } public function testQueuedCookiesWithRepeatedValue(): void @@ -90,7 +90,7 @@ public function testQueuedCookiesWithRepeatedValue(): void $cookie = $this->getCreator(); $cookie->queue($cookie->make('foo', 'newBar')); $this->assertTrue($cookie->hasQueued('foo')); - $this->assertEquals('newBar', $cookie->queued('foo')->getValue()); + $this->assertSame('newBar', $cookie->queued('foo')->getValue()); $this->expectException(ArgumentCountError::class); $cookie->queue('invalidCookie'); diff --git a/tests/Database/DatabaseConcernsHasAttributesTest.php b/tests/Database/DatabaseConcernsHasAttributesTest.php index ac931b034a26..3bf1b62d3de7 100644 --- a/tests/Database/DatabaseConcernsHasAttributesTest.php +++ b/tests/Database/DatabaseConcernsHasAttributesTest.php @@ -54,7 +54,7 @@ public function testCastingEmptyStringToArrayDoesNotError() public function testUnsettingCachedAttribute() { $instance = new HasCacheableAttributeWithAccessor(); - $this->assertEquals('foo', $instance->getAttribute('cacheableProperty')); + $this->assertSame('foo', $instance->getAttribute('cacheableProperty')); $this->assertTrue($instance->cachedAttributeIsset('cacheableProperty')); unset($instance->cacheableProperty); diff --git a/tests/Database/DatabaseConcernsPreventsCircularRecursionTest.php b/tests/Database/DatabaseConcernsPreventsCircularRecursionTest.php index 4a49b08afbdf..359cd6d1a497 100644 --- a/tests/Database/DatabaseConcernsPreventsCircularRecursionTest.php +++ b/tests/Database/DatabaseConcernsPreventsCircularRecursionTest.php @@ -183,7 +183,7 @@ public function testMockedModelCallToWithoutRecursionMethodWorks(): void fn () => array_merge($mock->attributesToArray(), $mock->relationsToArray()), fn () => $mock->attributesToArray(), ); - $this->assertEquals([], $toArray); + $this->assertSame([], $toArray); } } diff --git a/tests/Database/DatabaseConnectionTest.php b/tests/Database/DatabaseConnectionTest.php index b13f3011fa6d..f91806bc6a65 100755 --- a/tests/Database/DatabaseConnectionTest.php +++ b/tests/Database/DatabaseConnectionTest.php @@ -552,8 +552,8 @@ public function testGetRawQueryLog() $log = $mock->getRawQueryLog(); - $this->assertEquals("select * from tbl where col = 'foo'", $log[0]['raw_query']); - $this->assertEquals(1.23, $log[0]['time']); + $this->assertSame("select * from tbl where col = 'foo'", $log[0]['raw_query']); + $this->assertSame(1.23, $log[0]['time']); } public function testQueryExceptionContainsReadConnectionDetailsWhenUsingReadPdo() diff --git a/tests/Database/DatabaseEloquentBuilderCreateOrFirstTest.php b/tests/Database/DatabaseEloquentBuilderCreateOrFirstTest.php index b061a5f3bca9..2b5a4177bb52 100755 --- a/tests/Database/DatabaseEloquentBuilderCreateOrFirstTest.php +++ b/tests/Database/DatabaseEloquentBuilderCreateOrFirstTest.php @@ -530,7 +530,7 @@ public function testUpdateOrCreateMethodAcceptsClosureValuesAndUpdates(): void $result = $model->newQuery()->updateOrCreate(['attr' => 'foo'], fn () => ['val' => 'baz']); $this->assertFalse($result->wasRecentlyCreated); - $this->assertEquals('baz', $result->val); + $this->assertSame('baz', $result->val); } public function testUpdateOrCreateInvokesClosureExactlyOnceWhenCreating(): void diff --git a/tests/Database/DatabaseEloquentBuilderTest.php b/tests/Database/DatabaseEloquentBuilderTest.php index 8b1709c0bd24..55f10f8bf0ba 100755 --- a/tests/Database/DatabaseEloquentBuilderTest.php +++ b/tests/Database/DatabaseEloquentBuilderTest.php @@ -336,7 +336,7 @@ public function testGetMethodDoesntHydrateEagerRelationsWhenNoResultsAreReturned $builder->getModel()->shouldReceive('newCollection')->with([])->andReturn(new Collection([])); $results = $builder->get(['foo']); - $this->assertEquals([], $results->all()); + $this->assertSame([], $results->all()); } public function testValueMethodWithModelFound() @@ -1107,7 +1107,7 @@ public function testSimpleWhereNot() $model = new EloquentBuilderTestStub(); $this->mockConnectionForModel($model, 'SQLite'); $query = $model->newQuery()->whereNot('name', 'foo')->whereNot('name', '<>', 'bar'); - $this->assertEquals('select * from "table" where not "name" = ? and not "name" <> ?', $query->toSql()); + $this->assertSame('select * from "table" where not "name" = ? and not "name" <> ?', $query->toSql()); $this->assertEquals(['foo', 'bar'], $query->getBindings()); } @@ -1137,7 +1137,7 @@ public function testSimpleOrWhereNot() $model = new EloquentBuilderTestStub(); $this->mockConnectionForModel($model, 'SQLite'); $query = $model->newQuery()->orWhereNot('name', 'foo')->orWhereNot('name', '<>', 'bar'); - $this->assertEquals('select * from "table" where not "name" = ? or not "name" <> ?', $query->toSql()); + $this->assertSame('select * from "table" where not "name" = ? or not "name" <> ?', $query->toSql()); $this->assertEquals(['foo', 'bar'], $query->getBindings()); } diff --git a/tests/Database/DatabaseEloquentCollectionTest.php b/tests/Database/DatabaseEloquentCollectionTest.php index cbc9ddc99dc1..5d5e526d3364 100755 --- a/tests/Database/DatabaseEloquentCollectionTest.php +++ b/tests/Database/DatabaseEloquentCollectionTest.php @@ -439,7 +439,7 @@ public function testCollectionIntersectWithNull() $c1 = new Collection([$one, $two, $three]); - $this->assertEquals([], $c1->intersect(null)->all()); + $this->assertSame([], $c1->intersect(null)->all()); } public function testCollectionIntersectsWithGivenCollection() @@ -543,7 +543,7 @@ public function testMakeVisibleRemovesHiddenFromEntireCollection() $c = new Collection([new TestEloquentCollectionModel]); $c = $c->makeVisible(['hidden']); - $this->assertEquals([], $c[0]->getHidden()); + $this->assertSame([], $c[0]->getHidden()); } public function testMergeHiddenAddsHiddenOnEntireCollection() @@ -602,7 +602,7 @@ public function testWithoutAppendsRemovesAppendsOnEntireCollection() { $this->seedData(); $c = EloquentAppendingTestUserModel::query()->get(); - $this->assertEquals('hello', $c->toArray()[0]['appended_field']); + $this->assertSame('hello', $c->toArray()[0]['appended_field']); $c = $c->withoutAppends(); $this->assertArrayNotHasKey('appended_field', $c->toArray()[0]); @@ -628,7 +628,7 @@ public function testMakeVisibleRemovesHiddenAndIncludesVisible() $c = new Collection([new TestEloquentCollectionModel]); $c = $c->makeVisible('hidden'); - $this->assertEquals([], $c[0]->getHidden()); + $this->assertSame([], $c[0]->getHidden()); $this->assertEquals(['visible', 'hidden'], $c[0]->getVisible()); } @@ -639,8 +639,8 @@ public function testMultiply() $c = new Collection([$a, $b]); - $this->assertEquals([], $c->multiply(-1)->all()); - $this->assertEquals([], $c->multiply(0)->all()); + $this->assertSame([], $c->multiply(-1)->all()); + $this->assertSame([], $c->multiply(0)->all()); $this->assertEquals([$a, $b], $c->multiply(1)->all()); @@ -704,7 +704,7 @@ public function getQueueableRelations() }, ]); - $this->assertEquals([], $c->getQueueableRelations()); + $this->assertSame([], $c->getQueueableRelations()); } public function testEmptyCollectionStayEmptyOnFresh() diff --git a/tests/Database/DatabaseEloquentFactoryTest.php b/tests/Database/DatabaseEloquentFactoryTest.php index d987b8faa813..d1bc9bd7f45f 100644 --- a/tests/Database/DatabaseEloquentFactoryTest.php +++ b/tests/Database/DatabaseEloquentFactoryTest.php @@ -185,7 +185,7 @@ public function test_expanded_closure_attribute_returning_a_factory_is_resolved( ]), ]); - $this->assertEquals('post-options', $post->user->options); + $this->assertSame('post-options', $post->user->options); } public function test_make_creates_unpersisted_model_instance() @@ -1031,56 +1031,56 @@ public function test_factory_model_has_many_relationship_has_pending_attributes( { FactoryTestUser::factory()->has(new FactoryTestPostFactory(), 'postsWithFooBarBazAsTitle')->create(); - $this->assertEquals('foo bar baz', FactoryTestPost::first()->title); + $this->assertSame('foo bar baz', FactoryTestPost::first()->title); } public function test_factory_model_has_many_relationship_has_pending_attributes_override() { FactoryTestUser::factory()->has((new FactoryTestPostFactory())->state(['title' => 'other title']), 'postsWithFooBarBazAsTitle')->create(); - $this->assertEquals('other title', FactoryTestPost::first()->title); + $this->assertSame('other title', FactoryTestPost::first()->title); } public function test_factory_model_has_one_relationship_has_pending_attributes() { FactoryTestUser::factory()->has(new FactoryTestPostFactory(), 'postWithFooBarBazAsTitle')->create(); - $this->assertEquals('foo bar baz', FactoryTestPost::first()->title); + $this->assertSame('foo bar baz', FactoryTestPost::first()->title); } public function test_factory_model_has_one_relationship_has_pending_attributes_override() { FactoryTestUser::factory()->has((new FactoryTestPostFactory())->state(['title' => 'other title']), 'postWithFooBarBazAsTitle')->create(); - $this->assertEquals('other title', FactoryTestPost::first()->title); + $this->assertSame('other title', FactoryTestPost::first()->title); } public function test_factory_model_belongs_to_many_relationship_has_pending_attributes() { FactoryTestUser::factory()->has(new FactoryTestRoleFactory(), 'rolesWithFooBarBazAsName')->create(); - $this->assertEquals('foo bar baz', FactoryTestRole::first()->name); + $this->assertSame('foo bar baz', FactoryTestRole::first()->name); } public function test_factory_model_belongs_to_many_relationship_has_pending_attributes_override() { FactoryTestUser::factory()->has((new FactoryTestRoleFactory())->state(['name' => 'other name']), 'rolesWithFooBarBazAsName')->create(); - $this->assertEquals('other name', FactoryTestRole::first()->name); + $this->assertSame('other name', FactoryTestRole::first()->name); } public function test_factory_model_morph_many_relationship_has_pending_attributes() { (new FactoryTestPostFactory())->has(new FactoryTestCommentFactory(), 'commentsWithFooBarBazAsBody')->create(); - $this->assertEquals('foo bar baz', FactoryTestComment::first()->body); + $this->assertSame('foo bar baz', FactoryTestComment::first()->body); } public function test_factory_model_morph_many_relationship_has_pending_attributes_override() { (new FactoryTestPostFactory())->has((new FactoryTestCommentFactory())->state(['body' => 'other body']), 'commentsWithFooBarBazAsBody')->create(); - $this->assertEquals('other body', FactoryTestComment::first()->body); + $this->assertSame('other body', FactoryTestComment::first()->body); } public function test_factory_can_insert() @@ -1107,9 +1107,9 @@ public function test_factory_can_insert_with_hidden() { (new FactoryTestUserFactory())->forEachSequence(['name' => Name::Taylor, 'options' => 'abc'])->insert(); $user = DB::table('users')->sole(); - $this->assertEquals('abc', $user->options); + $this->assertSame('abc', $user->options); $userModel = FactoryTestUser::query()->sole(); - $this->assertEquals('abc', $userModel->options); + $this->assertSame('abc', $userModel->options); } public function test_factory_can_insert_with_array_casts() diff --git a/tests/Database/DatabaseEloquentGlobalScopesTest.php b/tests/Database/DatabaseEloquentGlobalScopesTest.php index 62954c20b3da..fe4719cf071b 100644 --- a/tests/Database/DatabaseEloquentGlobalScopesTest.php +++ b/tests/Database/DatabaseEloquentGlobalScopesTest.php @@ -41,7 +41,7 @@ public function testGlobalScopeCanBeRemoved() $model = new EloquentGlobalScopesTestModel; $query = $model->newQuery()->withoutGlobalScope(ActiveScope::class); $this->assertSame('select * from "table"', $query->toSql()); - $this->assertEquals([], $query->getBindings()); + $this->assertSame([], $query->getBindings()); } public function testClassNameGlobalScopeIsApplied() @@ -97,7 +97,7 @@ public function testClosureGlobalScopeCanBeRemoved() $model = new EloquentClosureGlobalScopesTestModel; $query = $model->newQuery()->withoutGlobalScope('active_scope'); $this->assertSame('select * from "table" order by "name" asc', $query->toSql()); - $this->assertEquals([], $query->getBindings()); + $this->assertSame([], $query->getBindings()); } public function testGlobalScopeCanBeRemovedAfterTheQueryIsExecuted() @@ -109,7 +109,7 @@ public function testGlobalScopeCanBeRemovedAfterTheQueryIsExecuted() $query->withoutGlobalScope('active_scope'); $this->assertSame('select * from "table" order by "name" asc', $query->toSql()); - $this->assertEquals([], $query->getBindings()); + $this->assertSame([], $query->getBindings()); } public function testAllGlobalScopesCanBeRemoved() @@ -117,11 +117,11 @@ public function testAllGlobalScopesCanBeRemoved() $model = new EloquentClosureGlobalScopesTestModel; $query = $model->newQuery()->withoutGlobalScopes(); $this->assertSame('select * from "table"', $query->toSql()); - $this->assertEquals([], $query->getBindings()); + $this->assertSame([], $query->getBindings()); $query = EloquentClosureGlobalScopesTestModel::withoutGlobalScopes(); $this->assertSame('select * from "table"', $query->toSql()); - $this->assertEquals([], $query->getBindings()); + $this->assertSame([], $query->getBindings()); } public function testAllGlobalScopesCanBeRemovedExceptSpecified() diff --git a/tests/Database/DatabaseEloquentIntegrationTest.php b/tests/Database/DatabaseEloquentIntegrationTest.php index 5560e2fa2db9..ab1c809914c3 100644 --- a/tests/Database/DatabaseEloquentIntegrationTest.php +++ b/tests/Database/DatabaseEloquentIntegrationTest.php @@ -2588,7 +2588,7 @@ public function testCanFillAndInsert() $this->assertNull($users[0]->birthday); $this->assertInstanceOf(\DateTime::class, $users[1]->birthday); $this->assertInstanceOf(\DateTime::class, $users[2]->birthday); - $this->assertEquals('1987-11-01', $users[2]->birthday->format('Y-m-d')); + $this->assertSame('1987-11-01', $users[2]->birthday->format('Y-m-d')); DB::flushQueryLog(); diff --git a/tests/Database/DatabaseEloquentModelTest.php b/tests/Database/DatabaseEloquentModelTest.php index 84470778a14f..40f3f625ef4d 100755 --- a/tests/Database/DatabaseEloquentModelTest.php +++ b/tests/Database/DatabaseEloquentModelTest.php @@ -1459,7 +1459,7 @@ public function testToArray() $this->assertSame('boom', $array['names'][1]['bam']); $this->assertSame('abby', $array['partner']['name']); $this->assertNull($array['group']); - $this->assertEquals([], $array['multi']); + $this->assertSame([], $array['multi']); $this->assertFalse(isset($array['password'])); $model->setAppends(['appendable']); @@ -1814,7 +1814,7 @@ public function testUnderscorePropertiesAreNotFilled() { $model = new EloquentModelStub; $model->fill(['_method' => 'PUT']); - $this->assertEquals([], $model->getAttributes()); + $this->assertSame([], $model->getAttributes()); } public function testGuarded() @@ -2561,10 +2561,10 @@ public function testAppendingOfAttributes() $this->assertFalse($model->hasAppended('not_appended')); $model->setHidden(['is_admin', 'camelCased', 'StudlyCased']); - $this->assertEquals([], $model->toArray()); + $this->assertSame([], $model->toArray()); $model->setVisible([]); - $this->assertEquals([], $model->toArray()); + $this->assertSame([], $model->toArray()); } public function testMergeAppendsMergesAppends() @@ -2796,7 +2796,7 @@ public function testIncrementEachWithExtraColumnsOnExistingModel() $this->assertEquals(1, $result); $this->assertEquals(7, $model->foo); - $this->assertEquals('test', $model->category); + $this->assertSame('test', $model->category); } public function testIncrementEachFiresModelEvents() @@ -3138,8 +3138,8 @@ public function testMergeCastsMergesCastsUsingArrays() $this->assertCount($castCount + 2, $model->getCasts()); $this->assertArrayHasKey('foo', $model->getCasts()); - $this->assertEquals('MyClass:myArgumentA', $model->getCasts()['foo']); - $this->assertEquals('MyClass:myArgumentA,myArgumentB', $model->getCasts()['bar']); + $this->assertSame('MyClass:myArgumentA', $model->getCasts()['foo']); + $this->assertSame('MyClass:myArgumentA,myArgumentB', $model->getCasts()['bar']); } public function testUnsetCastAttributes() @@ -3356,8 +3356,8 @@ public function testThrowsWhenAccessingMissingAttributesWhichArePrimitiveCasts() $this->assertInstanceOf(Address::class, $model->address); $this->assertEquals(1, $model->id); - $this->assertEquals('ok', $model->this_is_fine); - $this->assertEquals('ok', $model->this_is_also_fine); + $this->assertSame('ok', $model->this_is_fine); + $this->assertSame('ok', $model->this_is_also_fine); // Primitive castables, enum castable $expectedExceptionCount = count($primitiveCasts) + 1; @@ -3388,7 +3388,7 @@ public function testUsesOverriddenHandlerWhenAccessingMissingAttributes() $model->this_attribute_does_not_exist; $this->assertInstanceOf(EloquentModelStub::class, $callbackModel); - $this->assertEquals('this_attribute_does_not_exist', $callbackKey); + $this->assertSame('this_attribute_does_not_exist', $callbackKey); Model::preventAccessingMissingAttributes($originalMode); Model::handleMissingAttributeViolationUsing(null); @@ -3553,8 +3553,8 @@ public function testGetOriginalCastsAttributes() $this->assertEquals(2, $model->getAttribute('intAttribute')); $this->assertIsFloat($model->getOriginal('floatAttribute')); - $this->assertEquals(0.1234, $model->getOriginal('floatAttribute')); - $this->assertEquals(0.443, $model->floatAttribute); + $this->assertSame(0.1234, $model->getOriginal('floatAttribute')); + $this->assertSame(0.443, $model->floatAttribute); $this->assertIsString($model->getOriginal('stringAttribute')); $this->assertSame('432', $model->getOriginal('stringAttribute')); @@ -3630,7 +3630,7 @@ public function testUsingStringableObjectCastUsesStringRepresentation() { $model = new EloquentModelCastingStub; - $this->assertEquals('int', $model->getCasts()['castStringableObject']); + $this->assertSame('int', $model->getCasts()['castStringableObject']); } public function testMergeingStringableObjectCastUSesStringRepresentation() @@ -3642,7 +3642,7 @@ public function testMergeingStringableObjectCastUSesStringRepresentation() 'something' => $stringable, ]); - $this->assertEquals('test', $model->getCasts()['something']); + $this->assertSame('test', $model->getCasts()['something']); } public function testUsingPlainObjectAsCastThrowsException() @@ -3688,8 +3688,8 @@ public function testDiscardChangesWithCasts() $model->address_line_one = '123 Main Street'; - $this->assertEquals('123 Main Street', $model->address->lineOne); - $this->assertEquals('123 MAIN STREET', $model->address_in_caps); + $this->assertSame('123 Main Street', $model->address->lineOne); + $this->assertSame('123 MAIN STREET', $model->address_in_caps); $model->discardChanges(); @@ -3805,7 +3805,7 @@ public function testUseFactoryAttribute() $this->assertInstanceOf(EloquentModelWithUseFactoryAttributeFactory::class, $model::factory()); $this->assertInstanceOf(EloquentModelWithUseFactoryAttributeFactory::class, $model::newFactory()); $this->assertEquals(EloquentModelWithUseFactoryAttribute::class, $factory->modelName()); - $this->assertEquals('test name', $instance->name); // Small smoke test to ensure the factory is working + $this->assertSame('test name', $instance->name); // Small smoke test to ensure the factory is working } public function testNestedModelBootingIsDisallowed() diff --git a/tests/Database/DatabaseEloquentPivotTest.php b/tests/Database/DatabaseEloquentPivotTest.php index ee13f58acefa..6af940ae7666 100755 --- a/tests/Database/DatabaseEloquentPivotTest.php +++ b/tests/Database/DatabaseEloquentPivotTest.php @@ -69,7 +69,7 @@ public function testPropertiesUnchangedAreNotDirty() $parent->shouldReceive('getConnectionName')->once()->andReturn('connection'); $pivot = Pivot::fromAttributes($parent, ['foo' => 'bar', 'shimy' => 'shake'], 'table', true); - $this->assertEquals([], $pivot->getDirty()); + $this->assertSame([], $pivot->getDirty()); } public function testPropertiesChangedAreDirty() diff --git a/tests/Database/DatabaseMigrationCreatorTest.php b/tests/Database/DatabaseMigrationCreatorTest.php index bf9a20420b9a..72cedd763979 100755 --- a/tests/Database/DatabaseMigrationCreatorTest.php +++ b/tests/Database/DatabaseMigrationCreatorTest.php @@ -47,7 +47,7 @@ public function testBasicCreateMethodCallsPostCreateHooks() $creator->create('create_bar', 'foo', $table); $this->assertEquals($_SERVER['__migration.creator.table'], $table); - $this->assertEquals('foo/foo_create_bar.php', $_SERVER['__migration.creator.path']); + $this->assertSame('foo/foo_create_bar.php', $_SERVER['__migration.creator.path']); unset($_SERVER['__migration.creator.table'], $_SERVER['__migration.creator.path']); } diff --git a/tests/Database/DatabaseQueryBuilderTest.php b/tests/Database/DatabaseQueryBuilderTest.php index f8a927e184a7..8b3888fb0097 100755 --- a/tests/Database/DatabaseQueryBuilderTest.php +++ b/tests/Database/DatabaseQueryBuilderTest.php @@ -418,15 +418,15 @@ public function testDateBasedWheresExpressionIsNotBound() $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereDay('created_at', new Raw('NOW()')); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereMonth('created_at', new Raw('NOW()')); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereYear('created_at', new Raw('NOW()')); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); } public function testWhereDateMySql() @@ -571,7 +571,7 @@ public function testWhereTimeSqlServer() $builder = $this->getSqlServerBuilder(); $builder->select('*')->from('users')->whereTime('created_at', new Raw('NOW()')); $this->assertSame('select * from [users] where cast([created_at] as time) = NOW()', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); } public function testOrWhereTimeMySql() @@ -1135,7 +1135,7 @@ public function testWhereBetweens() $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereBetween('id', [new Raw(1), new Raw(2)]); $this->assertSame('select * from "users" where "id" between 1 and 2', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); $builder = $this->getBuilder(); $period = Carbon::now()->startOfDay()->toPeriod(Carbon::now()->addDay()->startOfDay()); @@ -1248,17 +1248,17 @@ public function testWhereBetweenColumns() $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereBetweenColumns('id', ['users.created_at', 'users.updated_at']); $this->assertSame('select * from "users" where "id" between "users"."created_at" and "users"."updated_at"', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereNotBetweenColumns('id', ['created_at', 'updated_at']); $this->assertSame('select * from "users" where "id" not between "created_at" and "updated_at"', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereBetweenColumns('id', [new Raw(1), new Raw(2)]); $this->assertSame('select * from "users" where "id" between 1 and 2', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); $subqueryBuilder = $this->getBuilder(); $subqueryBuilder->select('created_at')->from('posts')->where('status', 'published')->orderByDesc('created_at')->limit(1); @@ -1501,7 +1501,7 @@ public function testEmptyWhereIns() $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereIn('id', []); $this->assertSame('select * from "users" where 0 = 1', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); $builder = $this->getBuilder(); $builder->select('*')->from('users')->where('id', '=', 1)->orWhereIn('id', []); @@ -1514,7 +1514,7 @@ public function testEmptyWhereNotIns() $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereNotIn('id', []); $this->assertSame('select * from "users" where 1 = 1', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); $builder = $this->getBuilder(); $builder->select('*')->from('users')->where('id', '=', 1)->orWhereNotIn('id', []); @@ -1529,7 +1529,7 @@ public function testWhereIntegerInRaw() '1a', 2, Bar::FOO, ]); $this->assertSame('select * from "users" where "id" in (1, 2, 5)', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereIntegerInRaw('id', [ @@ -1539,7 +1539,7 @@ public function testWhereIntegerInRaw() ['id' => Bar::FOO], ]); $this->assertSame('select * from "users" where "id" in (1, 2, 3, 5)', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); } public function testOrWhereIntegerInRaw() @@ -1555,7 +1555,7 @@ public function testWhereIntegerNotInRaw() $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereIntegerNotInRaw('id', ['1a', 2]); $this->assertSame('select * from "users" where "id" not in (1, 2)', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); } public function testOrWhereIntegerNotInRaw() @@ -1571,7 +1571,7 @@ public function testEmptyWhereIntegerInRaw() $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereIntegerInRaw('id', []); $this->assertSame('select * from "users" where 0 = 1', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); } public function testEmptyWhereIntegerNotInRaw() @@ -1579,7 +1579,7 @@ public function testEmptyWhereIntegerNotInRaw() $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereIntegerNotInRaw('id', []); $this->assertSame('select * from "users" where 1 = 1', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); } public function testBasicWhereColumn() @@ -1587,12 +1587,12 @@ public function testBasicWhereColumn() $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereColumn('first_name', 'last_name')->orWhereColumn('first_name', 'middle_name'); $this->assertSame('select * from "users" where "first_name" = "last_name" or "first_name" = "middle_name"', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereColumn('updated_at', '>', 'created_at'); $this->assertSame('select * from "users" where "updated_at" > "created_at"', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); } public function testArrayWhereColumn() @@ -1605,7 +1605,7 @@ public function testArrayWhereColumn() $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereColumn($conditions); $this->assertSame('select * from "users" where ("first_name" = "last_name" and "updated_at" > "created_at")', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); } public function testWhereFulltextMySql() @@ -2072,7 +2072,7 @@ public function testBasicWhereNulls() $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereNull('id'); $this->assertSame('select * from "users" where "id" is null', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); $builder = $this->getBuilder(); $builder->select('*')->from('users')->where('id', '=', 1)->orWhereNull('id'); @@ -2085,7 +2085,7 @@ public function testBasicWhereNullExpressionsMysql() $builder = $this->getMysqlBuilder(); $builder->select('*')->from('users')->whereNull(new Raw('id')); $this->assertSame('select * from `users` where id is null', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); $builder = $this->getMysqlBuilder(); $builder->select('*')->from('users')->where('id', '=', 1)->orWhereNull(new Raw('id')); @@ -2126,7 +2126,7 @@ public function testArrayWhereNulls() $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereNull(['id', 'expires_at']); $this->assertSame('select * from "users" where "id" is null and "expires_at" is null', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); $builder = $this->getBuilder(); $builder->select('*')->from('users')->where('id', '=', 1)->orWhereNull(['id', 'expires_at']); @@ -2139,7 +2139,7 @@ public function testBasicWhereNotNulls() $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereNotNull('id'); $this->assertSame('select * from "users" where "id" is not null', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); $builder = $this->getBuilder(); $builder->select('*')->from('users')->where('id', '>', 1)->orWhereNotNull('id'); @@ -2152,7 +2152,7 @@ public function testArrayWhereNotNulls() $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereNotNull(['id', 'expires_at']); $this->assertSame('select * from "users" where "id" is not null and "expires_at" is not null', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); $builder = $this->getBuilder(); $builder->select('*')->from('users')->where('id', '>', 1)->orWhereNotNull(['id', 'expires_at']); @@ -2413,7 +2413,7 @@ public function testReorder() $builder->select('*')->from('users')->orderByRaw('?', [true]); $this->assertEquals([true], $builder->getBindings()); $builder->reorder(); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); } public function testOrderBySubQueries() @@ -2943,49 +2943,49 @@ public function testWhereWithArrayConditions() $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereColumn([['foo', '_foo'], ['bar', '_bar']]); $this->assertSame('select * from "users" where ("foo" = "_foo" and "bar" = "_bar")', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereColumn([['foo', '_foo'], ['bar', '_bar']], boolean: 'or'); $this->assertSame('select * from "users" where ("foo" = "_foo" or "bar" = "_bar")', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereColumn([['foo', '_foo'], ['bar', '_bar']], boolean: 'and'); $this->assertSame('select * from "users" where ("foo" = "_foo" and "bar" = "_bar")', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereColumn(['foo' => '_foo', 'bar' => '_bar']); $this->assertSame('select * from "users" where ("foo" = "_foo" and "bar" = "_bar")', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereColumn(['foo' => '_foo', 'bar' => '_bar'], boolean: 'or'); $this->assertSame('select * from "users" where ("foo" = "_foo" or "bar" = "_bar")', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereColumn(['foo' => '_foo', 'bar' => '_bar'], boolean: 'and'); $this->assertSame('select * from "users" where ("foo" = "_foo" and "bar" = "_bar")', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); // whereColumn(col1, <, col2) $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereColumn([['foo', '_foo'], ['bar', '<', '_bar']]); $this->assertSame('select * from "users" where ("foo" = "_foo" and "bar" < "_bar")', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereColumn([['foo', '_foo'], ['bar', '<', '_bar']], boolean: 'or'); $this->assertSame('select * from "users" where ("foo" = "_foo" or "bar" < "_bar")', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); $builder = $this->getBuilder(); $builder->select('*')->from('users')->whereColumn([['foo', '_foo'], ['bar', '<', '_bar']], boolean: 'and'); $this->assertSame('select * from "users" where ("foo" = "_foo" and "bar" < "_bar")', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); // whereAll([...keys], value) @@ -5866,7 +5866,7 @@ public function testSubSelectResetBindings() $builder->select('*'); $this->assertSame('select * from "one"', $builder->toSql()); - $this->assertEquals([], $builder->getBindings()); + $this->assertSame([], $builder->getBindings()); } public function testSelectExpression() @@ -6297,7 +6297,7 @@ public function testCursorPaginate() $results = collect([['test' => 'foo'], ['test' => 'bar']]); $builder->shouldReceive('get')->once()->andReturnUsing(function () use ($builder, $results) { - $this->assertEquals( + $this->assertSame( 'select * from "foobar" where ("test" > ?) order by "test" asc limit 17', $builder->toSql()); $this->assertEquals(['bar'], $builder->bindings['where']); @@ -6335,7 +6335,7 @@ public function testCursorPaginateMultipleOrderColumns() $results = collect([['test' => 'foo', 'another' => 1], ['test' => 'bar', 'another' => 2]]); $builder->shouldReceive('get')->once()->andReturnUsing(function () use ($builder, $results) { - $this->assertEquals( + $this->assertSame( 'select * from "foobar" where ("test" > ? or ("test" = ? and ("another" > ?))) order by "test" asc, "another" asc limit 17', $builder->toSql() ); @@ -6373,7 +6373,7 @@ public function testCursorPaginateWithDefaultArguments() $results = collect([['test' => 'foo'], ['test' => 'bar']]); $builder->shouldReceive('get')->once()->andReturnUsing(function () use ($builder, $results) { - $this->assertEquals( + $this->assertSame( 'select * from "foobar" where ("test" > ?) order by "test" asc limit 16', $builder->toSql()); $this->assertEquals(['bar'], $builder->bindings['where']); @@ -6443,7 +6443,7 @@ public function testCursorPaginateWithSpecificColumns() $results = collect([['id' => 3, 'name' => 'Taylor'], ['id' => 5, 'name' => 'Mohamed']]); $builder->shouldReceive('get')->once()->andReturnUsing(function () use ($builder, $results) { - $this->assertEquals( + $this->assertSame( 'select * from "foobar" where ("id" > ?) order by "id" asc limit 17', $builder->toSql()); $this->assertEquals([2], $builder->bindings['where']); @@ -6481,7 +6481,7 @@ public function testCursorPaginateWithMixedOrders() $results = collect([['foo' => 1, 'bar' => 2, 'baz' => 4], ['foo' => 1, 'bar' => 1, 'baz' => 1]]); $builder->shouldReceive('get')->once()->andReturnUsing(function () use ($builder, $results) { - $this->assertEquals( + $this->assertSame( 'select * from "foobar" where ("foo" > ? or ("foo" = ? and ("bar" < ? or ("bar" = ? and ("baz" > ?))))) order by "foo" asc, "bar" desc, "baz" asc limit 17', $builder->toSql() ); @@ -6519,7 +6519,7 @@ public function testCursorPaginateWithDynamicColumnInSelectRaw() $results = collect([['test' => 'foo'], ['test' => 'bar']]); $builder->shouldReceive('get')->once()->andReturnUsing(function () use ($builder, $results) { - $this->assertEquals( + $this->assertSame( 'select *, (CONCAT(firstname, \' \', lastname)) as test from "foobar" where ((CONCAT(firstname, \' \', lastname)) > ?) order by "test" asc limit 16', $builder->toSql()); $this->assertEquals(['bar'], $builder->bindings['where']); @@ -6560,7 +6560,7 @@ public function testCursorPaginateWithDynamicColumnWithCastInSelectRaw() $results = collect([['test' => 'foo'], ['test' => 'bar']]); $builder->shouldReceive('get')->once()->andReturnUsing(function () use ($builder, $results) { - $this->assertEquals( + $this->assertSame( 'select *, (CAST(CONCAT(firstname, \' \', lastname) as VARCHAR)) as test from "foobar" where ((CAST(CONCAT(firstname, \' \', lastname) as VARCHAR)) > ?) order by "test" asc limit 16', $builder->toSql()); $this->assertEquals(['bar'], $builder->bindings['where']); @@ -6601,7 +6601,7 @@ public function testCursorPaginateWithDynamicColumnInSelectSub() $results = collect([['test' => 'foo'], ['test' => 'bar']]); $builder->shouldReceive('get')->once()->andReturnUsing(function () use ($builder, $results) { - $this->assertEquals( + $this->assertSame( 'select *, (CONCAT(firstname, \' \', lastname)) as "test" from "foobar" where ((CONCAT(firstname, \' \', lastname)) > ?) order by "test" asc limit 16', $builder->toSql()); $this->assertEquals(['bar'], $builder->bindings['where']); @@ -6651,7 +6651,7 @@ public function testCursorPaginateWithUnionWheres() ]); $builder->shouldReceive('get')->once()->andReturnUsing(function () use ($builder, $results, $ts) { - $this->assertEquals( + $this->assertSame( '(select "id", "start_time" as "created_at", \'video\' as type from "videos" where ("start_time" > ?)) union (select "id", "created_at", \'news\' as type from "news" where ("created_at" > ?)) order by "created_at" asc limit 17', $builder->toSql()); $this->assertEquals([$ts], $builder->bindings['where']); @@ -6700,7 +6700,7 @@ public function testCursorPaginateWithMultipleUnionsAndMultipleWheres() ]); $builder->shouldReceive('get')->once()->andReturnUsing(function () use ($builder, $results, $ts) { - $this->assertEquals( + $this->assertSame( '(select "id", "start_time" as "created_at", \'video\' as type from "videos" where ("start_time" > ?)) union (select "id", "created_at", \'news\' as type from "news" where "extra" = ? and ("created_at" > ?)) union (select "id", "created_at", \'podcast\' as type from "podcasts" where "extra" = ? and ("created_at" > ?)) order by "created_at" asc limit 17', $builder->toSql()); $this->assertEquals([$ts], $builder->bindings['where']); @@ -6750,7 +6750,7 @@ public function testCursorPaginateWithUnionMultipleWheresMultipleOrders() ]); $builder->shouldReceive('get')->once()->andReturnUsing(function () use ($builder, $results, $ts) { - $this->assertEquals( + $this->assertSame( '(select "id", "start_time" as "created_at", "type" from "videos" where "extra" = ? and ("id" > ? or ("id" = ? and ("start_time" < ? or ("start_time" = ? and ("type" > ?)))))) union (select "id", "created_at", "type" from "news" where "extra" = ? and ("id" > ? or ("id" = ? and ("start_time" < ? or ("start_time" = ? and ("type" > ?)))))) union (select "id", "created_at", "type" from "podcasts" where "extra" = ? and ("id" > ? or ("id" = ? and ("start_time" < ? or ("start_time" = ? and ("type" > ?)))))) order by "id" asc, "created_at" desc, "type" asc limit 17', $builder->toSql()); $this->assertEquals(['first', 1, 1, $ts, $ts, 'news'], $builder->bindings['where']); @@ -6797,7 +6797,7 @@ public function testCursorPaginateWithUnionWheresWithRawOrderExpression() ]); $builder->shouldReceive('get')->once()->andReturnUsing(function () use ($builder, $results, $ts) { - $this->assertEquals( + $this->assertSame( '(select "id", "is_published", "start_time" as "created_at", \'video\' as type from "videos" where "is_published" = ? and ("start_time" > ?)) union (select "id", "is_published", "created_at", \'news\' as type from "news" where "is_published" = ? and ("created_at" > ?)) order by case when (id = 3 and type="news" then 0 else 1 end), "created_at" asc limit 17', $builder->toSql()); $this->assertEquals([true, $ts], $builder->bindings['where']); @@ -6844,7 +6844,7 @@ public function testCursorPaginateWithUnionWheresReverseOrder() ]); $builder->shouldReceive('get')->once()->andReturnUsing(function () use ($builder, $results, $ts) { - $this->assertEquals( + $this->assertSame( '(select "id", "start_time" as "created_at", \'video\' as type from "videos" where ("start_time" < ?)) union (select "id", "created_at", \'news\' as type from "news" where ("created_at" < ?)) order by "created_at" desc limit 17', $builder->toSql()); $this->assertEquals([$ts], $builder->bindings['where']); @@ -6891,7 +6891,7 @@ public function testCursorPaginateWithUnionWheresMultipleOrders() ]); $builder->shouldReceive('get')->once()->andReturnUsing(function () use ($builder, $results, $ts) { - $this->assertEquals( + $this->assertSame( '(select "id", "start_time" as "created_at", \'video\' as type from "videos" where ("start_time" < ? or ("start_time" = ? and ("id" > ?)))) union (select "id", "created_at", \'news\' as type from "news" where ("created_at" < ? or ("created_at" = ? and ("id" > ?)))) order by "created_at" desc, "id" asc limit 17', $builder->toSql()); $this->assertEquals([$ts, $ts, 1], $builder->bindings['where']); @@ -6940,7 +6940,7 @@ public function testCursorPaginateWithUnionWheresAndAliassedOrderColumns() ]); $builder->shouldReceive('get')->once()->andReturnUsing(function () use ($builder, $results, $ts) { - $this->assertEquals( + $this->assertSame( '(select "id", "start_time" as "created_at", \'video\' as type from "videos" where ("start_time" > ?)) union (select "id", "created_at", \'news\' as type from "news" where ("created_at" > ?)) union (select "id", "init_at" as "created_at", \'podcast\' as type from "podcasts" where ("init_at" > ?)) order by "created_at" asc limit 17', $builder->toSql()); $this->assertEquals([$ts], $builder->bindings['where']); @@ -7569,7 +7569,7 @@ public function testCloneWithoutBindings() $this->assertEquals([0 => 'foo'], $builder->getBindings()); $this->assertSame('select * from "users" order by "email" asc', $clone->toSql()); - $this->assertEquals([], $clone->getBindings()); + $this->assertSame([], $clone->getBindings()); } public function testToRawSql() diff --git a/tests/Database/DatabaseTransactionsManagerTest.php b/tests/Database/DatabaseTransactionsManagerTest.php index d536a231753c..9cd4b6d0105d 100755 --- a/tests/Database/DatabaseTransactionsManagerTest.php +++ b/tests/Database/DatabaseTransactionsManagerTest.php @@ -304,21 +304,21 @@ public function testStageTransactions() $pendingTransactions = $manager->getPendingTransactions(); $this->assertEquals(1, $pendingTransactions[0]->level); - $this->assertEquals('default', $pendingTransactions[0]->connection); + $this->assertSame('default', $pendingTransactions[0]->connection); $this->assertEquals(1, $pendingTransactions[1]->level); - $this->assertEquals('admin', $pendingTransactions[1]->connection); + $this->assertSame('admin', $pendingTransactions[1]->connection); $manager->stageTransactions('default', 1); $this->assertCount(1, $manager->getPendingTransactions()); $this->assertCount(1, $manager->getCommittedTransactions()); - $this->assertEquals('default', $manager->getCommittedTransactions()[0]->connection); + $this->assertSame('default', $manager->getCommittedTransactions()[0]->connection); $manager->stageTransactions('admin', 1); $this->assertCount(0, $manager->getPendingTransactions()); $this->assertCount(2, $manager->getCommittedTransactions()); - $this->assertEquals('admin', $manager->getCommittedTransactions()[1]->connection); + $this->assertSame('admin', $manager->getCommittedTransactions()[1]->connection); } public function testStageTransactionsOnlyStagesTheTransactionsAtOrAboveTheGivenLevel() diff --git a/tests/Database/EloquentModelCustomCastingTest.php b/tests/Database/EloquentModelCustomCastingTest.php index 07fff202d7e4..701f8b240b55 100644 --- a/tests/Database/EloquentModelCustomCastingTest.php +++ b/tests/Database/EloquentModelCustomCastingTest.php @@ -186,10 +186,10 @@ public function testModelWithCustomCastsWorkWithCustomIncrementDecrement() $model->save(); $this->assertInstanceOf(Euro::class, $model->amount); - $this->assertEquals('2', $model->amount->value); + $this->assertSame('2', $model->amount->value); $model->increment('amount', new Euro('1')); - $this->assertEquals('3.00', $model->amount->value); + $this->assertSame('3.00', $model->amount->value); } public function testModelWithCustomCastsCompareFunction() diff --git a/tests/Events/EventsDispatcherTest.php b/tests/Events/EventsDispatcherTest.php index 0069ffe62603..8c2a873b9519 100755 --- a/tests/Events/EventsDispatcherTest.php +++ b/tests/Events/EventsDispatcherTest.php @@ -47,7 +47,7 @@ public function testDeferEventExecution() return 'callback_result'; }); - $this->assertEquals('callback_result', $result); + $this->assertSame('callback_result', $result); $this->assertSame('bar', $_SERVER['__event.test']); } @@ -196,7 +196,7 @@ public function testResponseWhenNoListenersAreSet() $d = new Dispatcher; $response = $d->dispatch('foo'); - $this->assertEquals([], $response); + $this->assertSame([], $response); $response = $d->dispatch('foo', [], true); $this->assertNull($response); @@ -605,7 +605,7 @@ public function testListenersObjectsCreationOrder() $d->listen(TestEvent::class, TestListener3::class); // Attaching events does not make any objects. - $this->assertEquals([], $_SERVER['__event.test']); + $this->assertSame([], $_SERVER['__event.test']); $d->dispatch(TestEvent::class); diff --git a/tests/Filesystem/FilesystemAdapterTest.php b/tests/Filesystem/FilesystemAdapterTest.php index 141474aa56bc..ab14560c8d33 100644 --- a/tests/Filesystem/FilesystemAdapterTest.php +++ b/tests/Filesystem/FilesystemAdapterTest.php @@ -742,7 +742,7 @@ public function testPrefixesUrls() { $filesystemAdapter = new FilesystemAdapter($this->filesystem, $this->adapter, ['url' => 'https://example.org/', 'prefix' => 'images']); - $this->assertEquals('https://example.org/images/picture.jpeg', $filesystemAdapter->url('picture.jpeg')); + $this->assertSame('https://example.org/images/picture.jpeg', $filesystemAdapter->url('picture.jpeg')); } public function testGetChecksum() @@ -750,8 +750,8 @@ public function testGetChecksum() $filesystemAdapter = new FilesystemAdapter($this->filesystem, $this->adapter); $filesystemAdapter->write('path.txt', 'contents of file'); - $this->assertEquals('730bed78bccf58c2cfe44c29b71e5e6b', $filesystemAdapter->checksum('path.txt')); - $this->assertEquals('a5c3556d', $filesystemAdapter->checksum('path.txt', ['checksum_algo' => 'crc32'])); + $this->assertSame('730bed78bccf58c2cfe44c29b71e5e6b', $filesystemAdapter->checksum('path.txt')); + $this->assertSame('a5c3556d', $filesystemAdapter->checksum('path.txt', ['checksum_algo' => 'crc32'])); } public function testUsesRightSeperatorForS3AdapterWithoutDoublePrefixing() @@ -766,7 +766,7 @@ public function testUsesRightSeperatorForS3AdapterWithoutDoublePrefixing() ]); $path = $filesystemAdapter->path('different'); - $this->assertEquals('my-root/someprefix/different', $path); + $this->assertSame('my-root/someprefix/different', $path); } public function testTemporaryUploadUrlWithCustomCallback() diff --git a/tests/Filesystem/FilesystemManagerTest.php b/tests/Filesystem/FilesystemManagerTest.php index 501db8a5bdcd..35b7dd17712a 100644 --- a/tests/Filesystem/FilesystemManagerTest.php +++ b/tests/Filesystem/FilesystemManagerTest.php @@ -57,7 +57,7 @@ public function testCanBuildReadOnlyDisks() file_put_contents(__DIR__.'/../../my-custom-path/path.txt', 'contents'); // read operations work - $this->assertEquals('contents', $disk->get('path.txt')); + $this->assertSame('contents', $disk->get('path.txt')); $this->assertEquals(['path.txt'], $disk->files()); // write operations fail @@ -95,7 +95,7 @@ public function testCanBuildScopedDisks() ]); $scoped->put('dirname/filename.txt', 'file content'); - $this->assertEquals('file content', $local->get('path-prefix/dirname/filename.txt')); + $this->assertSame('file content', $local->get('path-prefix/dirname/filename.txt')); $local->deleteDirectory('path-prefix'); } finally { rmdir(__DIR__.'/../../to-be-scoped'); @@ -127,7 +127,7 @@ public function testCanBuildScopedDiskFromScopedDisk() ]); $nestedScoped->put('dirname/filename.txt', 'file content'); - $this->assertEquals('file content', $root->get('scoped-from-root-prefix/nested-scoped-prefix/dirname/filename.txt')); + $this->assertSame('file content', $root->get('scoped-from-root-prefix/nested-scoped-prefix/dirname/filename.txt')); $root->deleteDirectory('scoped-from-root-prefix'); } finally { rmdir(__DIR__.'/../../root-to-be-scoped'); @@ -157,7 +157,7 @@ public function testCanBuildScopedDisksWithVisibility() $scoped->put('dirname/filename.txt', 'file content'); - $this->assertEquals('private', $scoped->getVisibility('dirname/filename.txt')); + $this->assertSame('private', $scoped->getVisibility('dirname/filename.txt')); } finally { unlink(__DIR__.'/../../to-be-scoped/path-prefix/dirname/filename.txt'); rmdir(__DIR__.'/../../to-be-scoped/path-prefix/dirname'); @@ -209,7 +209,7 @@ public function testCanBuildInlineScopedDisks() $scoped->put('dirname/filename.txt', 'file content'); $this->assertTrue(is_dir(__DIR__.'/../../to-be-scoped/path-prefix')); - $this->assertEquals('file content', file_get_contents(__DIR__.'/../../to-be-scoped/path-prefix/dirname/filename.txt')); + $this->assertSame('file content', file_get_contents(__DIR__.'/../../to-be-scoped/path-prefix/dirname/filename.txt')); } finally { unlink(__DIR__.'/../../to-be-scoped/path-prefix/dirname/filename.txt'); rmdir(__DIR__.'/../../to-be-scoped/path-prefix/dirname'); diff --git a/tests/Filesystem/FilesystemTest.php b/tests/Filesystem/FilesystemTest.php index d6e8a736313a..8f0be49a5852 100755 --- a/tests/Filesystem/FilesystemTest.php +++ b/tests/Filesystem/FilesystemTest.php @@ -725,6 +725,6 @@ public function testDirectoryOperationsWithSubdirectories() $allFiles = $files->allFiles($dirPath); $this->assertCount(1, $allFiles); - $this->assertEquals('test.txt', $allFiles[0]->getFilename()); + $this->assertSame('test.txt', $allFiles[0]->getFilename()); } } diff --git a/tests/Foundation/Configuration/MiddlewareTest.php b/tests/Foundation/Configuration/MiddlewareTest.php index 240c52dc1f54..ecf0c0e85b00 100644 --- a/tests/Foundation/Configuration/MiddlewareTest.php +++ b/tests/Foundation/Configuration/MiddlewareTest.php @@ -155,7 +155,7 @@ public function testTrustProxies() ], $method->invoke($middleware)); $configuration->trustProxies(at: '*'); - $this->assertEquals('*', $method->invoke($middleware)); + $this->assertSame('*', $method->invoke($middleware)); $configuration->trustProxies(at: [ '192.168.1.3', @@ -240,10 +240,10 @@ protected function allSubdomainsOfApplicationUrl() $this->assertEquals(['^(.+\.)?laravel\.test$'], $middleware->hosts()); $configuration->trustHosts(at: [], subdomains: false); - $this->assertEquals([], $middleware->hosts()); + $this->assertSame([], $middleware->hosts()); $configuration->trustHosts(at: static fn () => [], subdomains: false); - $this->assertEquals([], $middleware->hosts()); + $this->assertSame([], $middleware->hosts()); } public function testEncryptCookies() diff --git a/tests/Foundation/Console/RouteListCommandTest.php b/tests/Foundation/Console/RouteListCommandTest.php index 3e1135944221..76dd9cb1207f 100644 --- a/tests/Foundation/Console/RouteListCommandTest.php +++ b/tests/Foundation/Console/RouteListCommandTest.php @@ -80,9 +80,9 @@ public function testSortRouteListAsc() $routes = json_decode($output, true); $this->assertCount(3, $routes); - $this->assertEquals('example', $routes[0]['uri']); - $this->assertEquals('example-group', $routes[1]['uri']); - $this->assertEquals('sub-example', $routes[2]['uri']); + $this->assertSame('example', $routes[0]['uri']); + $this->assertSame('example-group', $routes[1]['uri']); + $this->assertSame('sub-example', $routes[2]['uri']); foreach ($routes as $route) { $this->assertArrayHasKey('path', $route); @@ -98,9 +98,9 @@ public function testSortRouteListDesc() $routes = json_decode($output, true); $this->assertCount(3, $routes); - $this->assertEquals('sub-example', $routes[0]['uri']); - $this->assertEquals('example-group', $routes[1]['uri']); - $this->assertEquals('example', $routes[2]['uri']); + $this->assertSame('sub-example', $routes[0]['uri']); + $this->assertSame('example-group', $routes[1]['uri']); + $this->assertSame('example', $routes[2]['uri']); foreach ($routes as $route) { $this->assertArrayHasKey('path', $route); @@ -116,9 +116,9 @@ public function testSortRouteListDefault() $routes = json_decode($output, true); $this->assertCount(3, $routes); - $this->assertEquals('example', $routes[0]['uri']); - $this->assertEquals('example-group', $routes[1]['uri']); - $this->assertEquals('sub-example', $routes[2]['uri']); + $this->assertSame('example', $routes[0]['uri']); + $this->assertSame('example-group', $routes[1]['uri']); + $this->assertSame('sub-example', $routes[2]['uri']); foreach ($routes as $route) { $this->assertArrayHasKey('path', $route); @@ -134,9 +134,9 @@ public function testSortRouteListPrecedence() $routes = json_decode($output, true); $this->assertCount(3, $routes); - $this->assertEquals('example', $routes[0]['uri']); - $this->assertEquals('sub-example', $routes[1]['uri']); - $this->assertEquals('example-group', $routes[2]['uri']); + $this->assertSame('example', $routes[0]['uri']); + $this->assertSame('sub-example', $routes[1]['uri']); + $this->assertSame('example-group', $routes[2]['uri']); foreach ($routes as $route) { $this->assertArrayHasKey('path', $route); @@ -216,11 +216,11 @@ public function testMiddlewareGroupsExpandCorrectlySortedIfVeryVerbose() $routes = json_decode($output, true); $this->assertCount(3, $routes); - $this->assertEquals('example', $routes[0]['uri']); + $this->assertSame('example', $routes[0]['uri']); $this->assertEquals(['exampleMiddleware'], $routes[0]['middleware']); - $this->assertEquals('example-group', $routes[1]['uri']); + $this->assertSame('example-group', $routes[1]['uri']); $this->assertEquals(['Middleware 5', 'Middleware 1', 'Middleware 4', 'Middleware 2', 'Middleware 3'], $routes[1]['middleware']); - $this->assertEquals('sub-example', $routes[2]['uri']); + $this->assertSame('sub-example', $routes[2]['uri']); $this->assertEquals(['exampleMiddleware'], $routes[2]['middleware']); } @@ -232,7 +232,7 @@ public function testFilterByMiddleware() $routes = json_decode($output, true); $this->assertCount(1, $routes); - $this->assertEquals('example-group', $routes[0]['uri']); + $this->assertSame('example-group', $routes[0]['uri']); $this->assertEquals(['web', 'auth'], $routes[0]['middleware']); $this->assertStringContainsString('RouteListCommandTest.php:', $routes[0]['path']); } diff --git a/tests/Foundation/Exceptions/Renderer/ListenerTest.php b/tests/Foundation/Exceptions/Renderer/ListenerTest.php index cef5c0c135f1..9eb238e1b5db 100644 --- a/tests/Foundation/Exceptions/Renderer/ListenerTest.php +++ b/tests/Foundation/Exceptions/Renderer/ListenerTest.php @@ -34,9 +34,9 @@ public function test_queries_returns_expected_shape_after_query_executed() $this->assertArrayHasKey('sql', $query); $this->assertArrayHasKey('bindings', $query); - $this->assertEquals('testing', $query['connectionName']); - $this->assertEquals(5.2, $query['time']); - $this->assertEquals('select * from users where id = ?', $query['sql']); + $this->assertSame('testing', $query['connectionName']); + $this->assertSame(5.2, $query['time']); + $this->assertSame('select * from users where id = ?', $query['sql']); $this->assertEquals(['foo'], $query['bindings']); } @@ -55,8 +55,8 @@ public function test_listener_caps_at_100_queries() } $this->assertCount(100, $listener->queries()); - $this->assertEquals('select 0', $listener->queries()[0]['sql']); - $this->assertEquals('select 99', $listener->queries()[99]['sql']); + $this->assertSame('select 0', $listener->queries()[0]['sql']); + $this->assertSame('select 99', $listener->queries()[99]['sql']); } public function test_large_sql_is_truncated() @@ -144,7 +144,7 @@ public function test_query_with_no_bindings_is_unchanged() new QueryExecuted('select count(*) from users', [], 1.0, $connection) ); - $this->assertEquals('select count(*) from users', $listener->queries()[0]['sql']); + $this->assertSame('select count(*) from users', $listener->queries()[0]['sql']); $this->assertEmpty($listener->queries()[0]['bindings']); } diff --git a/tests/Foundation/FoundationFormRequestTest.php b/tests/Foundation/FoundationFormRequestTest.php index e96de23a5200..56fe0c50e1ca 100644 --- a/tests/Foundation/FoundationFormRequestTest.php +++ b/tests/Foundation/FoundationFormRequestTest.php @@ -229,7 +229,7 @@ public function testRequestCanPassWithoutRulesMethod() $request->validateResolved(); - $this->assertEquals([], $request->all()); + $this->assertSame([], $request->all()); } public function testRequestWithGetRules() diff --git a/tests/Foundation/FoundationInteractsWithDatabaseTest.php b/tests/Foundation/FoundationInteractsWithDatabaseTest.php index 9253952fda0c..a0a39e0eb924 100644 --- a/tests/Foundation/FoundationInteractsWithDatabaseTest.php +++ b/tests/Foundation/FoundationInteractsWithDatabaseTest.php @@ -372,7 +372,7 @@ public function testGetTableNameFromModel() $this->assertEquals($this->table, $this->getTable(ProductStub::class)); $this->assertEquals($this->table, $this->getTable(new ProductStub)); $this->assertEquals($this->table, $this->getTable($this->table)); - $this->assertEquals('all_products', $this->getTable((new ProductStub)->setTable('all_products'))); + $this->assertSame('all_products', $this->getTable((new ProductStub)->setTable('all_products'))); } public function testGetTableConnectionNameFromModel() @@ -384,8 +384,8 @@ public function testGetTableConnectionNameFromModel() public function testGetTableCustomizedDeletedAtColumnName() { - $this->assertEquals('trashed_at', $this->getDeletedAtColumn(CustomProductStub::class)); - $this->assertEquals('trashed_at', $this->getDeletedAtColumn(new CustomProductStub())); + $this->assertSame('trashed_at', $this->getDeletedAtColumn(CustomProductStub::class)); + $this->assertSame('trashed_at', $this->getDeletedAtColumn(new CustomProductStub())); } public function testExpectsDatabaseQueryCount() diff --git a/tests/Foundation/Http/KernelTest.php b/tests/Foundation/Http/KernelTest.php index 8df127e89298..57e53cee3f4c 100644 --- a/tests/Foundation/Http/KernelTest.php +++ b/tests/Foundation/Http/KernelTest.php @@ -17,14 +17,14 @@ public function testGetMiddlewareGroups() { $kernel = new Kernel($this->getApplication(), $this->getRouter()); - $this->assertEquals([], $kernel->getMiddlewareGroups()); + $this->assertSame([], $kernel->getMiddlewareGroups()); } public function testGetRouteMiddleware() { $kernel = new Kernel($this->getApplication(), $this->getRouter()); - $this->assertEquals([], $kernel->getRouteMiddleware()); + $this->assertSame([], $kernel->getRouteMiddleware()); } public function testGetMiddlewarePriority() diff --git a/tests/Foundation/Testing/Concerns/MakesHttpRequestsTest.php b/tests/Foundation/Testing/Concerns/MakesHttpRequestsTest.php index 3a5332fdf20e..86340e27f347 100644 --- a/tests/Foundation/Testing/Concerns/MakesHttpRequestsTest.php +++ b/tests/Foundation/Testing/Concerns/MakesHttpRequestsTest.php @@ -34,7 +34,7 @@ public function testFromRemoveHeader() { $this->withHeader('name', 'Milwad')->from('previous/url'); - $this->assertEquals('Milwad', $this->defaultHeaders['name']); + $this->assertSame('Milwad', $this->defaultHeaders['name']); $this->withoutHeader('name')->from('previous/url'); @@ -48,8 +48,8 @@ public function testFromRemoveHeaders() 'foo' => 'bar', ])->from('previous/url'); - $this->assertEquals('Milwad', $this->defaultHeaders['name']); - $this->assertEquals('bar', $this->defaultHeaders['foo']); + $this->assertSame('Milwad', $this->defaultHeaders['name']); + $this->assertSame('bar', $this->defaultHeaders['foo']); $this->withoutHeaders(['name', 'foo'])->from('previous/url'); diff --git a/tests/Http/HttpClientTest.php b/tests/Http/HttpClientTest.php index d8963e1f1155..db86f7ab8861 100644 --- a/tests/Http/HttpClientTest.php +++ b/tests/Http/HttpClientTest.php @@ -1421,12 +1421,12 @@ public function testRequestLevelTruncationLevelOnRequestException() } // Ensure the exception message is truncated according to the request level truncation setting. - $this->assertEquals("HTTP request returned status code 403:\n[\"e (truncated...)\n", $exception->getMessage()); + $this->assertSame("HTTP request returned status code 403:\n[\"e (truncated...)\n", $exception->getMessage()); $exception->report(); // Ensure that the truncation level is not changed when reporting the exception. - $this->assertEquals("HTTP request returned status code 403:\n[\"e (truncated...)\n", $exception->getMessage()); + $this->assertSame("HTTP request returned status code 403:\n[\"e (truncated...)\n", $exception->getMessage()); $this->assertEquals(60, RequestException::$truncateAt); } @@ -1449,7 +1449,7 @@ public function testNoTruncationOnRequestLevel() $exception->report(); - $this->assertEquals("HTTP request returned status code 403:\nHTTP/1.1 403 Forbidden\r\nContent-Type: application/json\r\n\r\n[\"error\"]\n", $exception->getMessage()); + $this->assertSame("HTTP request returned status code 403:\nHTTP/1.1 403 Forbidden\r\nContent-Type: application/json\r\n\r\n[\"error\"]\n", $exception->getMessage()); $this->assertEquals(60, RequestException::$truncateAt); } @@ -1471,7 +1471,7 @@ public function testRequestExceptionDoesNotTruncateButRequestDoes() $exception->report(); - $this->assertEquals("HTTP request returned status code 403:\n[\"e (truncated...)\n", $exception->getMessage()); + $this->assertSame("HTTP request returned status code 403:\n[\"e (truncated...)\n", $exception->getMessage()); $this->assertFalse(RequestException::$truncateAt); } @@ -1488,7 +1488,7 @@ public function testAsyncRequestExceptionsRespectRequestTruncation() $exception->report(); $this->assertInstanceOf(RequestException::class, $exception); - $this->assertEquals("HTTP request returned status code 403:\n[\"er (truncated...)\n", $exception->getMessage()); + $this->assertSame("HTTP request returned status code 403:\n[\"er (truncated...)\n", $exception->getMessage()); $this->assertFalse(RequestException::$truncateAt); } @@ -2402,7 +2402,7 @@ public function testExceptionThrownInRetryCallbackWithoutRetrying() $this->assertNotNull($exception); $this->assertInstanceOf(Exception::class, $exception); - $this->assertEquals('Foo bar', $exception->getMessage()); + $this->assertSame('Foo bar', $exception->getMessage()); $this->factory->assertSentCount(1); } @@ -2427,7 +2427,7 @@ public function testExceptionThrownInRetryCallbackWithoutRetryingWithBackoffArra $this->assertNotNull($exception); $this->assertInstanceOf(Exception::class, $exception); - $this->assertEquals('Foo bar', $exception->getMessage()); + $this->assertSame('Foo bar', $exception->getMessage()); $this->factory->assertSentCount(1); } @@ -2600,7 +2600,7 @@ public function testExceptionThrownInRetryCallbackIsReturnedWithoutRetryingInPoo $this->assertNotNull($exception); $this->assertInstanceOf(Exception::class, $exception); - $this->assertEquals('Foo bar', $exception->getMessage()); + $this->assertSame('Foo bar', $exception->getMessage()); $this->factory->assertSentCount(1); } @@ -3693,7 +3693,7 @@ public function testItCanEnforceFakingInThePool() }); $this->assertInstanceOf(StrayRequestException::class, $exception); - $this->assertEquals('Attempted request to [https://laravel.com] without a matching fake.', $exception->getMessage()); + $this->assertSame('Attempted request to [https://laravel.com] without a matching fake.', $exception->getMessage()); } public function testPreventingStrayRequests() @@ -4411,7 +4411,7 @@ public function testAfterResponseWithAsync() $this->assertInstanceOf(Request::class, $requestReceived); $this->assertSame('http://200.com', (string) $requestReceived->url()); $this->assertInstanceOf(TestResponse::class, $o['401-response']); - $this->assertEquals('different', $o['401-response']->body()); + $this->assertSame('different', $o['401-response']->body()); $this->assertInstanceOf(RequestException::class, $o['401-throwing']); $this->assertInstanceOf(TestResponse::class, $o['401-throwing']->response); } diff --git a/tests/Http/HttpRedirectResponseTest.php b/tests/Http/HttpRedirectResponseTest.php index eeeabb6204dd..7f5cfda514db 100755 --- a/tests/Http/HttpRedirectResponseTest.php +++ b/tests/Http/HttpRedirectResponseTest.php @@ -78,8 +78,8 @@ public function testWithCookies() new Cookie('name', 'milwad'), ]); - $this->assertEquals('name', $response->headers->getCookies()[0]->getName()); - $this->assertEquals('milwad', $response->headers->getCookies()[0]->getValue()); + $this->assertSame('name', $response->headers->getCookies()[0]->getName()); + $this->assertSame('milwad', $response->headers->getCookies()[0]->getValue()); } public function testOnlyInputOnRedirect() diff --git a/tests/Http/HttpRequestTest.php b/tests/Http/HttpRequestTest.php index 0013113c3bc3..fc7e144e9859 100644 --- a/tests/Http/HttpRequestTest.php +++ b/tests/Http/HttpRequestTest.php @@ -1053,15 +1053,15 @@ public function testOnlyMethod() $request = Request::create('/', 'GET', ['developer' => ['name' => 'Taylor', 'age' => null]]); $this->assertEquals(['developer' => ['name' => 'Taylor']], $request->only('developer.name', 'developer.skills')); $this->assertEquals(['developer' => ['age' => null]], $request->only('developer.age')); - $this->assertEquals([], $request->only('developer.skills')); + $this->assertSame([], $request->only('developer.skills')); } public function testExceptMethod() { $request = Request::create('/', 'GET', ['name' => 'Taylor', 'age' => 25]); $this->assertEquals(['name' => 'Taylor'], $request->except('age')); - $this->assertEquals([], $request->except('age', 'name')); - $this->assertEquals([], $request->except(['age', 'name'])); + $this->assertSame([], $request->except('age', 'name')); + $this->assertSame([], $request->except(['age', 'name'])); } public function testQueryMethod() @@ -1764,12 +1764,12 @@ public function testNonJsonRequestDoesntFillRequestBodyParams() $params = ['foo' => 'bar']; $getRequest = Request::create('/', 'GET', $params, [], [], []); - $this->assertEquals([], $getRequest->request->all()); + $this->assertSame([], $getRequest->request->all()); $this->assertEquals($getRequest->query->all(), $params); $postRequest = Request::create('/', 'POST', $params, [], [], []); $this->assertEquals($postRequest->request->all(), $params); - $this->assertEquals([], $postRequest->query->all()); + $this->assertSame([], $postRequest->query->all()); } /** diff --git a/tests/Http/Middleware/PreventRequestForgeryTest.php b/tests/Http/Middleware/PreventRequestForgeryTest.php index df54a6f2dae4..656443e05b5a 100644 --- a/tests/Http/Middleware/PreventRequestForgeryTest.php +++ b/tests/Http/Middleware/PreventRequestForgeryTest.php @@ -29,7 +29,7 @@ public function test_same_origin_header_passes() $response = $middleware->handle($request, fn () => new Response('OK')); - $this->assertEquals('OK', $response->getContent()); + $this->assertSame('OK', $response->getContent()); } public function test_same_site_header_rejected_by_default() @@ -51,7 +51,7 @@ public function test_same_site_header_passes_when_allowed() $response = $middleware->handle($request, fn () => new Response('OK')); - $this->assertEquals('OK', $response->getContent()); + $this->assertSame('OK', $response->getContent()); } public function test_cross_site_with_valid_token_passes() @@ -61,7 +61,7 @@ public function test_cross_site_with_valid_token_passes() $response = $middleware->handle($request, fn () => new Response('OK')); - $this->assertEquals('OK', $response->getContent()); + $this->assertSame('OK', $response->getContent()); } public function test_cross_site_without_token_fails() @@ -118,7 +118,7 @@ public function test_origin_only_mode_passes_same_origin() $response = $middleware->handle($request, fn () => new Response('OK')); - $this->assertEquals('OK', $response->getContent()); + $this->assertSame('OK', $response->getContent()); } protected function createRequest(array $server = [], ?string $token = null) diff --git a/tests/Http/Middleware/TrimStringsTest.php b/tests/Http/Middleware/TrimStringsTest.php index 7d37662ef1ab..1dce23c4b3aa 100644 --- a/tests/Http/Middleware/TrimStringsTest.php +++ b/tests/Http/Middleware/TrimStringsTest.php @@ -22,7 +22,7 @@ public function test_no_zero_width_space_character_returns_the_same_string() $middleware = new TrimStrings; $middleware->handle($request, function ($req) { - $this->assertEquals('This title does not contain any zero-width space', $req->title); + $this->assertSame('This title does not contain any zero-width space', $req->title); }); } @@ -40,7 +40,7 @@ public function test_leading_zero_width_space_character_is_trimmed() $middleware = new TrimStrings; $middleware->handle($request, function ($req) { - $this->assertEquals('This title contains a zero-width space at the beginning', $req->title); + $this->assertSame('This title contains a zero-width space at the beginning', $req->title); }); } @@ -57,7 +57,7 @@ public function test_trim_strings_can_globally_ignore_certain_inputs() $middleware = new TrimStrings; $middleware->handle($request, function ($req) { - $this->assertEquals(' test title ', $req->globally_ignored_title); + $this->assertSame(' test title ', $req->globally_ignored_title); }); } @@ -75,7 +75,7 @@ public function test_trailing_zero_width_space_character_is_trimmed() $middleware = new TrimStrings; $middleware->handle($request, function ($req) { - $this->assertEquals('This title contains a zero-width space at the end', $req->title); + $this->assertSame('This title contains a zero-width space at the end', $req->title); }); } @@ -93,7 +93,7 @@ public function test_leading_zero_width_non_breakable_space_character_is_trimmed $middleware = new TrimStrings; $middleware->handle($request, function ($req) { - $this->assertEquals('This title contains a zero-width non-breakable space at the beginning', $req->title); + $this->assertSame('This title contains a zero-width non-breakable space at the beginning', $req->title); }); } @@ -111,7 +111,7 @@ public function test_leading_multiple_zero_width_non_breakable_space_characters_ $middleware = new TrimStrings; $middleware->handle($request, function ($req) { - $this->assertEquals('This title contains a zero-width non-breakable space at the beginning', $req->title); + $this->assertSame('This title contains a zero-width non-breakable space at the beginning', $req->title); }); } @@ -129,7 +129,7 @@ public function test_combination_of_leading_and_trailing_zero_width_non_breakabl $middleware = new TrimStrings; $middleware->handle($request, function ($req) { - $this->assertEquals('This title contains a combination of zero-width non-breakable space and zero-width spaces characters at the beginning and the end', $req->title); + $this->assertSame('This title contains a combination of zero-width non-breakable space and zero-width spaces characters at the beginning and the end', $req->title); }); } @@ -147,7 +147,7 @@ public function test_leading_invisible_characters_are_trimmed() $middleware = new TrimStrings; $middleware->handle($request, function ($req) { - $this->assertEquals('This title contains a invisible character at the beginning', $req->title); + $this->assertSame('This title contains a invisible character at the beginning', $req->title); }); } @@ -165,7 +165,7 @@ public function test_trailing_invisible_characters_are_trimmed() $middleware = new TrimStrings; $middleware->handle($request, function ($req) { - $this->assertEquals('This title contains a invisible character at the end', $req->title); + $this->assertSame('This title contains a invisible character at the end', $req->title); }); } @@ -183,7 +183,7 @@ public function test_leading_multiple_invisible_characters_are_trimmed() $middleware = new TrimStrings; $middleware->handle($request, function ($req) { - $this->assertEquals('This title contains a invisible character at the beginning', $req->title); + $this->assertSame('This title contains a invisible character at the beginning', $req->title); }); } @@ -201,7 +201,7 @@ public function test_trailing_multiple_invisible_characters_are_trimmed() $middleware = new TrimStrings; $middleware->handle($request, function ($req) { - $this->assertEquals('This title contains a invisible character at the end', $req->title); + $this->assertSame('This title contains a invisible character at the end', $req->title); }); } @@ -219,7 +219,7 @@ public function test_combination_of_leading_and_trailing_multiple_invisible_char $middleware = new TrimStrings; $middleware->handle($request, function ($req) { - $this->assertEquals('This title contains a combination of a invisible character at beginning and the end', $req->title); + $this->assertSame('This title contains a combination of a invisible character at beginning and the end', $req->title); }); } diff --git a/tests/Integration/Cache/RedisStoreTest.php b/tests/Integration/Cache/RedisStoreTest.php index 9859ff94ce66..1fb5bf6761b9 100644 --- a/tests/Integration/Cache/RedisStoreTest.php +++ b/tests/Integration/Cache/RedisStoreTest.php @@ -108,7 +108,7 @@ public function testTagsCanBeAccessed(string $cachePrefix) Cache::store('redis')->tags(['people', 'author'])->put('name', 'Sally', 5); Cache::store('redis')->tags(['people', 'author'])->put('age', 30, 5); - $this->assertEquals('Sally', Cache::store('redis')->tags(['people', 'author'])->get('name')); + $this->assertSame('Sally', Cache::store('redis')->tags(['people', 'author'])->get('name')); $this->assertEquals(30, Cache::store('redis')->tags(['people', 'author'])->get('age')); Cache::store('redis')->tags(['people', 'author'])->flush(); @@ -124,7 +124,7 @@ public function testTagEntriesCanBeStoredForever() Cache::store('redis')->tags(['people', 'author'])->forever('name', 'Sally'); Cache::store('redis')->tags(['people', 'author'])->forever('age', 30); - $this->assertEquals('Sally', Cache::store('redis')->tags(['people', 'author'])->get('name')); + $this->assertSame('Sally', Cache::store('redis')->tags(['people', 'author'])->get('name')); $this->assertEquals(30, Cache::store('redis')->tags(['people', 'author'])->get('age')); Cache::store('redis')->tags(['people', 'author'])->flush(); @@ -198,7 +198,7 @@ public function testTagsCanBeFlushedBySingleKey() Cache::store('redis')->tags(['artist'])->flush(); - $this->assertEquals('Sally', Cache::store('redis')->tags(['people', 'author'])->get('person-1')); + $this->assertSame('Sally', Cache::store('redis')->tags(['people', 'author'])->get('person-1')); $this->assertNull(Cache::store('redis')->tags(['people', 'artist'])->get('person-2')); $keyCount = Cache::store('redis')->connection()->keys('*'); @@ -240,7 +240,7 @@ public function testMultipleItemsCanBeSetAndRetrieved() 'norf' => null, ], $store->many(['foo', 'fizz', 'quz', 'norf'])); - $this->assertEquals([], $store->many([])); + $this->assertSame([], $store->many([])); } public function testPutManyCallsPutWhenClustered() @@ -285,9 +285,9 @@ public function testTagsCanBeFlushedWithLargeNumberOfKeys() Cache::store('redis')->tags($tags)->put("key:{$i}", "value:{$i}", 300); } - $this->assertEquals('value:1', Cache::store('redis')->tags($tags)->get('key:1')); - $this->assertEquals('value:2500', Cache::store('redis')->tags($tags)->get('key:2500')); - $this->assertEquals('value:5000', Cache::store('redis')->tags($tags)->get('key:5000')); + $this->assertSame('value:1', Cache::store('redis')->tags($tags)->get('key:1')); + $this->assertSame('value:2500', Cache::store('redis')->tags($tags)->get('key:2500')); + $this->assertSame('value:5000', Cache::store('redis')->tags($tags)->get('key:5000')); Cache::store('redis')->tags($tags)->flush(); diff --git a/tests/Integration/Concurrency/ConcurrencyTest.php b/tests/Integration/Concurrency/ConcurrencyTest.php index 19a75d9ba491..c58c50dbf55b 100644 --- a/tests/Integration/Concurrency/ConcurrencyTest.php +++ b/tests/Integration/Concurrency/ConcurrencyTest.php @@ -154,9 +154,9 @@ function () { }, ]); - $this->assertEquals('first', $first); - $this->assertEquals('second', $second); - $this->assertEquals('third', $third); + $this->assertSame('first', $first); + $this->assertSame('second', $second); + $this->assertSame('third', $third); } } diff --git a/tests/Integration/Concurrency/Console/InvokeSerializedClosureCommandTest.php b/tests/Integration/Concurrency/Console/InvokeSerializedClosureCommandTest.php index f538aacb8492..a26404ffabca 100644 --- a/tests/Integration/Concurrency/Console/InvokeSerializedClosureCommandTest.php +++ b/tests/Integration/Concurrency/Console/InvokeSerializedClosureCommandTest.php @@ -48,7 +48,7 @@ public function testItCanInvokeSerializedClosureFromArgument() // Verify the result $this->assertTrue($result['successful']); - $this->assertEquals('Hello, World!', unserialize($result['result'])); + $this->assertSame('Hello, World!', unserialize($result['result'])); } public function testItCanInvokeSerializedClosureFromEnvironment() @@ -71,7 +71,7 @@ public function testItCanInvokeSerializedClosureFromEnvironment() // Verify the result $this->assertTrue($result['successful']); - $this->assertEquals('From Environment', unserialize($result['result'])); + $this->assertSame('From Environment', unserialize($result['result'])); // Clean up unset($_SERVER['LARAVEL_INVOKABLE_CLOSURE']); @@ -112,8 +112,8 @@ public function testItHandlesExceptionsGracefully() // Verify the exception was caught $this->assertFalse($result['successful']); - $this->assertEquals('RuntimeException', $result['exception']); - $this->assertEquals('Test exception', $result['message']); + $this->assertSame('RuntimeException', $result['exception']); + $this->assertSame('Test exception', $result['message']); } public function testItHandlesCustomExceptionWithParameters() @@ -136,6 +136,6 @@ public function testItHandlesCustomExceptionWithParameters() // Verify the exception was caught and parameters were captured $this->assertFalse($result['successful']); $this->assertArrayHasKey('parameters', $result); - $this->assertEquals('Test param', $result['parameters']['customParam'] ?? null); + $this->assertSame('Test param', $result['parameters']['customParam'] ?? null); } } diff --git a/tests/Integration/Container/BuildableIntegrationTest.php b/tests/Integration/Container/BuildableIntegrationTest.php index 4fec6a7b611f..6f658ef179f7 100644 --- a/tests/Integration/Container/BuildableIntegrationTest.php +++ b/tests/Integration/Container/BuildableIntegrationTest.php @@ -26,9 +26,9 @@ public function test_build_method_can_resolve_itself_via_container(): void $config = $this->app->make(AolInstantMessengerConfig::class); $this->assertEquals(500, $config->awayMessageDuration); - $this->assertEquals('sad emo lyrics', $config->awayMessage); - $this->assertEquals('api-key', $config->apiKey); - $this->assertEquals('cosmastech', $config->userName); + $this->assertSame('sad emo lyrics', $config->awayMessage); + $this->assertSame('api-key', $config->apiKey); + $this->assertSame('cosmastech', $config->userName); config(['aim.away_message.duration' => 5]); diff --git a/tests/Integration/Container/ContextualAttributesBindingIntegrationTest.php b/tests/Integration/Container/ContextualAttributesBindingIntegrationTest.php index 084373f55f6c..f3e4caccc6c4 100644 --- a/tests/Integration/Container/ContextualAttributesBindingIntegrationTest.php +++ b/tests/Integration/Container/ContextualAttributesBindingIntegrationTest.php @@ -31,10 +31,10 @@ public function testLogAttributeCanSetName() $records = new Collection($testHandler->getRecords()); $this->assertCount(2, $records); - $this->assertEquals('hello', $records->firstWhere(function (LogRecord $record) { + $this->assertSame('hello', $records->firstWhere(function (LogRecord $record) { return $record->channel === 'testing'; })->message); - $this->assertEquals('bye', $records->firstWhere(function (LogRecord $record) { + $this->assertSame('bye', $records->firstWhere(function (LogRecord $record) { return $record->channel === 'look-ma-a-channel-name'; })->message); } diff --git a/tests/Integration/Database/EloquentCursorPaginateTest.php b/tests/Integration/Database/EloquentCursorPaginateTest.php index 2d5308161490..08ae3eedaa85 100644 --- a/tests/Integration/Database/EloquentCursorPaginateTest.php +++ b/tests/Integration/Database/EloquentCursorPaginateTest.php @@ -202,10 +202,10 @@ public function testPaginationWithMultipleUnionAndMultipleWhereClauses() $this->assertSame(['id'], $result->getOptions()['parameters']); $postB = $table2->where('id', '>', 1)->first(); - $this->assertEquals('Post B', $postB->title, 'Expect `Post B` is the result of the second query'); + $this->assertSame('Post B', $postB->title, 'Expect `Post B` is the result of the second query'); $this->assertCount(1, $result->items(), 'Expect cursor paginated query should have 1 result'); - $this->assertEquals('Post B', current($result->items())->title, 'Expect the paginated query would return `Post B`'); + $this->assertSame('Post B', current($result->items())->title, 'Expect the paginated query would return `Post B`'); } public function testPaginationWithMultipleAliases() @@ -232,7 +232,7 @@ public function testPaginationWithMultipleAliases() $this->assertSame(['alias'], $result->getOptions()['parameters']); $this->assertCount(1, $result->items(), 'Expect cursor paginated query should have 1 result'); - $this->assertEquals('B (post)', current($result->items())->alias, 'Expect the paginated query would return `B (post)`'); + $this->assertSame('B (post)', current($result->items())->alias, 'Expect the paginated query would return `B (post)`'); } public function testPaginationWithAliasedOrderBy() diff --git a/tests/Integration/Database/EloquentDeleteTest.php b/tests/Integration/Database/EloquentDeleteTest.php index 6145417f9107..c5d95c7e3fc2 100644 --- a/tests/Integration/Database/EloquentDeleteTest.php +++ b/tests/Integration/Database/EloquentDeleteTest.php @@ -133,7 +133,7 @@ public function testDeleteQuietly() $post = Post::query()->create([]); $result = $post->deleteQuietly(); - $this->assertEquals('\(^_^)/', $_SERVER['(-_-)']); + $this->assertSame('\(^_^)/', $_SERVER['(-_-)']); $this->assertTrue($result); $this->assertFalse($post->exists); @@ -144,7 +144,7 @@ public function testDeleteQuietly() $role = Role::create([]); $result = $role->deleteQuietly(); $this->assertTrue($result); - $this->assertEquals('\(^_^)/', $_SERVER['(-_-)']); + $this->assertSame('\(^_^)/', $_SERVER['(-_-)']); unset($_SERVER['(-_-)']); } diff --git a/tests/Integration/Database/EloquentHasManyThroughTest.php b/tests/Integration/Database/EloquentHasManyThroughTest.php index 606f20f9ab9b..2e50c56cdf5c 100644 --- a/tests/Integration/Database/EloquentHasManyThroughTest.php +++ b/tests/Integration/Database/EloquentHasManyThroughTest.php @@ -196,8 +196,8 @@ public function testFirstOrCreateWhenModelDoesntExist() $this->assertTrue($mate->wasRecentlyCreated); $this->assertNull($mate->team_id); - $this->assertEquals('Adam', $mate->name); - $this->assertEquals('adam', $mate->slug); + $this->assertSame('Adam', $mate->name); + $this->assertSame('adam', $mate->slug); } public function testFirstOrCreateWhenModelExists() @@ -212,8 +212,8 @@ public function testFirstOrCreateWhenModelExists() $this->assertFalse($mate->wasRecentlyCreated); $this->assertNotNull($mate->team_id); $this->assertTrue($team->is($mate->team)); - $this->assertEquals('Adam Wathan', $mate->name); - $this->assertEquals('adam', $mate->slug); + $this->assertSame('Adam Wathan', $mate->name); + $this->assertSame('adam', $mate->slug); } public function testFirstOrCreateRegressionIssue() @@ -234,8 +234,8 @@ public function testFirstOrCreateRegressionIssue() $this->assertFalse($newJohn->wasRecentlyCreated); $this->assertTrue($john->is($newJohn)); - $this->assertEquals('john', $newJohn->refresh()->slug); - $this->assertEquals('John', $newJohn->name); + $this->assertSame('john', $newJohn->refresh()->slug); + $this->assertSame('John', $newJohn->name); $this->assertSame('john', $john->refresh()->slug); $this->assertSame('John', $john->name); @@ -254,7 +254,7 @@ public function testCreateOrFirstWhenRecordDoesntExist() ); $this->assertTrue($article->wasRecentlyCreated); - $this->assertEquals('Laravel Forever', $article->title); + $this->assertSame('Laravel Forever', $article->title); $this->assertTrue($tony->is($article->user)); } @@ -274,7 +274,7 @@ public function testCreateOrFirstWhenRecordExists() ); $this->assertFalse($newArticle->wasRecentlyCreated); - $this->assertEquals('Laravel Forever', $newArticle->title); + $this->assertSame('Laravel Forever', $newArticle->title); $this->assertTrue($taylor->is($newArticle->user)); $this->assertTrue($existingArticle->is($newArticle)); } @@ -295,7 +295,7 @@ public function testCreateOrFirstWhenRecordExistsInTransaction() )); $this->assertFalse($newArticle->wasRecentlyCreated); - $this->assertEquals('Laravel Forever', $newArticle->title); + $this->assertSame('Laravel Forever', $newArticle->title); $this->assertTrue($taylor->is($newArticle->user)); $this->assertTrue($existingArticle->is($newArticle)); } @@ -317,7 +317,7 @@ public function testCreateOrFirstRegressionIssue() $this->assertFalse($newArticle->wasRecentlyCreated); $this->assertTrue($existingTaylorArticle->is($newArticle)); - $this->assertEquals('Laravel Forever', $newArticle->refresh()->title); + $this->assertSame('Laravel Forever', $newArticle->refresh()->title); $this->assertTrue($taylor->is($newArticle->user)); $this->assertSame('Laravel Forever', $existingTaylorArticle->refresh()->title); diff --git a/tests/Integration/Database/EloquentPivotEventsTest.php b/tests/Integration/Database/EloquentPivotEventsTest.php index 8521b948e8e9..dc7984c52cba 100644 --- a/tests/Integration/Database/EloquentPivotEventsTest.php +++ b/tests/Integration/Database/EloquentPivotEventsTest.php @@ -113,7 +113,7 @@ public function testPivotWithPivotCriteriaTriggerEventsToBeFiredOnCreateUpdateNo PivotEventsTestCollaborator::$eventsCalled = []; $project->contributors()->detach($user->id); - $this->assertEquals([], PivotEventsTestCollaborator::$eventsCalled); + $this->assertSame([], PivotEventsTestCollaborator::$eventsCalled); } public function testCustomPivotUpdateEventHasExistingAttributes() diff --git a/tests/Integration/Database/EloquentUpdateTest.php b/tests/Integration/Database/EloquentUpdateTest.php index 55b5934e15dc..0df53a53f301 100644 --- a/tests/Integration/Database/EloquentUpdateTest.php +++ b/tests/Integration/Database/EloquentUpdateTest.php @@ -269,7 +269,7 @@ public function testIncrementEachDoesNotResetUnrelatedDirtyAttributes() $post->incrementEach(['views' => 1]); $this->assertTrue($post->isDirty('name')); - $this->assertEquals('Changed', $post->name); + $this->assertSame('Changed', $post->name); $this->assertFalse($post->isDirty('views')); } diff --git a/tests/Integration/Database/EloquentWhereTest.php b/tests/Integration/Database/EloquentWhereTest.php index ff6c66595086..0d4fcb7e37d7 100644 --- a/tests/Integration/Database/EloquentWhereTest.php +++ b/tests/Integration/Database/EloquentWhereTest.php @@ -298,7 +298,7 @@ public function testSoleValue() 'address' => 'test-address', ]); - $this->assertEquals('test-name', UserWhereTest::where('name', 'test-name')->soleValue('name')); + $this->assertSame('test-name', UserWhereTest::where('name', 'test-name')->soleValue('name')); } public function testChunkMap() diff --git a/tests/Integration/Database/MariaDb/DatabaseMariaDbSchemaBuilderTest.php b/tests/Integration/Database/MariaDb/DatabaseMariaDbSchemaBuilderTest.php index c018f2956707..f0a8f0dffb53 100644 --- a/tests/Integration/Database/MariaDb/DatabaseMariaDbSchemaBuilderTest.php +++ b/tests/Integration/Database/MariaDb/DatabaseMariaDbSchemaBuilderTest.php @@ -25,7 +25,7 @@ public function testAddCommentToTable() ->select('table_comment as table_comment') ->first(); - $this->assertEquals('This is a comment', $tableInfo->table_comment); + $this->assertSame('This is a comment', $tableInfo->table_comment); Schema::drop('users'); } diff --git a/tests/Integration/Database/ModelInspectorTest.php b/tests/Integration/Database/ModelInspectorTest.php index ec64035bd7b4..b4d10411e78f 100644 --- a/tests/Integration/Database/ModelInspectorTest.php +++ b/tests/Integration/Database/ModelInspectorTest.php @@ -58,7 +58,7 @@ private function assertModelInfo(ModelInfo|array $modelInfo) { $this->assertEquals(ModelInspectorTestModel::class, $modelInfo['class']); $this->assertEquals(Schema::getConnection()->getConfig()['name'], $modelInfo['database']); - $this->assertEquals('model_info_extractor_test_model', $modelInfo['table']); + $this->assertSame('model_info_extractor_test_model', $modelInfo['table']); $this->assertNull($modelInfo['policy']); $this->assertCount(8, $modelInfo['attributes']); @@ -167,9 +167,9 @@ private function assertModelInfo(ModelInfo|array $modelInfo) $this->assertEmpty($modelInfo['events']); $this->assertCount(1, $modelInfo['observers']); - $this->assertEquals('created', $modelInfo['observers'][0]['event']); + $this->assertSame('created', $modelInfo['observers'][0]['event']); $this->assertCount(1, $modelInfo['observers'][0]['observer']); - $this->assertEquals("Illuminate\Tests\Integration\Database\ModelInspectorTestModelObserver@created", $modelInfo['observers'][0]['observer'][0]); + $this->assertSame("Illuminate\Tests\Integration\Database\ModelInspectorTestModelObserver@created", $modelInfo['observers'][0]['observer'][0]); $this->assertEquals(ModelInspectorTestModelEloquentCollection::class, $modelInfo['collection']); $this->assertEquals(ModelInspectorTestModelBuilder::class, $modelInfo['builder']); } diff --git a/tests/Integration/Database/MySql/DatabaseMySqlSchemaBuilderTest.php b/tests/Integration/Database/MySql/DatabaseMySqlSchemaBuilderTest.php index 949ec4819185..022045f4e741 100644 --- a/tests/Integration/Database/MySql/DatabaseMySqlSchemaBuilderTest.php +++ b/tests/Integration/Database/MySql/DatabaseMySqlSchemaBuilderTest.php @@ -26,7 +26,7 @@ public function testAddCommentToTable() ->select('table_comment as table_comment') ->first(); - $this->assertEquals('This is a comment', $tableInfo->table_comment); + $this->assertSame('This is a comment', $tableInfo->table_comment); Schema::drop('users'); } diff --git a/tests/Integration/Database/Postgres/PostgresSchemaBuilderTest.php b/tests/Integration/Database/Postgres/PostgresSchemaBuilderTest.php index 6d2308fb9d41..fe8e4125f85c 100644 --- a/tests/Integration/Database/Postgres/PostgresSchemaBuilderTest.php +++ b/tests/Integration/Database/Postgres/PostgresSchemaBuilderTest.php @@ -117,7 +117,7 @@ public function testAddTableCommentOnNewTable() $table->comment('This is a comment'); }); - $this->assertEquals('This is a comment', DB::selectOne("select obj_description('public.posts'::regclass, 'pg_class')")->obj_description); + $this->assertSame('This is a comment', DB::selectOne("select obj_description('public.posts'::regclass, 'pg_class')")->obj_description); } public function testAddTableCommentOnExistingTable() @@ -131,7 +131,7 @@ public function testAddTableCommentOnExistingTable() $table->comment('This is a new comment'); }); - $this->assertEquals('This is a new comment', DB::selectOne("select obj_description('public.posts'::regclass, 'pg_class')")->obj_description); + $this->assertSame('This is a new comment', DB::selectOne("select obj_description('public.posts'::regclass, 'pg_class')")->obj_description); } public function testGetTables() diff --git a/tests/Integration/Database/QueryBuilderTest.php b/tests/Integration/Database/QueryBuilderTest.php index 57a1593dac69..65eed4dfb630 100644 --- a/tests/Integration/Database/QueryBuilderTest.php +++ b/tests/Integration/Database/QueryBuilderTest.php @@ -138,8 +138,8 @@ public function testIncrement() $rows = DB::table('accounting')->get(); - $this->assertEquals(1.5, $rows[0]->wallet_1); - $this->assertEquals(1.5, $rows[1]->wallet_1); + $this->assertSame(1.5, (float) $rows[0]->wallet_1); + $this->assertSame(1.5, (float) $rows[1]->wallet_1); Schema::drop('accounting'); } diff --git a/tests/Integration/Database/SchemaBuilderSchemaNameTest.php b/tests/Integration/Database/SchemaBuilderSchemaNameTest.php index c2ec3e57c392..364b68c6c231 100644 --- a/tests/Integration/Database/SchemaBuilderSchemaNameTest.php +++ b/tests/Integration/Database/SchemaBuilderSchemaNameTest.php @@ -526,16 +526,16 @@ public function testComment($connection) $tableName = $connection === 'with-prefix' ? 'example_table' : 'table'; $defaultSchema = $this->driver === 'pgsql' ? 'public' : 'laravel'; - $this->assertEquals('comment on schema table', + $this->assertSame('comment on schema table', $tables->first(fn ($table) => $table['name'] === $tableName && $table['schema'] === 'my_schema')['comment'] ); - $this->assertEquals('comment on table', + $this->assertSame('comment on table', $tables->first(fn ($table) => $table['name'] === $tableName && $table['schema'] === $defaultSchema)['comment'] ); - $this->assertEquals('comment on schema column', + $this->assertSame('comment on schema column', collect($schema->getColumns('my_schema.table'))->firstWhere('name', 'name')['comment'] ); - $this->assertEquals('comment on column', + $this->assertSame('comment on column', collect($schema->getColumns('table'))->firstWhere('name', 'name')['comment'] ); } @@ -579,7 +579,7 @@ public function testHasTable($connection) 'database.connections.'.$connection.'.password' => 'Passw0rd', ]); - $this->assertEquals('my_schema', $schema->getCurrentSchemaName()); + $this->assertSame('my_schema', $schema->getCurrentSchemaName()); $schema->create('table', function (Blueprint $table) { $table->id(); diff --git a/tests/Integration/Database/SchemaBuilderTest.php b/tests/Integration/Database/SchemaBuilderTest.php index 1628a5b7ac76..3e7a6e68e3c7 100644 --- a/tests/Integration/Database/SchemaBuilderTest.php +++ b/tests/Integration/Database/SchemaBuilderTest.php @@ -793,7 +793,7 @@ public function testAddingMacros() { Schema::macro('foo', fn () => 'foo'); - $this->assertEquals('foo', Schema::foo()); + $this->assertSame('foo', Schema::foo()); Schema::macro('hasForeignKeyForColumn', function (string $column, string $table, string $foreignTable) { return collect(Schema::getForeignKeys($table)) diff --git a/tests/Integration/Database/Sqlite/DatabaseSqliteSchemaBuilderTest.php b/tests/Integration/Database/Sqlite/DatabaseSqliteSchemaBuilderTest.php index f9ef9c11a46b..694b8af4b25a 100644 --- a/tests/Integration/Database/Sqlite/DatabaseSqliteSchemaBuilderTest.php +++ b/tests/Integration/Database/Sqlite/DatabaseSqliteSchemaBuilderTest.php @@ -72,7 +72,7 @@ public function testGetViews() $tableView = Schema::getViews(); $this->assertCount(1, $tableView); - $this->assertEquals('users_view', $tableView[0]['name']); + $this->assertSame('users_view', $tableView[0]['name']); DB::connection('conn1')->statement(<<<'SQL' DROP VIEW IF EXISTS users_view; diff --git a/tests/Integration/Events/DeferEventsTest.php b/tests/Integration/Events/DeferEventsTest.php index 861e31c441db..59aaf29c9ac2 100644 --- a/tests/Integration/Events/DeferEventsTest.php +++ b/tests/Integration/Events/DeferEventsTest.php @@ -24,7 +24,7 @@ public function testDeferEvents() return 'callback_result'; }); - $this->assertEquals('callback_result', $response); + $this->assertSame('callback_result', $response); $this->assertSame('bar', $_SERVER['__event.test']); } @@ -45,7 +45,7 @@ public function testDeferModelEvents() return 'model_event_response'; }); - $this->assertEquals('model_event_response', $response); + $this->assertSame('model_event_response', $response); $this->assertContains('saved', $_SERVER['__model_event.test']); } @@ -74,7 +74,7 @@ public function testDeferMultipleModelEvents() return 'multiple_models_response'; }); - $this->assertEquals('multiple_models_response', $response); + $this->assertSame('multiple_models_response', $response); $this->assertSame(['saved:TestModel', 'created:AnotherTestModel'], $_SERVER['__model_events']); } @@ -100,7 +100,7 @@ public function testDeferSpecificModelEvents() return 'specific_model_defer_result'; }, ['eloquent.saved: '.TestModel::class]); - $this->assertEquals('specific_model_defer_result', $response); + $this->assertSame('specific_model_defer_result', $response); $this->assertSame(['creating', 'saved'], $_SERVER['__model_events']); } } diff --git a/tests/Integration/Events/EventFakeTest.php b/tests/Integration/Events/EventFakeTest.php index 319703f0c827..e4eee6420124 100644 --- a/tests/Integration/Events/EventFakeTest.php +++ b/tests/Integration/Events/EventFakeTest.php @@ -183,7 +183,7 @@ public function testMissingMethodsAreForwarded() { Event::macro('foo', fn () => 'bar'); - $this->assertEquals('bar', Event::fake()->foo()); + $this->assertSame('bar', Event::fake()->foo()); } public function testShouldDispatchAfterCommitEventsAreNotDispatchedIfTransactionFails() diff --git a/tests/Integration/Filesystem/ServeFileTest.php b/tests/Integration/Filesystem/ServeFileTest.php index 89e5f8a8f131..5b6a2f2859fd 100644 --- a/tests/Integration/Filesystem/ServeFileTest.php +++ b/tests/Integration/Filesystem/ServeFileTest.php @@ -29,7 +29,7 @@ public function testItCanServeAnExistingFile() $response = $this->get($url); - $this->assertEquals('Hello World', $response->streamedContent()); + $this->assertSame('Hello World', $response->streamedContent()); } public function testItWill404OnMissingFile() diff --git a/tests/Integration/Foundation/CloudTest.php b/tests/Integration/Foundation/CloudTest.php index ad6e35b55752..3896a7f0bc31 100644 --- a/tests/Integration/Foundation/CloudTest.php +++ b/tests/Integration/Foundation/CloudTest.php @@ -48,8 +48,8 @@ public function test_it_can_configure_disks() Cloud::configureDisks($this->app); - $this->assertEquals('test-disk-2', $this->app['config']->get('filesystems.default')); - $this->assertEquals('test-access-key-id', $this->app['config']->get('filesystems.disks.test-disk.key')); + $this->assertSame('test-disk-2', $this->app['config']->get('filesystems.default')); + $this->assertSame('test-access-key-id', $this->app['config']->get('filesystems.disks.test-disk.key')); unset($_SERVER['LARAVEL_CLOUD_DISK_CONFIG']); } @@ -79,7 +79,7 @@ public function test_it_respects_log_levels() Cloud::configureCloudLogging($this->app); - $this->assertEquals('notice', $this->app['config']->get('logging.channels.laravel-cloud-socket.level')); + $this->assertSame('notice', $this->app['config']->get('logging.channels.laravel-cloud-socket.level')); unset($_SERVER['LOG_LEVEL']); diff --git a/tests/Integration/Foundation/DiscoverEventsTest.php b/tests/Integration/Foundation/DiscoverEventsTest.php index 417358539e24..bdf864b1f0eb 100644 --- a/tests/Integration/Foundation/DiscoverEventsTest.php +++ b/tests/Integration/Foundation/DiscoverEventsTest.php @@ -81,7 +81,7 @@ public function testNoExceptionForEmptyDirectories(): void { $events = DiscoverEvents::within([], getcwd()); - $this->assertEquals([], $events); + $this->assertSame([], $events); } public function testEventsCanBeDiscoveredUsingCustomClassNameGuessing() diff --git a/tests/Integration/Foundation/ExceptionHandlerTest.php b/tests/Integration/Foundation/ExceptionHandlerTest.php index 0b0f22a5354b..900c03510069 100644 --- a/tests/Integration/Foundation/ExceptionHandlerTest.php +++ b/tests/Integration/Foundation/ExceptionHandlerTest.php @@ -74,7 +74,7 @@ public function toResponse($request) ->assertStatus(500) ->assertSee('shouldnt report'); - $this->assertEquals([], $reported); + $this->assertSame([], $reported); } public function testItRendersAuthorizationExceptionsWithCustomStatusCode() diff --git a/tests/Integration/Foundation/FoundationHelpersTest.php b/tests/Integration/Foundation/FoundationHelpersTest.php index a55e6c73cf42..7ea8ec98ff82 100644 --- a/tests/Integration/Foundation/FoundationHelpersTest.php +++ b/tests/Integration/Foundation/FoundationHelpersTest.php @@ -13,14 +13,14 @@ class FoundationHelpersTest extends TestCase { public function testRescue() { - $this->assertEquals( + $this->assertSame( 'rescued!', rescue(function () { throw new Exception; }, 'rescued!') ); - $this->assertEquals( + $this->assertSame( 'rescued!', rescue(function () { throw new Exception; @@ -29,7 +29,7 @@ public function testRescue() }) ); - $this->assertEquals( + $this->assertSame( 'no need to rescue', rescue(function () { return 'no need to rescue'; @@ -44,7 +44,7 @@ public function test(int $a) } }; - $this->assertEquals( + $this->assertSame( 'rescued!', rescue(function () use ($testClass) { $testClass->test([]); diff --git a/tests/Integration/Http/HttpClientTest.php b/tests/Integration/Http/HttpClientTest.php index 7e49fc10aa80..d152c7455ba4 100644 --- a/tests/Integration/Http/HttpClientTest.php +++ b/tests/Integration/Http/HttpClientTest.php @@ -86,8 +86,8 @@ public function testForwardsCallsToPromise() }) ->wait(); - $this->assertEquals('faked response', $myFakedResponse); - $this->assertEquals('stub', $r); + $this->assertSame('faked response', (string) $myFakedResponse); + $this->assertSame('stub', $r); } public function testCanSetRequestAttributes() @@ -105,10 +105,10 @@ public function testCanSetRequestAttributes() $response3 = Http::get('https://some-store.myshopify.com/admin/api/2025-10/graphql.json'); $response4 = Http::withAttributes(['name' => 'fourth'])->get('https://some-store.myshopify.com/admin/api/2025-10/graphql.json'); - $this->assertEquals('first response', $response1->body()); - $this->assertEquals('second response', $response2->body()); - $this->assertEquals('unnamed', $response3->body()); - $this->assertEquals('unnamed', $response4->body()); + $this->assertSame('first response', $response1->body()); + $this->assertSame('second response', $response2->body()); + $this->assertSame('unnamed', $response3->body()); + $this->assertSame('unnamed', $response4->body()); } public function testAsyncCanHandleThrownException() diff --git a/tests/Integration/Http/ResourceTest.php b/tests/Integration/Http/ResourceTest.php index f872ccba0140..5e468aa400d3 100644 --- a/tests/Integration/Http/ResourceTest.php +++ b/tests/Integration/Http/ResourceTest.php @@ -907,7 +907,7 @@ public function testResourcesMayCustomizeJsonOptions() '/', ['Accept' => 'application/json'] ); - $this->assertEquals( + $this->assertSame( '{"data":{"id":5,"title":"Test Title","reading_time":3.0}}', $response->baseResponse->content() ); @@ -925,7 +925,7 @@ public function testCollectionResourcesMayCustomizeJsonOptions() '/', ['Accept' => 'application/json'] ); - $this->assertEquals( + $this->assertSame( '{"data":[{"id":5,"title":"Test Title","reading_time":3.0}]}', $response->baseResponse->content() ); @@ -946,7 +946,7 @@ public function testResourcesMayCustomizeJsonOptionsOnPaginatedResponse() '/', ['Accept' => 'application/json'] ); - $this->assertEquals( + $this->assertSame( '{"data":[{"id":5,"title":"Test Title","reading_time":3.0}],"links":{"first":"\/?page=1","last":"\/?page=1","prev":null,"next":null},"meta":{"current_page":1,"from":1,"last_page":1,"links":[{"url":null,"label":"« Previous","page":null,"active":false},{"url":"\/?page=1","label":"1","page":1,"active":true},{"url":null,"label":"Next »","page":null,"active":false}],"path":"\/","per_page":15,"to":1,"total":10}}', $response->baseResponse->content() ); @@ -966,7 +966,7 @@ public function testResourcesMayCustomizeJsonOptionsWithTypeHintedConstructor() '/', ['Accept' => 'application/json'] ); - $this->assertEquals( + $this->assertSame( '{"data":{"id":5,"title":"Test Title","reading_time":3.0}}', $response->baseResponse->content() ); diff --git a/tests/Integration/Log/ContextIntegrationTest.php b/tests/Integration/Log/ContextIntegrationTest.php index 2d7fe074f0e5..59a4c6966a07 100644 --- a/tests/Integration/Log/ContextIntegrationTest.php +++ b/tests/Integration/Log/ContextIntegrationTest.php @@ -20,7 +20,7 @@ class ContextIntegrationTest extends TestCase public function test_it_can_hydrate_null() { Context::hydrate(null); - $this->assertEquals([], Context::all()); + $this->assertSame([], Context::all()); } public function test_it_handles_eloquent() diff --git a/tests/Integration/Queue/DebouncedJobTest.php b/tests/Integration/Queue/DebouncedJobTest.php index 0c36149613c3..6068f7fe35d1 100644 --- a/tests/Integration/Queue/DebouncedJobTest.php +++ b/tests/Integration/Queue/DebouncedJobTest.php @@ -131,7 +131,7 @@ public function testDebounceOwnerSurvivesSerialization() $restored = unserialize(serialize($job)); - $this->assertEquals('test-owner-token-123', $restored->debounceOwner); + $this->assertSame('test-owner-token-123', $restored->debounceOwner); } public function testDifferentDebounceIdsDoNotInterfere() diff --git a/tests/Integration/Queue/JobChainingTest.php b/tests/Integration/Queue/JobChainingTest.php index 8cf10be0e966..02ca6a4d9902 100644 --- a/tests/Integration/Queue/JobChainingTest.php +++ b/tests/Integration/Queue/JobChainingTest.php @@ -653,7 +653,7 @@ public function testChainConditionable() $chain->onConnection('sync2'); }); - $this->assertEquals('sync2', $chain->connection); + $this->assertSame('sync2', $chain->connection); $chain = Bus::chain([]) ->onConnection('sync1') @@ -661,7 +661,7 @@ public function testChainConditionable() $chain->onConnection('sync2'); }); - $this->assertEquals('sync1', $chain->connection); + $this->assertSame('sync1', $chain->connection); } public function testBatchConditionable() @@ -672,14 +672,14 @@ public function testBatchConditionable() $batch->onConnection('sync2'); }); - $this->assertEquals('sync2', $batch->connection()); + $this->assertSame('sync2', $batch->connection()); $batch = Bus::batch([]) ->onConnection('sync1') ->when(false, function (PendingBatch $batch) { $batch->onConnection('sync2'); }); - $this->assertEquals('sync1', $batch->connection()); + $this->assertSame('sync1', $batch->connection()); } public function testJobsAreChainedWhenDispatchIfIsTrue() diff --git a/tests/Integration/Queue/ModelSerializationTest.php b/tests/Integration/Queue/ModelSerializationTest.php index 1fa68472821c..9eff3448bebb 100644 --- a/tests/Integration/Queue/ModelSerializationTest.php +++ b/tests/Integration/Queue/ModelSerializationTest.php @@ -469,7 +469,7 @@ public function test_it_respects_without_relations_attribute_applied_to_class() $unserialized = unserialize($serialized); $this->assertFalse($unserialized->user->relationLoaded('roles')); - $this->assertEquals('hello', $unserialized->value->value); + $this->assertSame('hello', $unserialized->value->value); } #[WithConfig('database.default', 'testing')] @@ -485,7 +485,7 @@ public function test_it_respects_without_relations_attribute_applied_to_parent_c $unserialized = unserialize($serialized); $this->assertFalse($unserialized->user->relationLoaded('roles')); - $this->assertEquals('hello', $unserialized->value->value); + $this->assertSame('hello', $unserialized->value->value); } public function test_serialization_types_empty_custom_eloquent_collection() diff --git a/tests/Integration/Queue/QueueFakeTest.php b/tests/Integration/Queue/QueueFakeTest.php index 62d416c3da6c..8ed86476136f 100644 --- a/tests/Integration/Queue/QueueFakeTest.php +++ b/tests/Integration/Queue/QueueFakeTest.php @@ -46,7 +46,7 @@ public function testFakeForReturnValue() return 'test-value'; }); - $this->assertEquals('test-value', $result); + $this->assertSame('test-value', $result); } public function testFakeExceptForReturnValue() @@ -55,7 +55,7 @@ public function testFakeExceptForReturnValue() return 'test-value'; }, []); - $this->assertEquals('test-value', $result); + $this->assertSame('test-value', $result); } } diff --git a/tests/Integration/Queue/UniqueJobTest.php b/tests/Integration/Queue/UniqueJobTest.php index 978826fad225..9a7c84fb7419 100644 --- a/tests/Integration/Queue/UniqueJobTest.php +++ b/tests/Integration/Queue/UniqueJobTest.php @@ -246,7 +246,7 @@ public function testLockUsesDisplayNameWhenAvailable() public function testUniqueLockCreatesKeyWithClassName() { - $this->assertEquals( + $this->assertSame( 'laravel_unique_job:'.UniqueTestJob::class.':', UniqueLock::getKey(new UniqueTestJob) ); @@ -254,7 +254,7 @@ public function testUniqueLockCreatesKeyWithClassName() public function testUniqueLockCreatesKeyWithIdAndClassName() { - $this->assertEquals( + $this->assertSame( 'laravel_unique_job:'.UniqueIdTestJob::class.':unique-id-1', UniqueLock::getKey(new UniqueIdTestJob) ); @@ -262,7 +262,7 @@ public function testUniqueLockCreatesKeyWithIdAndClassName() public function testUniqueLockCreatesKeyWithDisplayNameWhenAvailable() { - $this->assertEquals( + $this->assertSame( 'laravel_unique_job:'.hash('xxh128', 'App\\Actions\\UniqueTestAction').':unique-id-2', UniqueLock::getKey(new UniqueIdTestJobWithDisplayName) ); @@ -270,7 +270,7 @@ public function testUniqueLockCreatesKeyWithDisplayNameWhenAvailable() public function testUniqueLockCreatesKeyWithIdAndDisplayNameWhenAvailable() { - $this->assertEquals( + $this->assertSame( 'laravel_unique_job:'.hash('xxh128', 'App\\Actions\\UniqueTestAction').':unique-id-2', UniqueLock::getKey(new UniqueIdTestJobWithDisplayName) ); diff --git a/tests/Integration/Routing/RouteViewTest.php b/tests/Integration/Routing/RouteViewTest.php index 88fc61081ea9..520f501f5833 100644 --- a/tests/Integration/Routing/RouteViewTest.php +++ b/tests/Integration/Routing/RouteViewTest.php @@ -28,15 +28,15 @@ public function testRouteViewWithParams() $this->assertStringContainsString('Test bar', $this->get('/route/value1')->getContent()); tap($this->get('/route/value1/value2'), function ($response) { - $this->assertEquals('value1', $response->viewData('param')); - $this->assertEquals('value1', $response->baseRequest->route('param')); - $this->assertEquals('value2', $response->baseRequest->route('param2')); + $this->assertSame('value1', $response->viewData('param')); + $this->assertSame('value1', $response->baseRequest->route('param')); + $this->assertSame('value2', $response->baseRequest->route('param2')); }); tap($this->get('/route/value1/value2'), function ($response) { - $this->assertEquals('value2', $response->viewData('param2')); - $this->assertEquals('value1', $response->baseRequest->route('param')); - $this->assertEquals('value2', $response->baseRequest->route('param2')); + $this->assertSame('value2', $response->viewData('param2')); + $this->assertSame('value1', $response->baseRequest->route('param')); + $this->assertSame('value2', $response->baseRequest->route('param2')); }); } diff --git a/tests/Integration/Session/DatabaseSessionHandlerTest.php b/tests/Integration/Session/DatabaseSessionHandlerTest.php index 950e11a889c8..fb2690f50577 100644 --- a/tests/Integration/Session/DatabaseSessionHandlerTest.php +++ b/tests/Integration/Session/DatabaseSessionHandlerTest.php @@ -17,7 +17,7 @@ public function test_basic_read_write_functionality() $handler->setContainer($this->app); // read non-existing session id: - $this->assertEquals('', $handler->read('invalid_session_id')); + $this->assertSame('', $handler->read('invalid_session_id')); // open and close: $this->assertTrue($handler->open('', '')); @@ -47,7 +47,7 @@ public function test_basic_read_write_functionality() // read expired: Carbon::setTestNow(Carbon::now()->addMinutes(2)); - $this->assertEquals('', $handler->read('valid_session_id_2425')); + $this->assertSame('', $handler->read('valid_session_id_2425')); // rewriting an expired session-id, makes it live: $this->assertTrue($handler->write('valid_session_id_2425', json_encode(['come' => 'alive']))); @@ -103,7 +103,7 @@ public function test_it_can_work_without_container() // write and read: $this->assertTrue($handler->write('session_id', 'some data')); - $this->assertEquals('some data', $handler->read('session_id')); + $this->assertSame('some data', $handler->read('session_id')); $this->assertEquals(1, $connection->table('sessions')->count()); $session = $connection->table('sessions')->first(); diff --git a/tests/Log/LogLoggerTest.php b/tests/Log/LogLoggerTest.php index 23b71f68e367..c887e1d8f3fe 100755 --- a/tests/Log/LogLoggerTest.php +++ b/tests/Log/LogLoggerTest.php @@ -80,7 +80,7 @@ public function testLoggerFiresEventsDispatcher() $this->assertSame('foo', $_SERVER['__log.message']); unset($_SERVER['__log.message']); $this->assertTrue(isset($_SERVER['__log.context'])); - $this->assertEquals([], $_SERVER['__log.context']); + $this->assertSame([], $_SERVER['__log.context']); unset($_SERVER['__log.context']); } diff --git a/tests/Log/LogManagerTest.php b/tests/Log/LogManagerTest.php index 3345328a73d2..8cf0b9391011 100755 --- a/tests/Log/LogManagerTest.php +++ b/tests/Log/LogManagerTest.php @@ -47,7 +47,7 @@ public function testLogManagerGetDefaultDriver() //we don't specify any channel name $manager->channel(); $this->assertCount(1, $manager->getChannels()); - $this->assertEquals('single', $manager->getDefaultDriver()); + $this->assertSame('single', $manager->getDefaultDriver()); } public function testStackChannel() @@ -726,7 +726,7 @@ public function testLogManagerCreateCustomFormatterWithTap() $format = new ReflectionProperty(get_class($formatter), 'format'); - $this->assertEquals( + $this->assertSame( '[%datetime%] %channel%.%level_name%: %message% %context% %extra%', rtrim($format->getValue($formatter))); } @@ -750,7 +750,7 @@ public function testDriverUsersPsrLoggerManagerReturnsLogger() // Then $this->assertCount(1, $loggerSpy->logs); - $this->assertEquals('some alert', $loggerSpy->logs[0]['message']); + $this->assertSame('some alert', $loggerSpy->logs[0]['message']); } public function testCustomDriverClosureBoundObjectIsLogManager() diff --git a/tests/Mail/MailMailableTest.php b/tests/Mail/MailMailableTest.php index 92b00976d6b8..e5f22fdb34ab 100644 --- a/tests/Mail/MailMailableTest.php +++ b/tests/Mail/MailMailableTest.php @@ -1183,12 +1183,12 @@ public function testMailableHeadersGetSent(): void $this->assertSame('custom-message-id@example.com', $sentMessage->getMessageId()); $this->assertTrue($sentMessage->getOriginalMessage()->getHeaders()->has('references')); - $this->assertEquals('References', $sentMessage->getOriginalMessage()->getHeaders()->get('references')->getName()); - $this->assertEquals('', $sentMessage->getOriginalMessage()->getHeaders()->get('references')->getValue()); + $this->assertSame('References', $sentMessage->getOriginalMessage()->getHeaders()->get('references')->getName()); + $this->assertSame('', $sentMessage->getOriginalMessage()->getHeaders()->get('references')->getValue()); $this->assertTrue($sentMessage->getOriginalMessage()->getHeaders()->has('x-custom-header')); - $this->assertEquals('X-Custom-Header', $sentMessage->getOriginalMessage()->getHeaders()->get('x-custom-header')->getName()); - $this->assertEquals('Custom Value', $sentMessage->getOriginalMessage()->getHeaders()->get('x-custom-header')->getValue()); + $this->assertSame('X-Custom-Header', $sentMessage->getOriginalMessage()->getHeaders()->get('x-custom-header')->getName()); + $this->assertSame('Custom Value', $sentMessage->getOriginalMessage()->getHeaders()->get('x-custom-header')->getValue()); } public function testMailableAttributesInBuild(): void diff --git a/tests/Mail/MailableAlternativeSyntaxTest.php b/tests/Mail/MailableAlternativeSyntaxTest.php index 20f07c559e0f..6781027c6e49 100644 --- a/tests/Mail/MailableAlternativeSyntaxTest.php +++ b/tests/Mail/MailableAlternativeSyntaxTest.php @@ -33,7 +33,7 @@ public function testBasicMailableInspection(): void $method = $reflection->getMethod('prepareMailableForDelivery'); $method->invoke($mailable); - $this->assertEquals('test-view', $mailable->view); + $this->assertSame('test-view', $mailable->view); $this->assertEquals(['test-data-key' => 'test-data-value'], $mailable->viewData); $this->assertEquals(2, count($mailable->to)); $this->assertEquals(1, count($mailable->cc)); @@ -46,24 +46,24 @@ public function testEnvelopesCanReceiveAdditionalRecipients(): void $envelope->to(new Address('taylorotwell@example.com')); $this->assertCount(2, $envelope->to); - $this->assertEquals('taylor@example.com', $envelope->to[0]->address); - $this->assertEquals('taylorotwell@example.com', $envelope->to[1]->address); + $this->assertSame('taylor@example.com', $envelope->to[0]->address); + $this->assertSame('taylorotwell@example.com', $envelope->to[1]->address); $envelope->to('abigailotwell@example.com', 'Abigail Otwell'); - $this->assertEquals('abigailotwell@example.com', $envelope->to[2]->address); - $this->assertEquals('Abigail Otwell', $envelope->to[2]->name); + $this->assertSame('abigailotwell@example.com', $envelope->to[2]->address); + $this->assertSame('Abigail Otwell', $envelope->to[2]->name); $envelope->to('adam@example.com'); - $this->assertEquals('adam@example.com', $envelope->to[3]->address); + $this->assertSame('adam@example.com', $envelope->to[3]->address); $this->assertNull($envelope->to[3]->name); $envelope->to(['jeffrey@example.com', 'tyler@example.com']); - $this->assertEquals('jeffrey@example.com', $envelope->to[4]->address); - $this->assertEquals('tyler@example.com', $envelope->to[5]->address); + $this->assertSame('jeffrey@example.com', $envelope->to[4]->address); + $this->assertSame('tyler@example.com', $envelope->to[5]->address); $envelope->from('dries@example.com', 'Dries Vints'); - $this->assertEquals('dries@example.com', $envelope->from->address); - $this->assertEquals('Dries Vints', $envelope->from->name); + $this->assertSame('dries@example.com', $envelope->from->address); + $this->assertSame('Dries Vints', $envelope->from->name); } } diff --git a/tests/Pipeline/PipelineTransactionTest.php b/tests/Pipeline/PipelineTransactionTest.php index 2f52d2a7fcb7..facf722c85a0 100644 --- a/tests/Pipeline/PipelineTransactionTest.php +++ b/tests/Pipeline/PipelineTransactionTest.php @@ -25,7 +25,7 @@ public function testPipelineTransaction() ]) ->thenReturn(); - $this->assertEquals('some string', $result); + $this->assertSame('some string', $result); Event::assertDispatchedTimes(TransactionBeginning::class, 1); Event::assertDispatchedTimes(TransactionCommitted::class, 1); } @@ -55,7 +55,7 @@ function ($value, $next) { ]) ->thenReturn(); - $this->assertEquals('some string', $result); + $this->assertSame('some string', $result); Event::dispatched(TransactionBeginning::class, function (TransactionBeginning $event) use ($connectionName) { return $event->connection === $connectionName; }); diff --git a/tests/Process/ProcessTest.php b/tests/Process/ProcessTest.php index 3b84497a76f0..69e28a56841c 100644 --- a/tests/Process/ProcessTest.php +++ b/tests/Process/ProcessTest.php @@ -24,7 +24,7 @@ public function testSuccessfulProcess() $this->assertFalse($result->failed()); $this->assertEquals(0, $result->exitCode()); $this->assertTrue(str_contains($result->output(), 'ProcessTest.php')); - $this->assertEquals('', $result->errorOutput()); + $this->assertSame('', $result->errorOutput()); $result->throw(); $result->throwIf(true); @@ -169,8 +169,8 @@ public function testBasicProcessFake() $result = $factory->run('ls -la'); - $this->assertEquals('', $result->output()); - $this->assertEquals('', $result->errorOutput()); + $this->assertSame('', $result->output()); + $this->assertSame('', $result->errorOutput()); $this->assertEquals(0, $result->exitCode()); $this->assertTrue($result->successful()); } @@ -243,56 +243,56 @@ public function testBasicProcessFakeWithCustomOutput() $factory->fake(fn () => $factory->result('test output')); $result = $factory->run('ls -la'); - $this->assertEquals("test output\n", $result->output()); + $this->assertSame("test output\n", $result->output()); // Array of output... $factory = new Factory; $factory->fake(fn () => $factory->result(['line 1', 'line 2'])); $result = $factory->run('ls -la'); - $this->assertEquals("line 1\nline 2\n", $result->output()); + $this->assertSame("line 1\nline 2\n", $result->output()); // Array of output with empty line... $factory = new Factory; $factory->fake(fn () => $factory->result(['line 1', '', 'line 2'])); $result = $factory->run('ls -la'); - $this->assertEquals("line 1\n\nline 2\n", $result->output()); + $this->assertSame("line 1\n\nline 2\n", $result->output()); // Plain string... $factory = new Factory; $factory->fake(fn () => 'test output'); $result = $factory->run('ls -la'); - $this->assertEquals("test output\n", $result->output()); + $this->assertSame("test output\n", $result->output()); // Plain array... $factory = new Factory; $factory->fake(fn () => ['line 1', 'line 2']); $result = $factory->run('ls -la'); - $this->assertEquals("line 1\nline 2\n", $result->output()); + $this->assertSame("line 1\nline 2\n", $result->output()); // Plain array with empty line... $factory = new Factory; $factory->fake(fn () => ['line 1', '', 'line 2']); $result = $factory->run('ls -la'); - $this->assertEquals("line 1\n\nline 2\n", $result->output()); + $this->assertSame("line 1\n\nline 2\n", $result->output()); // Process description... $factory = new Factory; $factory->fake(fn () => $factory->describe()->output('line 1')->output('line 2')); $result = $factory->run('ls -la'); - $this->assertEquals("line 1\nline 2\n", $result->output()); + $this->assertSame("line 1\nline 2\n", $result->output()); // Process description with empty line... $factory = new Factory; $factory->fake(fn () => $factory->describe()->output('line 1')->output('')->output('line 2')); $result = $factory->run('ls -la'); - $this->assertEquals("line 1\n\nline 2\n", $result->output()); + $this->assertSame("line 1\n\nline 2\n", $result->output()); } public function testProcessFakeWithErrorOutput() @@ -301,24 +301,24 @@ public function testProcessFakeWithErrorOutput() $factory->fake(fn () => $factory->result('standard output', 'error output')); $result = $factory->run('ls -la'); - $this->assertEquals("standard output\n", $result->output()); - $this->assertEquals("error output\n", $result->errorOutput()); + $this->assertSame("standard output\n", $result->output()); + $this->assertSame("error output\n", $result->errorOutput()); // Array of error output... $factory = new Factory; $factory->fake(fn () => $factory->result('standard output', ['line 1', 'line 2'])); $result = $factory->run('ls -la'); - $this->assertEquals("standard output\n", $result->output()); - $this->assertEquals("line 1\nline 2\n", $result->errorOutput()); + $this->assertSame("standard output\n", $result->output()); + $this->assertSame("line 1\nline 2\n", $result->errorOutput()); // Using process description... $factory = new Factory; $factory->fake(fn () => $factory->describe()->output('standard output')->errorOutput('error output')); $result = $factory->run('ls -la'); - $this->assertEquals("standard output\n", $result->output()); - $this->assertEquals("error output\n", $result->errorOutput()); + $this->assertSame("standard output\n", $result->output()); + $this->assertSame("error output\n", $result->errorOutput()); } public function testCustomizedFakesPerCommand() @@ -331,10 +331,10 @@ public function testCustomizedFakesPerCommand() ]); $result = $factory->run('ls -la'); - $this->assertEquals("ls command\n", $result->output()); + $this->assertSame("ls command\n", $result->output()); $result = $factory->run('cat composer.json'); - $this->assertEquals("cat command\n", $result->output()); + $this->assertSame("cat command\n", $result->output()); } public function testProcessFakeSequences() @@ -349,13 +349,13 @@ public function testProcessFakeSequences() ]); $result = $factory->run('ls -la'); - $this->assertEquals("ls command 1\n", $result->output()); + $this->assertSame("ls command 1\n", $result->output()); $result = $factory->run('ls -la'); - $this->assertEquals("ls command 2\n", $result->output()); + $this->assertSame("ls command 2\n", $result->output()); $result = $factory->run('cat composer.json'); - $this->assertEquals("cat command\n", $result->output()); + $this->assertSame("cat command\n", $result->output()); } public function testProcessFakeSequencesCanReturnEmptyResultsWhenSequenceIsEmpty() @@ -370,13 +370,13 @@ public function testProcessFakeSequencesCanReturnEmptyResultsWhenSequenceIsEmpty ]); $result = $factory->run('ls -la'); - $this->assertEquals("ls command 1\n", $result->output()); + $this->assertSame("ls command 1\n", $result->output()); $result = $factory->run('ls -la'); - $this->assertEquals("ls command 2\n", $result->output()); + $this->assertSame("ls command 2\n", $result->output()); $result = $factory->run('ls -la'); - $this->assertEquals('', $result->output()); + $this->assertSame('', $result->output()); } public function testProcessFakeSequencesCanThrowWhenSequenceIsEmpty() @@ -392,10 +392,10 @@ public function testProcessFakeSequencesCanThrowWhenSequenceIsEmpty() ]); $result = $factory->run('ls -la'); - $this->assertEquals("ls command 1\n", $result->output()); + $this->assertSame("ls command 1\n", $result->output()); $result = $factory->run('ls -la'); - $this->assertEquals("ls command 2\n", $result->output()); + $this->assertSame("ls command 2\n", $result->output()); $result = $factory->run('ls -la'); } @@ -503,8 +503,8 @@ public function testRealProcessesCanHaveErrorOutput() $result = $factory->path(__DIR__)->run('echo "Hello World" >&2; exit 1;'); $this->assertFalse($result->successful()); - $this->assertEquals('', $result->output()); - $this->assertEquals("Hello World\n", $result->errorOutput()); + $this->assertSame('', $result->output()); + $this->assertSame("Hello World\n", $result->errorOutput()); } public function testFakeProcessesCanThrowWithoutOutput() @@ -771,14 +771,14 @@ public function testFakeInvokedProcessOutputWithLatestOutput() $output[] = $process->output(); } - $this->assertEquals("ONE\n", $latestOutput[0]); - $this->assertEquals("ONE\nTWO\n", $output[0]); + $this->assertSame("ONE\n", $latestOutput[0]); + $this->assertSame("ONE\nTWO\n", $output[0]); - $this->assertEquals("THREE\n", $latestOutput[1]); - $this->assertEquals("ONE\nTWO\nTHREE\n", $output[1]); + $this->assertSame("THREE\n", $latestOutput[1]); + $this->assertSame("ONE\nTWO\nTHREE\n", $output[1]); - $this->assertEquals('', $latestOutput[2]); - $this->assertEquals("ONE\nTWO\nTHREE\n", $output[2]); + $this->assertSame('', $latestOutput[2]); + $this->assertSame("ONE\nTWO\nTHREE\n", $output[2]); } public function testFakeInvokedProcessWaitUntil() @@ -824,7 +824,7 @@ public function testFakeInvokedProcessWaitUntilWithNoCallback() $this->assertInstanceOf(ProcessResult::class, $result); $this->assertTrue($result->successful()); - $this->assertEquals("OUTPUT\n", $result->output()); + $this->assertSame("OUTPUT\n", $result->output()); } public function testFakeInvokedProcessWaitUntilWithErrorOutput() @@ -960,7 +960,7 @@ public function testFakeInvokedProcessWaitUntilFollowedByWait() $this->assertInstanceOf(ProcessResult::class, $result); $this->assertTrue($result->successful()); $this->assertCount(1, $waitUntilCallbacks); - $this->assertEquals("FIRST\n", $waitUntilCallbacks[0]); + $this->assertSame("FIRST\n", $waitUntilCallbacks[0]); $this->assertCount(2, $waitCallbacks); $this->assertContains("SECOND\n", $waitCallbacks); $this->assertContains("THIRD\n", $waitCallbacks); @@ -1082,7 +1082,7 @@ public function testProcessWithMultipleEnvironmentVariablesAndSequences() ])->run('printenv TEST_VAR OTHER_VAR'); $this->assertTrue($result->successful()); - $this->assertEquals("test_value\nother_value\n", $result->output()); + $this->assertSame("test_value\nother_value\n", $result->output()); $result = $factory->env([ 'TEST_VAR' => 'new_test_value', @@ -1090,7 +1090,7 @@ public function testProcessWithMultipleEnvironmentVariablesAndSequences() ])->run('printenv TEST_VAR OTHER_VAR'); $this->assertTrue($result->successful()); - $this->assertEquals("new_test_value\nnew_other_value\n", $result->output()); + $this->assertSame("new_test_value\nnew_other_value\n", $result->output()); $factory->assertRanTimes(function ($process) { return str_contains($process->command, 'printenv TEST_VAR OTHER_VAR'); diff --git a/tests/Queue/DatabaseUuidFailedJobProviderTest.php b/tests/Queue/DatabaseUuidFailedJobProviderTest.php index e8718e3ae1c0..51820fb5ae36 100644 --- a/tests/Queue/DatabaseUuidFailedJobProviderTest.php +++ b/tests/Queue/DatabaseUuidFailedJobProviderTest.php @@ -52,9 +52,9 @@ public function testFindingFailedJobsById() $provider->log('connection-1', 'queue-1', json_encode(['uuid' => 'uuid-1']), new RuntimeException()); $this->assertNull($provider->find('uuid-2')); - $this->assertEquals('uuid-1', $provider->find('uuid-1')->id); - $this->assertEquals('queue-1', $provider->find('uuid-1')->queue); - $this->assertEquals('connection-1', $provider->find('uuid-1')->connection); + $this->assertSame('uuid-1', $provider->find('uuid-1')->id); + $this->assertSame('queue-1', $provider->find('uuid-1')->queue); + $this->assertSame('connection-1', $provider->find('uuid-1')->connection); } public function testRemovingJobsById() diff --git a/tests/Queue/InteractsWithQueueTest.php b/tests/Queue/InteractsWithQueueTest.php index dcae9eafaa5a..01e561e05d8e 100644 --- a/tests/Queue/InteractsWithQueueTest.php +++ b/tests/Queue/InteractsWithQueueTest.php @@ -15,7 +15,7 @@ public function testCreatesAnExceptionFromString() $queueJob = m::mock(Job::class); $queueJob->shouldReceive('fail')->withArgs(function ($e) { $this->assertInstanceOf(Exception::class, $e); - $this->assertEquals('Whoops!', $e->getMessage()); + $this->assertSame('Whoops!', $e->getMessage()); return true; }); diff --git a/tests/Queue/QueueSqsQueueTest.php b/tests/Queue/QueueSqsQueueTest.php index 63230f58e95b..842537eb8f12 100755 --- a/tests/Queue/QueueSqsQueueTest.php +++ b/tests/Queue/QueueSqsQueueTest.php @@ -242,7 +242,7 @@ public function testGetQueueProperlyResolvesFifoUrlWithSuffix() { $this->queueName = 'emails.fifo'; $queue = new SqsQueue($this->sqs, $this->queueName, $this->prefix, $suffix = '-staging'); - $this->assertEquals("{$this->prefix}emails-staging.fifo", $queue->getQueue(null)); + $this->assertSame("{$this->prefix}emails-staging.fifo", $queue->getQueue(null)); $queueUrl = $this->baseUrl.'/'.$this->account.'/test'.$suffix.'.fifo'; $this->assertEquals($queueUrl, $queue->getQueue('test.fifo')); } @@ -258,7 +258,7 @@ public function testGetQueueEnsuresTheQueueIsOnlySuffixedOnce() public function testGetFifoQueueEnsuresTheQueueIsOnlySuffixedOnce() { $queue = new SqsQueue($this->sqs, "{$this->queueName}-staging.fifo", $this->prefix, $suffix = '-staging'); - $this->assertEquals("{$this->prefix}{$this->queueName}{$suffix}.fifo", $queue->getQueue(null)); + $this->assertSame("{$this->prefix}{$this->queueName}{$suffix}.fifo", $queue->getQueue(null)); $queueUrl = $this->baseUrl.'/'.$this->account.'/test'.$suffix.'.fifo'; $this->assertEquals($queueUrl, $queue->getQueue('test-staging.fifo')); } diff --git a/tests/Redis/RedisConnectorTest.php b/tests/Redis/RedisConnectorTest.php index 82fbe0b5e44b..b7dda0717353 100644 --- a/tests/Redis/RedisConnectorTest.php +++ b/tests/Redis/RedisConnectorTest.php @@ -251,7 +251,7 @@ public function testPrefixOverrideBehaviour() ], ]); $predisClient1 = $predis1->client(); - $this->assertEquals('test_default_options_', $predisClient1->getOptions()->prefix->getPrefix()); + $this->assertSame('test_default_options_', $predisClient1->getOptions()->prefix->getPrefix()); $predis2 = new RedisManager(new Application, 'predis', [ 'cluster' => false, @@ -271,7 +271,7 @@ public function testPrefixOverrideBehaviour() ], ]); $predisClient2 = $predis2->client(); - $this->assertEquals('test_default_config_', $predisClient2->getOptions()->prefix->getPrefix()); + $this->assertSame('test_default_config_', $predisClient2->getOptions()->prefix->getPrefix()); $phpRedis1 = new RedisManager(new Application, 'phpredis', [ 'cluster' => false, @@ -290,7 +290,7 @@ public function testPrefixOverrideBehaviour() ], ]); $phpRedisClient1 = $phpRedis1->connection()->client(); - $this->assertEquals('test_default_options_', $phpRedisClient1->getOption(Redis::OPT_PREFIX)); + $this->assertSame('test_default_options_', $phpRedisClient1->getOption(Redis::OPT_PREFIX)); $phpRedis2 = new RedisManager(new Application, 'phpredis', [ 'cluster' => false, @@ -310,6 +310,6 @@ public function testPrefixOverrideBehaviour() ], ]); $phpRedisClient2 = $phpRedis2->connection()->client(); - $this->assertEquals('test_default_config_', $phpRedisClient2->getOption(Redis::OPT_PREFIX)); + $this->assertSame('test_default_config_', $phpRedisClient2->getOption(Redis::OPT_PREFIX)); } } diff --git a/tests/Routing/RouteCollectionTest.php b/tests/Routing/RouteCollectionTest.php index e061b9ba777b..1ab1dbfd7ddb 100644 --- a/tests/Routing/RouteCollectionTest.php +++ b/tests/Routing/RouteCollectionTest.php @@ -357,7 +357,7 @@ public function testOverlappingRoutesMatchesFirstRoute() $request = Request::create('users/1/show', 'GET'); $this->assertCount(2, $this->routeCollection->getRoutes()); - $this->assertEquals('first', $this->routeCollection->match($request)->getName()); + $this->assertSame('first', $this->routeCollection->match($request)->getName()); } public function testPrependsRoutesWithDomain() diff --git a/tests/Routing/RouteRegistrarTest.php b/tests/Routing/RouteRegistrarTest.php index 1fcc8ffcf52f..f94ca8e55c54 100644 --- a/tests/Routing/RouteRegistrarTest.php +++ b/tests/Routing/RouteRegistrarTest.php @@ -1320,7 +1320,7 @@ public function testCanRemoveMiddlewareFromGroup() $this->router->removeMiddlewareFromGroup('web', 'test-middleware'); - $this->assertEquals([], $this->router->getMiddlewareGroups()['web']); + $this->assertSame([], $this->router->getMiddlewareGroups()['web']); } public function testCanRemoveMiddlewareFromGroupNotUnregisteredMiddleware() @@ -1329,14 +1329,14 @@ public function testCanRemoveMiddlewareFromGroupNotUnregisteredMiddleware() $this->router->removeMiddlewareFromGroup('web', 'different-test-middleware'); - $this->assertEquals([], $this->router->getMiddlewareGroups()['web']); + $this->assertSame([], $this->router->getMiddlewareGroups()['web']); } public function testCanRemoveMiddlewareFromGroupUnregisteredGroup() { $this->router->removeMiddlewareFromGroup('web', ['test-middleware']); - $this->assertEquals([], $this->router->getMiddlewareGroups()); + $this->assertSame([], $this->router->getMiddlewareGroups()); } public function testCanRegisterSingleton() diff --git a/tests/Routing/RoutingRouteTest.php b/tests/Routing/RoutingRouteTest.php index ad240fe15d30..b653ce430420 100644 --- a/tests/Routing/RoutingRouteTest.php +++ b/tests/Routing/RoutingRouteTest.php @@ -708,7 +708,7 @@ public function testControllerCallActionMethodParameters() unset($_SERVER['__test.controller_callAction_parameters']); $router->get(($str = Str::random()).'', RouteTestAnotherControllerWithParameterStub::class.'@oneArgument'); $router->dispatch(Request::create($str, 'GET')); - $this->assertEquals([], $_SERVER['__test.controller_callAction_parameters']); + $this->assertSame([], $_SERVER['__test.controller_callAction_parameters']); // With model bindings unset($_SERVER['__test.controller_callAction_parameters']); diff --git a/tests/Routing/RoutingSortedMiddlewareTest.php b/tests/Routing/RoutingSortedMiddlewareTest.php index 4416f9be3686..e302f127dc2e 100644 --- a/tests/Routing/RoutingSortedMiddlewareTest.php +++ b/tests/Routing/RoutingSortedMiddlewareTest.php @@ -41,7 +41,7 @@ public function testMiddlewareCanBeSortedByPriority() $this->assertEquals($expected, (new SortedMiddleware($priority, $middleware))->all()); - $this->assertEquals([], (new SortedMiddleware(['First'], []))->all()); + $this->assertSame([], (new SortedMiddleware(['First'], []))->all()); $this->assertEquals(['First'], (new SortedMiddleware(['First'], ['First']))->all()); $this->assertEquals(['First', 'Second'], (new SortedMiddleware(['First', 'Second'], ['Second', 'First']))->all()); } diff --git a/tests/Session/CacheBasedSessionHandlerTest.php b/tests/Session/CacheBasedSessionHandlerTest.php index 76fa6acd6200..d437e4a14254 100644 --- a/tests/Session/CacheBasedSessionHandlerTest.php +++ b/tests/Session/CacheBasedSessionHandlerTest.php @@ -37,7 +37,7 @@ public function test_read_returns_data_from_cache() $this->cacheMock->shouldReceive('get')->once()->with('session_id', '')->andReturn('session_data'); $data = $this->sessionHandler->read(sessionId: 'session_id'); - $this->assertEquals('session_data', $data); + $this->assertSame('session_data', $data); } public function test_read_returns_empty_string_if_no_data() @@ -45,7 +45,7 @@ public function test_read_returns_empty_string_if_no_data() $this->cacheMock->shouldReceive('get')->once()->with('some_id', '')->andReturn(''); $data = $this->sessionHandler->read(sessionId: 'some_id'); - $this->assertEquals('', $data); + $this->assertSame('', $data); } public function test_write_stores_data_in_cache() diff --git a/tests/Session/FileSessionHandlerTest.php b/tests/Session/FileSessionHandlerTest.php index ab5a2d5d2ffb..e14ef4c43c98 100644 --- a/tests/Session/FileSessionHandlerTest.php +++ b/tests/Session/FileSessionHandlerTest.php @@ -49,7 +49,7 @@ public function test_read_returns_data_when_file_exists_and_is_valid() $result = $this->sessionHandler->read($sessionId); - $this->assertEquals('session_data', $result); + $this->assertSame('session_data', $result); } public function test_read_returns_data_when_file_exists_but_expired() @@ -66,7 +66,7 @@ public function test_read_returns_data_when_file_exists_but_expired() $result = $this->sessionHandler->read($sessionId); - $this->assertEquals('', $result); + $this->assertSame('', $result); } public function test_read_returns_empty_string_when_file_does_not_exist() @@ -79,7 +79,7 @@ public function test_read_returns_empty_string_when_file_does_not_exist() $result = $this->sessionHandler->read($sessionId); - $this->assertEquals('', $result); + $this->assertSame('', $result); } public function test_write_stores_data() diff --git a/tests/Session/Middleware/AuthenticateSessionTest.php b/tests/Session/Middleware/AuthenticateSessionTest.php index de9a078d9d70..3a4cae096b65 100644 --- a/tests/Session/Middleware/AuthenticateSessionTest.php +++ b/tests/Session/Middleware/AuthenticateSessionTest.php @@ -24,7 +24,7 @@ public function test_handle_without_session() $middleware = new AuthenticateSession($authFactory); $response = $middleware->handle($request, $next); - $this->assertEquals('next-1', $response); + $this->assertSame('next-1', $response); } public function test_handle_with_session_without_request_user() @@ -40,7 +40,7 @@ public function test_handle_with_session_without_request_user() $next = fn () => 'next-2'; $middleware = new AuthenticateSession($authFactory); $response = $middleware->handle($request, $next); - $this->assertEquals('next-2', $response); + $this->assertSame('next-2', $response); } public function test_handle_with_session_without_auth_password() @@ -67,7 +67,7 @@ public function getAuthPassword() $middleware = new AuthenticateSession($authFactory); $response = $middleware->handle($request, $next); - $this->assertEquals('next-3', $response); + $this->assertSame('next-3', $response); } public function test_handle_with_session_with_user_auth_password_on_request_via_remember_false() @@ -96,8 +96,8 @@ public function getAuthPassword() $middleware = new AuthenticateSession($authFactory); $response = $middleware->handle($request, fn () => 'next-4'); - $this->assertEquals('mac:my-pass-(*&^%$#!@', $session->get('password_hash_web')); - $this->assertEquals('next-4', $response); + $this->assertSame('mac:my-pass-(*&^%$#!@', $session->get('password_hash_web')); + $this->assertSame('next-4', $response); } public function test_handle_with_invalid_password_hash() @@ -140,9 +140,9 @@ public function getAuthPassword() $middleware->handle($request, fn () => 'next-7'); } catch (AuthenticationException $e) { $message = $e->getMessage(); - $this->assertEquals('i-wanna-go-home', $e->redirectTo($request)); + $this->assertSame('i-wanna-go-home', $e->redirectTo($request)); } - $this->assertEquals('Unauthenticated.', $message); + $this->assertSame('Unauthenticated.', $message); // ensure session is flushed: $this->assertNull($session->get('a')); @@ -185,7 +185,7 @@ public function getAuthPassword() } catch (AuthenticationException $e) { $message = $e->getMessage(); } - $this->assertEquals('Unauthenticated.', $message); + $this->assertSame('Unauthenticated.', $message); // ensure session is flushed $this->assertNull($session->get('password_hash_web')); @@ -230,7 +230,7 @@ public function getAuthPassword() } catch (AuthenticationException $e) { $message = $e->getMessage(); } - $this->assertEquals('Unauthenticated.', $message); + $this->assertSame('Unauthenticated.', $message); // ensure session is flushed: $this->assertNull($session->get('password_hash_web')); @@ -271,11 +271,11 @@ public function getAuthPassword() $middleware = new AuthenticateSession($authFactory); $response = $middleware->handle($request, fn () => 'next-8'); - $this->assertEquals('next-8', $response); + $this->assertSame('next-8', $response); // ensure session is flushed: - $this->assertEquals('mac:my-pass-(*&^%$#!@', $session->get('password_hash_web')); - $this->assertEquals('1', $session->get('a')); - $this->assertEquals('2', $session->get('b')); + $this->assertSame('mac:my-pass-(*&^%$#!@', $session->get('password_hash_web')); + $this->assertSame('1', $session->get('a')); + $this->assertSame('2', $session->get('b')); } public function test_handle_with_old_format_cookie_for_backward_compatibility() @@ -311,11 +311,11 @@ public function getAuthPassword() $response = $middleware->handle($request, fn () => 'next-9'); // Should succeed because of backward compatibility fallback - $this->assertEquals('next-9', $response); + $this->assertSame('next-9', $response); // Session should be updated to new format (HMAC) - $this->assertEquals('mac:my-pass-(*&^%$#!@', $session->get('password_hash_web')); - $this->assertEquals('1', $session->get('a')); - $this->assertEquals('2', $session->get('b')); + $this->assertSame('mac:my-pass-(*&^%$#!@', $session->get('password_hash_web')); + $this->assertSame('1', $session->get('a')); + $this->assertSame('2', $session->get('b')); } public function test_handle_with_old_format_cookie_and_legacy_guard() @@ -351,10 +351,10 @@ public function getAuthPassword() $response = $middleware->handle($request, fn () => 'next-9'); // Should succeed because of backward compatibility fallback - $this->assertEquals('next-9', $response); + $this->assertSame('next-9', $response); // Session should stay intact - $this->assertEquals('my-pass-(*&^%$#!@', $session->get('password_hash_web')); - $this->assertEquals('1', $session->get('a')); - $this->assertEquals('2', $session->get('b')); + $this->assertSame('my-pass-(*&^%$#!@', $session->get('password_hash_web')); + $this->assertSame('1', $session->get('a')); + $this->assertSame('2', $session->get('b')); } } diff --git a/tests/Session/SessionStoreTest.php b/tests/Session/SessionStoreTest.php index 948c7aebbb08..5b2539ad42e6 100644 --- a/tests/Session/SessionStoreTest.php +++ b/tests/Session/SessionStoreTest.php @@ -816,7 +816,7 @@ public function testValidationErrorsCanBeReadAsJson() $this->assertInstanceOf(ViewErrorBag::class, $errors); $this->assertInstanceOf(MessageBag::class, $errors->getBags()['default']); - $this->assertEquals('

:message

', $errors->getBags()['default']->getFormat()); + $this->assertSame('

:message

', $errors->getBags()['default']->getFormat()); $this->assertEquals(['first_name' => [ 'Your first name is required', 'Your first name must be at least 1 character', diff --git a/tests/Support/SupportArrTest.php b/tests/Support/SupportArrTest.php index f3e60953b9bf..73d42f32420b 100644 --- a/tests/Support/SupportArrTest.php +++ b/tests/Support/SupportArrTest.php @@ -108,7 +108,7 @@ public function testCollapse() // Case with empty two-dimensional arrays $emptyArray = [[], [], []]; - $this->assertEquals([], Arr::collapse($emptyArray)); + $this->assertSame([], Arr::collapse($emptyArray)); // Case with both empty arrays and arrays with elements $mixedArray = [[], [1, 2], [], ['foo', 'bar']]; @@ -170,8 +170,8 @@ public function testDivide(): void { // Test dividing an empty array [$keys, $values] = Arr::divide([]); - $this->assertEquals([], $keys); - $this->assertEquals([], $values); + $this->assertSame([], $keys); + $this->assertSame([], $values); // Test dividing an array with a single key-value pair [$keys, $values] = Arr::divide(['name' => 'Desk']); @@ -349,16 +349,16 @@ public function testExceptValues() $array = ['a' => 1, 'b' => 2, 'c' => 1, 'd' => 3]; $this->assertEquals(['b' => 2, 'd' => 3], Arr::exceptValues($array, 1)); - $this->assertEquals([], Arr::exceptValues([], 'foo')); + $this->assertSame([], Arr::exceptValues([], 'foo')); $this->assertEquals(['foo', 'bar'], Arr::exceptValues(['foo', 'bar'], [])); $array = [1, '1', 2, '2', 3]; $this->assertEquals([1 => '1', 3 => '2'], Arr::exceptValues($array, [1, 2, 3], true)); - $this->assertEquals([], Arr::exceptValues($array, [1, 2, 3])); + $this->assertSame([], Arr::exceptValues($array, [1, 2, 3])); $array = ['a' => true, 'b' => false, 'c' => 1, 'd' => 0]; $this->assertEquals(['a' => true, 'b' => false], Arr::exceptValues($array, [1, 0], true)); - $this->assertEquals([], Arr::exceptValues($array, [1, 0])); + $this->assertSame([], Arr::exceptValues($array, [1, 0])); } public function testExists() @@ -384,7 +384,7 @@ public function testWhereNotNull(): void $this->assertEquals([1, 2, 3], $array); $array = array_values(Arr::whereNotNull([null, null, null])); - $this->assertEquals([], $array); + $this->assertSame([], $array); $array = array_values(Arr::whereNotNull(['a', null, 'b', null, 'c'])); $this->assertEquals(['a', 'b', 'c'], $array); @@ -939,8 +939,8 @@ public function testOnlyValues() $array = ['a' => 1, 'b' => 2, 'c' => 1, 'd' => 3]; $this->assertEquals(['a' => 1, 'c' => 1], Arr::onlyValues($array, 1)); - $this->assertEquals([], Arr::onlyValues([], 'foo')); - $this->assertEquals([], Arr::onlyValues(['foo', 'bar'], [])); + $this->assertSame([], Arr::onlyValues([], 'foo')); + $this->assertSame([], Arr::onlyValues(['foo', 'bar'], [])); $array = [1, '1', 2, '2', 3]; $this->assertEquals([0 => 1, 2 => 2, 4 => 3], Arr::onlyValues($array, [1, 2, 3], true)); @@ -1091,7 +1091,7 @@ public function testMapWithEmptyArray() $mapped = Arr::map([], static function ($value, $key) { return $key.'-'.$value; }); - $this->assertEquals([], $mapped); + $this->assertSame([], $mapped); } public function testMapNullValues() @@ -1410,7 +1410,7 @@ public function testSoleThrowsExceptionIfMoreThanOneItemExists() public function testEmptyShuffle() { - $this->assertEquals([], Arr::shuffle([])); + $this->assertSame([], Arr::shuffle([])); } public function testSort() @@ -1713,7 +1713,8 @@ public function testFrom() $this->assertSame($subject, Arr::from($items)); $items = new WeakMap; - $items[$temp = new class {}] = 'bar'; + $items[$temp = new class { + }] = 'bar'; $this->assertSame(['bar'], Arr::from($items)); $this->expectException(InvalidArgumentException::class); @@ -1730,7 +1731,7 @@ public function testWrap() $this->assertEquals(['a'], Arr::wrap($string)); $this->assertEquals($array, Arr::wrap($array)); $this->assertEquals([$object], Arr::wrap($object)); - $this->assertEquals([], Arr::wrap(null)); + $this->assertSame([], Arr::wrap(null)); $this->assertEquals([null], Arr::wrap([null])); $this->assertEquals([null, null], Arr::wrap([null, null])); $this->assertEquals([''], Arr::wrap('')); @@ -1846,7 +1847,7 @@ public function testTake(): void $this->assertEquals([4, 5, 6], Arr::take($array, -3)); // Test with zero limit, should return an empty array. - $this->assertEquals([], Arr::take($array, 0)); + $this->assertSame([], Arr::take($array, 0)); // Test with a limit greater than the array size, should return the entire array. $this->assertEquals([1, 2, 3, 4, 5, 6], Arr::take($array, 10)); diff --git a/tests/Support/SupportCarbonTest.php b/tests/Support/SupportCarbonTest.php index 9500e2559469..df035124e4e8 100644 --- a/tests/Support/SupportCarbonTest.php +++ b/tests/Support/SupportCarbonTest.php @@ -127,19 +127,19 @@ public function testCarbonIsConditionable() public function testCreateFromUid() { $ulid = Carbon::createFromId('01DXH9C4P0ED4AGJJP9CRKQ55C'); - $this->assertEquals('2020-01-01 19:30:00.000000', $ulid->toDateTimeString('microsecond')); + $this->assertSame('2020-01-01 19:30:00.000000', $ulid->toDateTimeString('microsecond')); $uuidv1 = Carbon::createFromId('71513cb4-f071-11ed-a0cf-325096b39f47'); - $this->assertEquals('2023-05-12 03:02:34.147346', $uuidv1->toDateTimeString('microsecond')); + $this->assertSame('2023-05-12 03:02:34.147346', $uuidv1->toDateTimeString('microsecond')); $uuidv2 = Carbon::createFromId('000003e8-f072-21ed-9200-325096b39f47'); - $this->assertEquals('2023-05-12 03:06:33.529139', $uuidv2->toDateTimeString('microsecond')); + $this->assertSame('2023-05-12 03:06:33.529139', $uuidv2->toDateTimeString('microsecond')); $uuidv6 = Carbon::createFromId('1edf0746-5d1c-6ce8-88ad-e0cb4effa035'); - $this->assertEquals('2023-05-12 03:23:43.347428', $uuidv6->toDateTimeString('microsecond')); + $this->assertSame('2023-05-12 03:23:43.347428', $uuidv6->toDateTimeString('microsecond')); $uuidv7 = Carbon::createFromId('01880dfa-2825-72e4-acbb-b1e4981cf8af'); - $this->assertEquals('2023-05-12 03:21:18.117000', $uuidv7->toDateTimeString('microsecond')); + $this->assertSame('2023-05-12 03:21:18.117000', $uuidv7->toDateTimeString('microsecond')); } public function testPlus(): void diff --git a/tests/Support/SupportCollectionTest.php b/tests/Support/SupportCollectionTest.php index 3506655b6868..70a430205408 100755 --- a/tests/Support/SupportCollectionTest.php +++ b/tests/Support/SupportCollectionTest.php @@ -1187,7 +1187,7 @@ public function testWhere($collection) ]); $this->assertEquals([['v' => 2, 'g' => 3]], $c->where('v', 2)->where('g', 3)->values()->all()); $this->assertEquals([['v' => 2, 'g' => 3]], $c->where('v', 2)->where('g', '>', 2)->values()->all()); - $this->assertEquals([], $c->where('v', 2)->where('g', 4)->values()->all()); + $this->assertSame([], $c->where('v', 2)->where('g', 4)->values()->all()); $this->assertEquals([['v' => 2, 'g' => null]], $c->where('v', 2)->whereNull('g')->values()->all()); } @@ -1216,7 +1216,7 @@ public function testWhereIn($collection) { $c = new $collection([['v' => 1], ['v' => 2], ['v' => 3], ['v' => '3'], ['v' => 4]]); $this->assertEquals([['v' => 1], ['v' => 3], ['v' => '3']], $c->whereIn('v', [1, 3])->values()->all()); - $this->assertEquals([], $c->whereIn('v', [2])->whereIn('v', [1, 3])->values()->all()); + $this->assertSame([], $c->whereIn('v', [2])->whereIn('v', [1, 3])->values()->all()); $this->assertEquals([['v' => 1]], $c->whereIn('v', [1])->whereIn('v', [1, 3])->values()->all()); } @@ -1263,8 +1263,8 @@ public function testValue($collection) { $c = new $collection([['id' => 1, 'name' => 'Hello'], ['id' => 2, 'name' => 'World']]); - $this->assertEquals('Hello', $c->value('name')); - $this->assertEquals('World', $c->where('id', 2)->value('name')); + $this->assertSame('Hello', $c->value('name')); + $this->assertSame('World', $c->where('id', 2)->value('name')); $c = new $collection([ ['id' => 1, 'pivot' => ['value' => 'foo']], @@ -1272,8 +1272,8 @@ public function testValue($collection) ]); $this->assertEquals(['value' => 'foo'], $c->value('pivot')); - $this->assertEquals('foo', $c->value('pivot.value')); - $this->assertEquals('bar', $c->where('id', 2)->value('pivot.value')); + $this->assertSame('foo', $c->value('pivot.value')); + $this->assertSame('bar', $c->where('id', 2)->value('pivot.value')); } #[DataProvider('collectionClassProvider')] @@ -1294,7 +1294,7 @@ public function testValueWithNegativeValue($collection) $c = new $collection([['id' => 1, 'balance' => ''], ['id' => 2, 'balance' => 200]]); - $this->assertEquals('', $c->value('balance')); + $this->assertSame('', $c->value('balance')); $c = new $collection([['id' => 1, 'balance' => null], ['id' => 2, 'balance' => 200]]); @@ -1318,7 +1318,7 @@ public function testValueWithObjects($collection) literal(id: 3, balance: 200), ]); - $this->assertEquals('', $c->value('balance')); + $this->assertSame('', $c->value('balance')); $c = new $collection([ literal(id: 1), @@ -1463,8 +1463,8 @@ public function testMultiplyCollection($collection) { $c = new $collection(['Hello', 1, ['tags' => ['a', 'b'], 'admin']]); - $this->assertEquals([], $c->multiply(-1)->all()); - $this->assertEquals([], $c->multiply(0)->all()); + $this->assertSame([], $c->multiply(-1)->all()); + $this->assertSame([], $c->multiply(0)->all()); $this->assertEquals( ['Hello', 1, ['tags' => ['a', 'b'], 'admin']], @@ -1757,7 +1757,7 @@ public function testEachSpread($collection) public function testIntersectNull($collection) { $c = new $collection(['id' => 1, 'first_word' => 'Hello']); - $this->assertEquals([], $c->intersect(null)->all()); + $this->assertSame([], $c->intersect(null)->all()); } #[DataProvider('collectionClassProvider')] @@ -1772,7 +1772,7 @@ public function testIntersectUsingWithNull($collection) { $collect = new $collection(['green', 'brown', 'blue']); - $this->assertEquals([], $collect->intersectUsing(null, 'strcasecmp')->all()); + $this->assertSame([], $collect->intersectUsing(null, 'strcasecmp')->all()); } #[DataProvider('collectionClassProvider')] @@ -1788,7 +1788,7 @@ public function testIntersectAssocWithNull($collection) { $array1 = new $collection(['a' => 'green', 'b' => 'brown', 'c' => 'blue', 'red']); - $this->assertEquals([], $array1->intersectAssoc(null)->all()); + $this->assertSame([], $array1->intersectAssoc(null)->all()); } #[DataProvider('collectionClassProvider')] @@ -1805,7 +1805,7 @@ public function testIntersectAssocUsingWithNull($collection) { $array1 = new $collection(['a' => 'green', 'b' => 'brown', 'c' => 'blue', 'red']); - $this->assertEquals([], $array1->intersectAssocUsing(null, 'strcasecmp')->all()); + $this->assertSame([], $array1->intersectAssocUsing(null, 'strcasecmp')->all()); } #[DataProvider('collectionClassProvider')] @@ -1821,7 +1821,7 @@ public function testIntersectAssocUsingCollection($collection) public function testIntersectByKeysNull($collection) { $c = new $collection(['name' => 'Mateus', 'age' => 18]); - $this->assertEquals([], $c->intersectByKeys(null)->all()); + $this->assertSame([], $c->intersectByKeys(null)->all()); } #[DataProvider('collectionClassProvider')] @@ -1920,7 +1920,7 @@ public function testCollapse($collection) // Case with empty two-dimensional arrays $data = new $collection([[], [], []]); - $this->assertEquals([], $data->collapse()->all()); + $this->assertSame([], $data->collapse()->all()); // Case with both empty arrays and arrays with elements $data = new $collection([[], [1, 2], [], ['foo', 'bar']]); @@ -1947,7 +1947,7 @@ public function testCollapseWithKeys($collection) // Case with an already flat collection $data = new $collection(['a', 'b', 'c']); - $this->assertEquals([], $data->collapseWithKeys()->all()); + $this->assertSame([], $data->collapseWithKeys()->all()); } #[DataProvider('collectionClassProvider')] @@ -2886,10 +2886,10 @@ public function testMakeMethod($collection) public function testMakeMethodFromNull($collection) { $data = $collection::make(null); - $this->assertEquals([], $data->all()); + $this->assertSame([], $data->all()); $data = $collection::make(); - $this->assertEquals([], $data->all()); + $this->assertSame([], $data->all()); } #[DataProvider('collectionClassProvider')] @@ -3090,10 +3090,10 @@ public function testConstructMethod($collection) public function testConstructMethodFromNull($collection) { $data = new $collection(null); - $this->assertEquals([], $data->all()); + $this->assertSame([], $data->all()); $data = new $collection; - $this->assertEquals([], $data->all()); + $this->assertSame([], $data->all()); } #[DataProvider('collectionClassProvider')] @@ -4101,7 +4101,7 @@ public function testPullRemovesItemFromCollection() $c->pull(0); $this->assertEquals([1 => 'bar'], $c->all()); $c->pull(1); - $this->assertEquals([], $c->all()); + $this->assertSame([], $c->all()); } public function testPullRemovesItemFromNestedCollection() @@ -4258,7 +4258,7 @@ public function testBeforeInStrictMode($collection) $this->assertEquals(false, $c->before(0, true)); $this->assertEquals(0, $c->before(1, true)); $this->assertEquals(1, $c->before([], true)); - $this->assertEquals([], $c->before('', true)); + $this->assertSame([], $c->before('', true)); } #[DataProvider('collectionClassProvider')] @@ -4299,13 +4299,13 @@ public function testAfterReturnsItemAfterTheGivenItem($collection) $this->assertEquals(3, $c->after(2)); $this->assertEquals(4, $c->after(3)); $this->assertEquals(2, $c->after(4)); - $this->assertEquals('taylor', $c->after(5)); - $this->assertEquals('laravel', $c->after('taylor')); + $this->assertSame('taylor', $c->after(5)); + $this->assertSame('laravel', $c->after('taylor')); $this->assertEquals(4, $c->after(function ($value) { return $value > 2; })); - $this->assertEquals('laravel', $c->after(function ($value) { + $this->assertSame('laravel', $c->after(function ($value) { return ! is_numeric($value); })); } @@ -4319,8 +4319,8 @@ public function testAfterInStrictMode($collection) $this->assertNull($c->after('1', true)); $this->assertNull($c->after('', true)); $this->assertEquals(0, $c->after(false, true)); - $this->assertEquals([], $c->after(1, true)); - $this->assertEquals('', $c->after([], true)); + $this->assertSame([], $c->after(1, true)); + $this->assertSame('', $c->after([], true)); } #[DataProvider('collectionClassProvider')] @@ -4369,7 +4369,7 @@ public function testPaginate($collection) $this->assertEquals(['one', 'two'], $c->forPage(0, 2)->all()); $this->assertEquals(['one', 'two'], $c->forPage(1, 2)->all()); $this->assertEquals([2 => 'three', 3 => 'four'], $c->forPage(2, 2)->all()); - $this->assertEquals([], $c->forPage(3, 2)->all()); + $this->assertSame([], $c->forPage(3, 2)->all()); } #[IgnoreDeprecations] @@ -4726,7 +4726,7 @@ public function testGettingAvgItemsFromCollection($collection) $c = new $collection([['foo' => 1], ['foo' => 2]]); $this->assertIsFloat($c->avg('foo')); - $this->assertEquals(1.5, $c->avg('foo')); + $this->assertSame(1.5, $c->avg('foo')); $c = new $collection([ ['foo' => 1], ['foo' => 2], @@ -5019,7 +5019,7 @@ public function testEvenMedianCollection($collection) (object) ['foo' => 0], (object) ['foo' => 3], ]); - $this->assertEquals(1.5, $data->median('foo')); + $this->assertSame(1.5, $data->median('foo')); } #[DataProvider('collectionClassProvider')] @@ -5772,7 +5772,7 @@ public function testGetWithNullReturnsNull($collection) public function testGetWithDefaultValue($collection) { $data = new $collection(['name' => 'taylor', 'framework' => 'laravel']); - $this->assertEquals('34', $data->get('age', 34)); + $this->assertSame('34', (string) $data->get('age', 34)); } #[DataProvider('collectionClassProvider')] @@ -5782,7 +5782,7 @@ public function testGetWithCallbackAsDefaultValue($collection) $result = $data->get('email', function () { return 'taylor@example.com'; }); - $this->assertEquals('taylor@example.com', $result); + $this->assertSame('taylor@example.com', $result); } #[DataProvider('collectionClassProvider')] diff --git a/tests/Support/SupportHelpersTest.php b/tests/Support/SupportHelpersTest.php index 738a79890a93..a3f86f30ff87 100644 --- a/tests/Support/SupportHelpersTest.php +++ b/tests/Support/SupportHelpersTest.php @@ -57,7 +57,7 @@ public function testE() public function testEWithInvalidCodePoints() { $str = mb_convert_encoding('føø bar', 'ISO-8859-1', 'UTF-8'); - $this->assertEquals('f�� bar', e($str)); + $this->assertSame('f�� bar', e($str)); } public function testEWithEnums() @@ -127,26 +127,26 @@ public function testClassBasename() public function testWhen() { - $this->assertEquals('Hello', when(true, 'Hello')); + $this->assertSame('Hello', when(true, 'Hello')); $this->assertNull(when(false, 'Hello')); - $this->assertEquals('There', when(1 === 1, 'There')); // strict types - $this->assertEquals('There', when(1 == '1', 'There')); // loose types + $this->assertSame('There', when(1 === 1, 'There')); // strict types + $this->assertSame('There', when(1 == '1', 'There')); // loose types $this->assertNull(when(1 == 2, 'There')); $this->assertNull(when('1', fn () => null)); $this->assertNull(when(0, fn () => null)); - $this->assertEquals('True', when([1, 2, 3, 4], 'True')); // Array + $this->assertSame('True', when([1, 2, 3, 4], 'True')); // Array $this->assertNull(when([], 'True')); // Empty Array = Falsy - $this->assertEquals('True', when(new StdClass, fn () => 'True')); // Object - $this->assertEquals('World', when(false, 'Hello', 'World')); - $this->assertEquals('World', when(1 === 0, 'Hello', 'World')); // strict types - $this->assertEquals('World', when(1 == '0', 'Hello', 'World')); // loose types + $this->assertSame('True', when(new StdClass, fn () => 'True')); // Object + $this->assertSame('World', when(false, 'Hello', 'World')); + $this->assertSame('World', when(1 === 0, 'Hello', 'World')); // strict types + $this->assertSame('World', when(1 == '0', 'Hello', 'World')); // loose types $this->assertNull(when('', fn () => 'There', fn () => null)); $this->assertNull(when(0, fn () => 'There', fn () => null)); - $this->assertEquals('False', when([], 'True', 'False')); // Empty Array = Falsy + $this->assertSame('False', when([], 'True', 'False')); // Empty Array = Falsy $this->assertTrue(when(true, fn ($value) => $value, fn ($value) => ! $value)); // lazy evaluation $this->assertTrue(when(false, fn ($value) => $value, fn ($value) => ! $value)); // lazy evaluation - $this->assertEquals('Hello', when(fn () => true, 'Hello')); // lazy evaluation condition - $this->assertEquals('World', when(fn () => false, 'Hello', 'World')); // lazy evaluation condition + $this->assertSame('Hello', when(fn () => true, 'Hello')); // lazy evaluation condition + $this->assertSame('World', when(fn () => false, 'Hello', 'World')); // lazy evaluation condition } public function testFilled() @@ -340,8 +340,8 @@ public function testDataGetWithDoubleNestedArraysCollapsesResult() $this->assertEquals(['taylor', 'abigail', 'abigail', 'dayle', 'dayle', 'taylor'], data_get($array, 'posts.*.comments.*.author')); $this->assertEquals([4, 3, 2, null, null, 1], data_get($array, 'posts.*.comments.*.likes')); - $this->assertEquals([], data_get($array, 'posts.*.users.*.name', 'irrelevant')); - $this->assertEquals([], data_get($array, 'posts.*.users.*.name')); + $this->assertSame([], data_get($array, 'posts.*.users.*.name', 'irrelevant')); + $this->assertSame([], data_get($array, 'posts.*.users.*.name')); } public function testDataGetFirstLastDirectives() @@ -364,13 +364,13 @@ public function testDataGetFirstLastDirectives() 'empty' => [], ]; - $this->assertEquals('LHR', data_get($array, 'flights.0.segments.{first}.from')); - $this->assertEquals('PKX', data_get($array, 'flights.0.segments.{last}.to')); + $this->assertSame('LHR', data_get($array, 'flights.0.segments.{first}.from')); + $this->assertSame('PKX', data_get($array, 'flights.0.segments.{last}.to')); - $this->assertEquals('LHR', data_get($array, 'flights.{first}.segments.{first}.from')); - $this->assertEquals('PEK', data_get($array, 'flights.{last}.segments.{last}.to')); - $this->assertEquals('PKX', data_get($array, 'flights.{first}.segments.{last}.to')); - $this->assertEquals('LGW', data_get($array, 'flights.{last}.segments.{first}.from')); + $this->assertSame('LHR', data_get($array, 'flights.{first}.segments.{first}.from')); + $this->assertSame('PEK', data_get($array, 'flights.{last}.segments.{last}.to')); + $this->assertSame('PKX', data_get($array, 'flights.{first}.segments.{last}.to')); + $this->assertSame('LGW', data_get($array, 'flights.{last}.segments.{first}.from')); $this->assertEquals(['LHR', 'IST'], data_get($array, 'flights.{first}.segments.*.from')); $this->assertEquals(['SAW', 'PEK'], data_get($array, 'flights.{last}.segments.*.to')); @@ -378,8 +378,8 @@ public function testDataGetFirstLastDirectives() $this->assertEquals(['LHR', 'LGW'], data_get($array, 'flights.*.segments.{first}.from')); $this->assertEquals(['PKX', 'PEK'], data_get($array, 'flights.*.segments.{last}.to')); - $this->assertEquals('Not found', data_get($array, 'empty.{first}', 'Not found')); - $this->assertEquals('Not found', data_get($array, 'empty.{last}', 'Not found')); + $this->assertSame('Not found', data_get($array, 'empty.{first}', 'Not found')); + $this->assertSame('Not found', data_get($array, 'empty.{last}', 'Not found')); } public function testDataGetFirstLastDirectivesOnArrayAccessIterable() @@ -402,13 +402,13 @@ public function testDataGetFirstLastDirectivesOnArrayAccessIterable() 'empty' => new SupportTestArrayAccessIterable([]), ]; - $this->assertEquals('LHR', data_get($arrayAccessIterable, 'flights.0.segments.{first}.from')); - $this->assertEquals('PKX', data_get($arrayAccessIterable, 'flights.0.segments.{last}.to')); + $this->assertSame('LHR', data_get($arrayAccessIterable, 'flights.0.segments.{first}.from')); + $this->assertSame('PKX', data_get($arrayAccessIterable, 'flights.0.segments.{last}.to')); - $this->assertEquals('LHR', data_get($arrayAccessIterable, 'flights.{first}.segments.{first}.from')); - $this->assertEquals('PEK', data_get($arrayAccessIterable, 'flights.{last}.segments.{last}.to')); - $this->assertEquals('PKX', data_get($arrayAccessIterable, 'flights.{first}.segments.{last}.to')); - $this->assertEquals('LGW', data_get($arrayAccessIterable, 'flights.{last}.segments.{first}.from')); + $this->assertSame('LHR', data_get($arrayAccessIterable, 'flights.{first}.segments.{first}.from')); + $this->assertSame('PEK', data_get($arrayAccessIterable, 'flights.{last}.segments.{last}.to')); + $this->assertSame('PKX', data_get($arrayAccessIterable, 'flights.{first}.segments.{last}.to')); + $this->assertSame('LGW', data_get($arrayAccessIterable, 'flights.{last}.segments.{first}.from')); $this->assertEquals(['LHR', 'IST'], data_get($arrayAccessIterable, 'flights.{first}.segments.*.from')); $this->assertEquals(['SAW', 'PEK'], data_get($arrayAccessIterable, 'flights.{last}.segments.*.to')); @@ -416,8 +416,8 @@ public function testDataGetFirstLastDirectivesOnArrayAccessIterable() $this->assertEquals(['LHR', 'LGW'], data_get($arrayAccessIterable, 'flights.*.segments.{first}.from')); $this->assertEquals(['PKX', 'PEK'], data_get($arrayAccessIterable, 'flights.*.segments.{last}.to')); - $this->assertEquals('Not found', data_get($arrayAccessIterable, 'empty.{first}', 'Not found')); - $this->assertEquals('Not found', data_get($arrayAccessIterable, 'empty.{last}', 'Not found')); + $this->assertSame('Not found', data_get($arrayAccessIterable, 'empty.{first}', 'Not found')); + $this->assertSame('Not found', data_get($arrayAccessIterable, 'empty.{last}', 'Not found')); } public function testDataGetFirstLastDirectivesOnKeyedArrays() @@ -435,11 +435,11 @@ public function testDataGetFirstLastDirectivesOnKeyedArrays() ], ]; - $this->assertEquals('second', data_get($array, 'numericKeys.0')); - $this->assertEquals('first', data_get($array, 'numericKeys.{first}')); - $this->assertEquals('last', data_get($array, 'numericKeys.{last}')); - $this->assertEquals('first', data_get($array, 'stringKeys.{first}')); - $this->assertEquals('last', data_get($array, 'stringKeys.{last}')); + $this->assertSame('second', data_get($array, 'numericKeys.0')); + $this->assertSame('first', data_get($array, 'numericKeys.{first}')); + $this->assertSame('last', data_get($array, 'numericKeys.{last}')); + $this->assertSame('first', data_get($array, 'stringKeys.{first}')); + $this->assertSame('last', data_get($array, 'stringKeys.{last}')); } public function testDataGetEscapedSegmentKeys() @@ -452,12 +452,12 @@ public function testDataGetEscapedSegmentKeys() ], ]; - $this->assertEquals('caret', data_get($array, 'symbols.\{first}.description')); - $this->assertEquals('dollar', data_get($array, 'symbols.{first}.description')); - $this->assertEquals('asterisk', data_get($array, 'symbols.\*.description')); + $this->assertSame('caret', data_get($array, 'symbols.\{first}.description')); + $this->assertSame('dollar', data_get($array, 'symbols.{first}.description')); + $this->assertSame('asterisk', data_get($array, 'symbols.\*.description')); $this->assertEquals(['dollar', 'asterisk', 'caret'], data_get($array, 'symbols.*.description')); - $this->assertEquals('dollar', data_get($array, 'symbols.\{last}.description')); - $this->assertEquals('caret', data_get($array, 'symbols.{last}.description')); + $this->assertSame('dollar', data_get($array, 'symbols.\{last}.description')); + $this->assertSame('caret', data_get($array, 'symbols.{last}.description')); } public function testDataGetStar() @@ -1557,7 +1557,7 @@ public function testRequiredEnvReturnsValue(): void public function testLiteral(): void { $this->assertEquals(1, literal(1)); - $this->assertEquals('taylor', literal('taylor')); + $this->assertSame('taylor', literal('taylor')); $this->assertEquals((object) ['name' => 'Taylor', 'role' => 'Developer'], literal(name: 'Taylor', role: 'Developer')); } diff --git a/tests/Support/SupportHtmlStringTest.php b/tests/Support/SupportHtmlStringTest.php index f349a8a1ad2a..6c06c7ad377d 100644 --- a/tests/Support/SupportHtmlStringTest.php +++ b/tests/Support/SupportHtmlStringTest.php @@ -26,7 +26,7 @@ public function testToHtml(): void // Check if HtmlString correctly handles an empty string $emptyHtml = new HtmlString(''); - $this->assertEquals('', $emptyHtml->toHtml()); + $this->assertSame('', $emptyHtml->toHtml()); // Check if HtmlString correctly converts a plain text string $str = 'foo bar'; diff --git a/tests/Support/SupportJsTest.php b/tests/Support/SupportJsTest.php index 2bd875df5c0a..648ab94e6d3d 100644 --- a/tests/Support/SupportJsTest.php +++ b/tests/Support/SupportJsTest.php @@ -24,7 +24,7 @@ public function testScalars() $this->assertSame('null', (string) Js::from(null)); $this->assertSame("'Hello world'", (string) Js::from('Hello world')); $this->assertSame("'Hèlló world'", (string) Js::from('Hèlló world')); - $this->assertEquals( + $this->assertSame( "'\\u003Cdiv class=\\u0022foo\\u0022\\u003E\\u0027quoted html\\u0027\\u003C\\/div\\u003E'", (string) Js::from('
\'quoted html\'
') ); @@ -32,12 +32,12 @@ public function testScalars() public function testArrays() { - $this->assertEquals( + $this->assertSame( "JSON.parse('[\\u0022hello\\u0022,\\u0022world\\u0022]')", (string) Js::from(['hello', 'world']) ); - $this->assertEquals( + $this->assertSame( "JSON.parse('{\\u0022foo\\u0022:\\u0022hello\\u0022,\\u0022bar\\u0022:\\u0022world\\u0022}')", (string) Js::from(['foo' => 'hello', 'bar' => 'world']) ); @@ -45,7 +45,7 @@ public function testArrays() public function testObjects() { - $this->assertEquals( + $this->assertSame( "JSON.parse('{\\u0022foo\\u0022:\\u0022hello\\u0022,\\u0022bar\\u0022:\\u0022world\\u0022}')", (string) Js::from((object) ['foo' => 'hello', 'bar' => 'world']) ); @@ -72,7 +72,7 @@ public function toArray() } }; - $this->assertEquals( + $this->assertSame( "JSON.parse('{\\u0022foo\\u0022:\\u0022hello\\u0022,\\u0022bar\\u0022:\\u0022world\\u0022}')", (string) Js::from($data) ); @@ -104,7 +104,7 @@ public function toArray() } }; - $this->assertEquals( + $this->assertSame( "JSON.parse('{\\u0022foo\\u0022:\\u0022hello\\u0022,\\u0022bar\\u0022:\\u0022world\\u0022}')", (string) Js::from($data) ); @@ -124,7 +124,7 @@ public function toArray() } }; - $this->assertEquals( + $this->assertSame( "JSON.parse('{\\u0022foo\\u0022:\\u0022hello\\u0022,\\u0022bar\\u0022:\\u0022world\\u0022}')", (string) Js::from($data) ); @@ -140,7 +140,7 @@ public function toHtml() } }; - $this->assertEquals("'\u003Cp\u003EHello, World!\u003C\/p\u003E'", (string) Js::from($data)); + $this->assertSame("'\u003Cp\u003EHello, World!\u003C\/p\u003E'", (string) Js::from($data)); $data = new class implements Htmlable, Arrayable { @@ -155,7 +155,7 @@ public function toArray() } }; - $this->assertEquals( + $this->assertSame( "JSON.parse('{\\u0022foo\\u0022:\\u0022hello\\u0022,\\u0022bar\\u0022:\\u0022world\\u0022}')", (string) Js::from($data) ); @@ -173,7 +173,7 @@ public function toJson($options = 0) } }; - $this->assertEquals( + $this->assertSame( "JSON.parse('{\\u0022foo\\u0022:\\u0022hello\\u0022,\\u0022bar\\u0022:\\u0022world\\u0022}')", (string) Js::from($data) ); @@ -191,7 +191,7 @@ public function jsonSerialize(): mixed } }; - $this->assertEquals( + $this->assertSame( "JSON.parse('{\\u0022foo\\u0022:\\u0022hello\\u0022,\\u0022bar\\u0022:\\u0022world\\u0022}')", (string) Js::from($data) ); diff --git a/tests/Support/SupportLazyCollectionIsLazyTest.php b/tests/Support/SupportLazyCollectionIsLazyTest.php index 43f0339c21c5..d729a516fc47 100644 --- a/tests/Support/SupportLazyCollectionIsLazyTest.php +++ b/tests/Support/SupportLazyCollectionIsLazyTest.php @@ -22,7 +22,7 @@ public function testMakeWithClosureIsLazy() LazyCollection::make($closure); - $this->assertEquals([], $recorder->all()); + $this->assertSame([], $recorder->all()); } public function testMakeWithLazyCollectionIsLazy() diff --git a/tests/Support/SupportMailTest.php b/tests/Support/SupportMailTest.php index 146a3ca331a5..709c17bbec61 100644 --- a/tests/Support/SupportMailTest.php +++ b/tests/Support/SupportMailTest.php @@ -15,7 +15,7 @@ public function testItRegisterAndCallMacros() : 'it failed.', ); - $this->assertEquals('it works!', Mail::test('foo')); + $this->assertSame('it works!', Mail::test('foo')); } public function testItRegisterAndCallMacrosWhenFaked() @@ -27,7 +27,7 @@ public function testItRegisterAndCallMacrosWhenFaked() Mail::fake(); - $this->assertEquals('it works!', Mail::test('foo')); + $this->assertSame('it works!', Mail::test('foo')); } public function testEmailSent() diff --git a/tests/Support/SupportStrTest.php b/tests/Support/SupportStrTest.php index 6bfec03405af..bab5090239b3 100755 --- a/tests/Support/SupportStrTest.php +++ b/tests/Support/SupportStrTest.php @@ -573,8 +573,8 @@ public function testFinish() public function testWrap() { - $this->assertEquals('"value"', Str::wrap('value', '"')); - $this->assertEquals('foo-bar-baz', Str::wrap('-bar-', 'foo', 'baz')); + $this->assertSame('"value"', Str::wrap('value', '"')); + $this->assertSame('foo-bar-baz', Str::wrap('-bar-', 'foo', 'baz')); } public function testWrapEdgeCases() @@ -590,11 +590,11 @@ public function testWrapEdgeCases() public function testUnwrap() { - $this->assertEquals('value', Str::unwrap('"value"', '"')); - $this->assertEquals('value', Str::unwrap('"value', '"')); - $this->assertEquals('value', Str::unwrap('value"', '"')); - $this->assertEquals('bar', Str::unwrap('foo-bar-baz', 'foo-', '-baz')); - $this->assertEquals('some: "json"', Str::unwrap('{some: "json"}', '{', '}')); + $this->assertSame('value', Str::unwrap('"value"', '"')); + $this->assertSame('value', Str::unwrap('"value', '"')); + $this->assertSame('value', Str::unwrap('value"', '"')); + $this->assertSame('bar', Str::unwrap('foo-bar-baz', 'foo-', '-baz')); + $this->assertSame('some: "json"', Str::unwrap('{some: "json"}', '{', '}')); } public function testIs() @@ -1244,10 +1244,10 @@ public function testCamel(): void public function testCharAt() { - $this->assertEquals('р', Str::charAt('Привет, мир!', 1)); - $this->assertEquals('ち', Str::charAt('「こんにちは世界」', 4)); - $this->assertEquals('w', Str::charAt('Привет, world!', 8)); - $this->assertEquals('界', Str::charAt('「こんにちは世界」', -2)); + $this->assertSame('р', Str::charAt('Привет, мир!', 1)); + $this->assertSame('ち', Str::charAt('「こんにちは世界」', 4)); + $this->assertSame('w', Str::charAt('Привет, world!', 8)); + $this->assertSame('界', Str::charAt('「こんにちは世界」', -2)); $this->assertEquals(null, Str::charAt('「こんにちは世界」', -200)); $this->assertEquals(null, Str::charAt('Привет, мир!', 100)); } @@ -1440,10 +1440,10 @@ public function testWordCount() public function testWordWrap() { - $this->assertEquals('Hello
World', Str::wordWrap('Hello World', 3, '
')); - $this->assertEquals('Hel
lo
Wor
ld', Str::wordWrap('Hello World', 3, '
', true)); + $this->assertSame('Hello
World', Str::wordWrap('Hello World', 3, '
')); + $this->assertSame('Hel
lo
Wor
ld', Str::wordWrap('Hello World', 3, '
', true)); - $this->assertEquals('❤Multi
Byte☆❤☆❤☆❤', Str::wordWrap('❤Multi Byte☆❤☆❤☆❤', 3, '
')); + $this->assertSame('❤Multi
Byte☆❤☆❤☆❤', Str::wordWrap('❤Multi Byte☆❤☆❤☆❤', 3, '
')); } public static function validUuidList() diff --git a/tests/Support/SupportStringableTest.php b/tests/Support/SupportStringableTest.php index f31df4b921da..09c3c2fcc1f0 100644 --- a/tests/Support/SupportStringableTest.php +++ b/tests/Support/SupportStringableTest.php @@ -1202,10 +1202,10 @@ public function testCamel() public function testCharAt() { - $this->assertEquals('р', $this->stringable('Привет, мир!')->charAt(1)); - $this->assertEquals('ち', $this->stringable('「こんにちは世界」')->charAt(4)); - $this->assertEquals('w', $this->stringable('Привет, world!')->charAt(8)); - $this->assertEquals('界', $this->stringable('「こんにちは世界」')->charAt(-2)); + $this->assertSame('р', $this->stringable('Привет, мир!')->charAt(1)); + $this->assertSame('ち', $this->stringable('「こんにちは世界」')->charAt(4)); + $this->assertSame('w', $this->stringable('Привет, world!')->charAt(8)); + $this->assertSame('界', $this->stringable('「こんにちは世界」')->charAt(-2)); $this->assertEquals(null, $this->stringable('「こんにちは世界」')->charAt(-200)); $this->assertEquals(null, $this->stringable('Привет, мир!')->charAt('Привет, мир!', 100)); } @@ -1345,8 +1345,8 @@ public function testPipe() public function testMarkdown() { - $this->assertEquals("

hello world

\n", $this->stringable('*hello world*')->markdown()); - $this->assertEquals("

hello world

\n", $this->stringable('# hello world')->markdown()); + $this->assertSame("

hello world

\n", (string) $this->stringable('*hello world*')->markdown()); + $this->assertSame("

hello world

\n", (string) $this->stringable('# hello world')->markdown()); $extension = new class implements ExtensionInterface { @@ -1363,8 +1363,8 @@ public function register(EnvironmentBuilderInterface $environment): void public function testInlineMarkdown() { - $this->assertEquals("hello world\n", $this->stringable('*hello world*')->inlineMarkdown()); - $this->assertEquals("Laravel\n", $this->stringable('[**Laravel**](https://laravel.com)')->inlineMarkdown()); + $this->assertSame("hello world\n", (string) $this->stringable('*hello world*')->inlineMarkdown()); + $this->assertSame("Laravel\n", (string) $this->stringable('[**Laravel**](https://laravel.com)')->inlineMarkdown()); $extension = new class implements ExtensionInterface { @@ -1415,15 +1415,15 @@ public function testWordCount() public function testWrap() { - $this->assertEquals('This is me!', $this->stringable('is')->wrap('This ', ' me!')); - $this->assertEquals('"value"', $this->stringable('value')->wrap('"')); + $this->assertSame('This is me!', (string) $this->stringable('is')->wrap('This ', ' me!')); + $this->assertSame('"value"', (string) $this->stringable('value')->wrap('"')); } public function testUnwrap() { - $this->assertEquals('value', $this->stringable('"value"')->unwrap('"')); - $this->assertEquals('bar', $this->stringable('foo-bar-baz')->unwrap('foo-', '-baz')); - $this->assertEquals('some: "json"', $this->stringable('{some: "json"}')->unwrap('{', '}')); + $this->assertSame('value', (string) $this->stringable('"value"')->unwrap('"')); + $this->assertSame('bar', (string) $this->stringable('foo-bar-baz')->unwrap('foo-', '-baz')); + $this->assertSame('some: "json"', (string) $this->stringable('{some: "json"}')->unwrap('{', '}')); } public function testToHtmlString() diff --git a/tests/Support/SupportTestingMailFakeTest.php b/tests/Support/SupportTestingMailFakeTest.php index 547931f91507..42c2ce9942ce 100644 --- a/tests/Support/SupportTestingMailFakeTest.php +++ b/tests/Support/SupportTestingMailFakeTest.php @@ -381,7 +381,7 @@ public function testMissingMethodsAreForwarded() { $this->mailManager->shouldReceive('foo')->andReturn('bar'); - $this->assertEquals('bar', $this->fake->foo()); + $this->assertSame('bar', $this->fake->foo()); } public function testAssertMailer() diff --git a/tests/Support/SupportUriTest.php b/tests/Support/SupportUriTest.php index 9e15c23c28ae..8eb9f70414d8 100644 --- a/tests/Support/SupportUriTest.php +++ b/tests/Support/SupportUriTest.php @@ -12,37 +12,37 @@ public function test_can_build_special_urls() { Uri::setUrlGeneratorResolver(fn () => new CustomUrlGeneratorResolver); - $this->assertEquals('https://laravel.com/to', Uri::to('')->value()); - $this->assertEquals('https://laravel.com/route', Uri::route('')->value()); - $this->assertEquals('https://laravel.com/signed-route', Uri::signedRoute('')->value()); - $this->assertEquals('https://laravel.com/signed-route', Uri::temporarySignedRoute('', '')->value()); - $this->assertEquals('https://laravel.com/action', Uri::action('')->value()); + $this->assertSame('https://laravel.com/to', Uri::to('')->value()); + $this->assertSame('https://laravel.com/route', Uri::route('')->value()); + $this->assertSame('https://laravel.com/signed-route', Uri::signedRoute('')->value()); + $this->assertSame('https://laravel.com/signed-route', Uri::temporarySignedRoute('', '')->value()); + $this->assertSame('https://laravel.com/action', Uri::action('')->value()); } public function test_basic_uri_interactions() { $uri = Uri::of($originalUri = 'https://laravel.com/docs/installation'); - $this->assertEquals('https', $uri->scheme()); + $this->assertSame('https', $uri->scheme()); $this->assertNull($uri->user()); $this->assertNull($uri->password()); - $this->assertEquals('laravel.com', $uri->host()); + $this->assertSame('laravel.com', $uri->host()); $this->assertNull($uri->port()); - $this->assertEquals('docs/installation', $uri->path()); - $this->assertEquals([], $uri->query()->toArray()); - $this->assertEquals('', (string) $uri->query()); - $this->assertEquals('', $uri->query()->decode()); + $this->assertSame('docs/installation', $uri->path()); + $this->assertSame([], $uri->query()->toArray()); + $this->assertSame('', (string) $uri->query()); + $this->assertSame('', $uri->query()->decode()); $this->assertNull($uri->fragment()); $this->assertEquals($originalUri, (string) $uri); $uri = Uri::of('https://taylor:password@laravel.com/docs/installation?version=1#hello'); - $this->assertEquals('taylor', $uri->user()); - $this->assertEquals('password', $uri->password()); - $this->assertEquals('hello', $uri->fragment()); + $this->assertSame('taylor', $uri->user()); + $this->assertSame('password', $uri->password()); + $this->assertSame('hello', $uri->fragment()); $this->assertEquals(['version' => 1], $uri->query()->all()); $this->assertEquals(1, $uri->query()->integer('version')); - $this->assertEquals('taylor:password@laravel.com', $uri->authority()); + $this->assertSame('taylor:password@laravel.com', $uri->authority()); } public function test_is_empty_and_is_not_empty() @@ -58,15 +58,15 @@ public function test_without_fragment() { $uri = Uri::of('https://laravel.com/docs/installation#introduction'); - $this->assertEquals('introduction', $uri->fragment()); + $this->assertSame('introduction', $uri->fragment()); $withoutFragment = $uri->withoutFragment(); $this->assertNull($withoutFragment->fragment()); - $this->assertEquals('https://laravel.com/docs/installation', $withoutFragment->value()); + $this->assertSame('https://laravel.com/docs/installation', $withoutFragment->value()); // Original URI should be unchanged (immutability). - $this->assertEquals('introduction', $uri->fragment()); + $this->assertSame('introduction', $uri->fragment()); } public function test_without_fragment_on_uri_without_fragment() @@ -76,7 +76,7 @@ public function test_without_fragment_on_uri_without_fragment() $withoutFragment = $uri->withoutFragment(); $this->assertNull($withoutFragment->fragment()); - $this->assertEquals('https://laravel.com/docs', $withoutFragment->value()); + $this->assertSame('https://laravel.com/docs', $withoutFragment->value()); } public function test_complicated_query_string_parsing() @@ -107,7 +107,7 @@ public function test_complicated_query_string_parsing() 'flag_value' => '', ], $uri->query()->all()); - $this->assertEquals('key_1=value&key_2[sub_field]=value&key_3[]=value&key_4[9]=value&key_5[][][foo][9]=bar&key.6=value&flag_value', $uri->query()->decode()); + $this->assertSame('key_1=value&key_2[sub_field]=value&key_3[]=value&key_4[9]=value&key_5[][][foo][9]=bar&key.6=value&flag_value', $uri->query()->decode()); } public function test_uri_building() @@ -147,8 +147,8 @@ public function test_complicated_query_string_manipulation() 'flag' => '', ])->withoutQuery(['name']); - $this->assertEquals('age=38&role[title]=Developer&role[focus]=PHP&tags[0]=person&tags[1]=employee&flag=', $uri->query()->decode()); - $this->assertEquals('name=Taylor', $uri->replaceQuery(['name' => 'Taylor'])->query()->decode()); + $this->assertSame('age=38&role[title]=Developer&role[focus]=PHP&tags[0]=person&tags[1]=employee&flag=', $uri->query()->decode()); + $this->assertSame('name=Taylor', $uri->replaceQuery(['name' => 'Taylor'])->query()->decode()); // Push onto multi-value and missing items... $uri = Uri::of('https://laravel.com?tags[]=foo'); @@ -167,22 +167,22 @@ public function test_query_strings_with_dots_can_be_replaced_or_merged_consisten { $uri = Uri::of('https://dot.test/?foo.bar=baz'); - $this->assertEquals('foo.bar=baz&foo[bar]=zab', $uri->withQuery(['foo.bar' => 'zab'])->query()->decode()); - $this->assertEquals('foo[bar]=zab', $uri->replaceQuery(['foo.bar' => 'zab'])->query()->decode()); + $this->assertSame('foo.bar=baz&foo[bar]=zab', $uri->withQuery(['foo.bar' => 'zab'])->query()->decode()); + $this->assertSame('foo[bar]=zab', $uri->replaceQuery(['foo.bar' => 'zab'])->query()->decode()); } public function test_decoding_the_entire_uri() { $uri = Uri::of('https://laravel.com/docs/11.x/installation')->withQuery(['tags' => ['first', 'second']]); - $this->assertEquals('https://laravel.com/docs/11.x/installation?tags[0]=first&tags[1]=second', $uri->decode()); + $this->assertSame('https://laravel.com/docs/11.x/installation?tags[0]=first&tags[1]=second', $uri->decode()); } public function test_decoding_the_entire_uri_preserves_the_fragment() { $uri = Uri::of('https://laravel.com/docs/11.x/routing?q=laravel%20docs#route-model-binding'); - $this->assertEquals('https://laravel.com/docs/11.x/routing?q=laravel docs#route-model-binding', $uri->decode()); + $this->assertSame('https://laravel.com/docs/11.x/routing?q=laravel docs#route-model-binding', $uri->decode()); } public function test_with_query_if_missing() @@ -195,7 +195,7 @@ public function test_with_query_if_missing() 'existing' => 'new_value', ]); - $this->assertEquals('existing=value&new=parameter', $uri->query()->decode()); + $this->assertSame('existing=value&new=parameter', $uri->query()->decode()); // Test adding complex nested arrays to empty query string $uri = Uri::of('https://laravel.com'); @@ -212,7 +212,7 @@ public function test_with_query_if_missing() ], ]); - $this->assertEquals('name=Taylor&role[title]=Developer&role[focus]=PHP&tags[0]=person&tags[1]=employee', $uri->query()->decode()); + $this->assertSame('name=Taylor&role[title]=Developer&role[focus]=PHP&tags[0]=person&tags[1]=employee', $uri->query()->decode()); // Test partial array merging and preserving indexed arrays $uri = Uri::of('https://laravel.com?name=Taylor&tags[0]=person'); @@ -223,7 +223,7 @@ public function test_with_query_if_missing() 'tags' => ['should', 'not', 'change'], ]); - $this->assertEquals('name=Taylor&tags[0]=person&age=38', $uri->query()->decode()); + $this->assertSame('name=Taylor&tags[0]=person&age=38', $uri->query()->decode()); $this->assertEquals(['name' => 'Taylor', 'tags' => ['person'], 'age' => 38], $uri->query()->all()); $uri = Uri::of('https://laravel.com?user[name]=Taylor'); @@ -251,20 +251,20 @@ public function test_with_query_prevents_empty_query_string() { $uri = Uri::of('https://laravel.com'); - $this->assertEquals('https://laravel.com', (string) $uri); - $this->assertEquals('https://laravel.com', (string) $uri->withQuery([])); + $this->assertSame('https://laravel.com', (string) $uri); + $this->assertSame('https://laravel.com', (string) $uri->withQuery([])); } public function test_path_segments() { $uri = Uri::of('https://laravel.com'); - $this->assertEquals([], $uri->pathSegments()->toArray()); + $this->assertSame([], $uri->pathSegments()->toArray()); $uri = Uri::of('https://laravel.com/one/two/three'); $this->assertEquals(['one', 'two', 'three'], $uri->pathSegments()->toArray()); - $this->assertEquals('one', $uri->pathSegments()->first()); + $this->assertSame('one', $uri->pathSegments()->first()); $uri = Uri::of('https://laravel.com/one/two/three?foo=bar'); diff --git a/tests/Support/ValidatedInputTest.php b/tests/Support/ValidatedInputTest.php index af2e60d7352a..d6688d41f9be 100644 --- a/tests/Support/ValidatedInputTest.php +++ b/tests/Support/ValidatedInputTest.php @@ -556,6 +556,6 @@ public function test_except_method() $this->assertEquals(['name' => 'Fatih', 'surname' => 'AYDIN', 'foo' => ['bar' => null]], $input->except('foo.baz')); $this->assertEquals(['surname' => 'AYDIN'], $input->except('name', 'foo')); - $this->assertEquals([], $input->except('name', 'surname', 'foo')); + $this->assertSame([], $input->except('name', 'surname', 'foo')); } } diff --git a/tests/Testing/TestResponseTest.php b/tests/Testing/TestResponseTest.php index 0da214569104..ba4bbf05713e 100644 --- a/tests/Testing/TestResponseTest.php +++ b/tests/Testing/TestResponseTest.php @@ -246,7 +246,7 @@ public function testViewData(): void 'gatherData' => ['foo' => 'bar', 'baz' => 'qux'], ]); - $this->assertEquals('bar', $response->viewData('foo')); + $this->assertSame('bar', $response->viewData('foo')); $this->assertEquals(['foo' => 'bar', 'baz' => 'qux'], $response->viewData()); } diff --git a/tests/Translation/TranslationFileLoaderTest.php b/tests/Translation/TranslationFileLoaderTest.php index 22e4e674b2d5..b0e3180da791 100755 --- a/tests/Translation/TranslationFileLoaderTest.php +++ b/tests/Translation/TranslationFileLoaderTest.php @@ -161,7 +161,7 @@ public function testEmptyArraysReturnedWhenFilesDontExist() $files->shouldReceive('exists')->once()->with(__DIR__.'/en/foo.php')->andReturn(false); $files->shouldReceive('getRequire')->never(); - $this->assertEquals([], $loader->load('en', 'foo', null)); + $this->assertSame([], $loader->load('en', 'foo', null)); } public function testEmptyArraysReturnedWhenFilesDontExistForNamespacedItems() @@ -169,7 +169,7 @@ public function testEmptyArraysReturnedWhenFilesDontExistForNamespacedItems() $loader = new FileLoader($files = m::mock(Filesystem::class), __DIR__); $files->shouldReceive('getRequire')->never(); - $this->assertEquals([], $loader->load('en', 'foo', 'bar')); + $this->assertSame([], $loader->load('en', 'foo', 'bar')); } public function testLoadMethodForJSONProperlyCallsLoader() diff --git a/tests/Translation/TranslationMessageSelectorTest.php b/tests/Translation/TranslationMessageSelectorTest.php index ae9d8b6efe5d..ecccdd4da012 100755 --- a/tests/Translation/TranslationMessageSelectorTest.php +++ b/tests/Translation/TranslationMessageSelectorTest.php @@ -20,14 +20,14 @@ public function testChooseWithFloatDoesNotTriggerDeprecation() { $selector = new MessageSelector; - $this->assertEquals('many', $selector->choose('{0} zero|{1} one|[2,*] many', 2.75, 'pl')); + $this->assertSame('many', $selector->choose('{0} zero|{1} one|[2,*] many', 2.75, 'pl')); } public function testChoosePluralizesFloats() { $selector = new MessageSelector; - $this->assertEquals('plural', $selector->choose('singular|plural', 0.5, 'en')); + $this->assertSame('plural', $selector->choose('singular|plural', 0.5, 'en')); } public static function chooseTestData() diff --git a/tests/Translation/TranslationTranslatorTest.php b/tests/Translation/TranslationTranslatorTest.php index 5ac17aad8ca8..d965e873aed2 100755 --- a/tests/Translation/TranslationTranslatorTest.php +++ b/tests/Translation/TranslationTranslatorTest.php @@ -189,7 +189,7 @@ public function testChoiceMethodProperlyUsesCustomCountReplacement() $t->setSelector($selector = m::mock(MessageSelector::class)); $selector->shouldReceive('choose')->once()->with('{1} :count foos|[2,*] :count foos', 1234, 'en')->andReturn(':count foos'); - $this->assertEquals('1,234 foos', $t->choice(':count foos', 1234, ['count' => '1,234'])); + $this->assertSame('1,234 foos', $t->choice(':count foos', 1234, ['count' => '1,234'])); } public function testGetJson() diff --git a/tests/Validation/ValidationDateRuleTest.php b/tests/Validation/ValidationDateRuleTest.php index 04f99784839c..54f1766e961e 100644 --- a/tests/Validation/ValidationDateRuleTest.php +++ b/tests/Validation/ValidationDateRuleTest.php @@ -15,7 +15,7 @@ class ValidationDateRuleTest extends TestCase public function testDefaultDateRule() { $rule = Rule::date(); - $this->assertEquals('date', (string) $rule); + $this->assertSame('date', (string) $rule); $rule = new Date; $this->assertSame('date', (string) $rule); @@ -24,76 +24,76 @@ public function testDefaultDateRule() public function testDateFormatRule() { $rule = Rule::date()->format('d/m/Y'); - $this->assertEquals('date_format:d/m/Y', (string) $rule); + $this->assertSame('date_format:d/m/Y', (string) $rule); } public function testAfterTodayRule() { $rule = Rule::date()->afterToday(); - $this->assertEquals('date|after:today', (string) $rule); + $this->assertSame('date|after:today', (string) $rule); $rule = Rule::date()->todayOrAfter(); - $this->assertEquals('date|after_or_equal:today', (string) $rule); + $this->assertSame('date|after_or_equal:today', (string) $rule); } public function testBeforeTodayRule() { $rule = Rule::date()->beforeToday(); - $this->assertEquals('date|before:today', (string) $rule); + $this->assertSame('date|before:today', (string) $rule); $rule = Rule::date()->todayOrBefore(); - $this->assertEquals('date|before_or_equal:today', (string) $rule); + $this->assertSame('date|before_or_equal:today', (string) $rule); } public function testAfterSpecificDateRule() { $rule = Rule::date()->after(Carbon::parse('2024-01-01')); - $this->assertEquals('date|after:2024-01-01', (string) $rule); + $this->assertSame('date|after:2024-01-01', (string) $rule); $rule = Rule::date()->format('d/m/Y')->after(Carbon::parse('2024-01-01')); - $this->assertEquals('date_format:d/m/Y|after:01/01/2024', (string) $rule); + $this->assertSame('date_format:d/m/Y|after:01/01/2024', (string) $rule); } public function testBeforeSpecificDateRule() { $rule = Rule::date()->before(Carbon::parse('2024-01-01')); - $this->assertEquals('date|before:2024-01-01', (string) $rule); + $this->assertSame('date|before:2024-01-01', (string) $rule); $rule = Rule::date()->format('d/m/Y')->before(Carbon::parse('2024-01-01')); - $this->assertEquals('date_format:d/m/Y|before:01/01/2024', (string) $rule); + $this->assertSame('date_format:d/m/Y|before:01/01/2024', (string) $rule); } public function testAfterOrEqualSpecificDateRule() { $rule = Rule::date()->afterOrEqual(Carbon::parse('2024-01-01')); - $this->assertEquals('date|after_or_equal:2024-01-01', (string) $rule); + $this->assertSame('date|after_or_equal:2024-01-01', (string) $rule); $rule = Rule::date()->format('d/m/Y')->afterOrEqual(Carbon::parse('2024-01-01')); - $this->assertEquals('date_format:d/m/Y|after_or_equal:01/01/2024', (string) $rule); + $this->assertSame('date_format:d/m/Y|after_or_equal:01/01/2024', (string) $rule); } public function testBeforeOrEqualSpecificDateRule() { $rule = Rule::date()->beforeOrEqual(Carbon::parse('2024-01-01')); - $this->assertEquals('date|before_or_equal:2024-01-01', (string) $rule); + $this->assertSame('date|before_or_equal:2024-01-01', (string) $rule); $rule = Rule::date()->format('d/m/Y')->beforeOrEqual(Carbon::parse('2024-01-01')); - $this->assertEquals('date_format:d/m/Y|before_or_equal:01/01/2024', (string) $rule); + $this->assertSame('date_format:d/m/Y|before_or_equal:01/01/2024', (string) $rule); } public function testBetweenDatesRule() { $rule = Rule::date()->between(Carbon::parse('2024-01-01'), Carbon::parse('2024-02-01')); - $this->assertEquals('date|after:2024-01-01|before:2024-02-01', (string) $rule); + $this->assertSame('date|after:2024-01-01|before:2024-02-01', (string) $rule); $rule = Rule::date()->format('d/m/Y')->between(Carbon::parse('2024-01-01'), Carbon::parse('2024-02-01')); - $this->assertEquals('date_format:d/m/Y|after:01/01/2024|before:01/02/2024', (string) $rule); + $this->assertSame('date_format:d/m/Y|after:01/01/2024|before:01/02/2024', (string) $rule); } public function testBetweenOrEqualDatesRule() { $rule = Rule::date()->betweenOrEqual('2024-01-01', '2024-02-01'); - $this->assertEquals('date|after_or_equal:2024-01-01|before_or_equal:2024-02-01', (string) $rule); + $this->assertSame('date|after_or_equal:2024-01-01|before_or_equal:2024-02-01', (string) $rule); } public function testChainedRules() @@ -102,7 +102,7 @@ public function testChainedRules() ->format('Y-m-d') ->after('2024-01-01 00:00:00') ->before('2025-01-01 00:00:00'); - $this->assertEquals('date_format:Y-m-d|after:2024-01-01 00:00:00|before:2025-01-01 00:00:00', (string) $rule); + $this->assertSame('date_format:Y-m-d|after:2024-01-01 00:00:00|before:2025-01-01 00:00:00', (string) $rule); $rule = Rule::date() ->format('Y-m-d') diff --git a/tests/Validation/ValidationExceptionTest.php b/tests/Validation/ValidationExceptionTest.php index 5061f9e07d11..5a059dba2dcf 100755 --- a/tests/Validation/ValidationExceptionTest.php +++ b/tests/Validation/ValidationExceptionTest.php @@ -137,7 +137,7 @@ public function testExceptionErrorBagOneError() $exception = $this->getException([], ['foo' => 'required']); $exception->errorBag('milwad'); - $this->assertEquals('milwad', $exception->errorBag); + $this->assertSame('milwad', $exception->errorBag); } public function testExceptionRedirectToOneError() @@ -145,7 +145,7 @@ public function testExceptionRedirectToOneError() $exception = $this->getException([], ['foo' => 'required']); $exception->redirectTo('https://google.com'); - $this->assertEquals('https://google.com', $exception->redirectTo); + $this->assertSame('https://google.com', $exception->redirectTo); } public function testExceptionGetResponseOneError() diff --git a/tests/Validation/ValidationExcludeIfTest.php b/tests/Validation/ValidationExcludeIfTest.php index a616f642cc13..6edba31b0509 100644 --- a/tests/Validation/ValidationExcludeIfTest.php +++ b/tests/Validation/ValidationExcludeIfTest.php @@ -47,7 +47,7 @@ public function testItValidatesCallableAndBooleanAreAcceptableArguments() new ExcludeIf($condition); $this->fail('The ExcludeIf constructor must not accept '.gettype($condition)); } catch (InvalidArgumentException $exception) { - $this->assertEquals('The provided condition must be a callable or boolean.', $exception->getMessage()); + $this->assertSame('The provided condition must be a callable or boolean.', $exception->getMessage()); } } } diff --git a/tests/Validation/ValidationInArrayKeysTest.php b/tests/Validation/ValidationInArrayKeysTest.php index dec89209e398..ee542b59c980 100644 --- a/tests/Validation/ValidationInArrayKeysTest.php +++ b/tests/Validation/ValidationInArrayKeysTest.php @@ -67,7 +67,7 @@ public function testInArrayKeysValidationErrorMessage() $v = new Validator($trans, ['foo' => ['wrong_key' => 'bar']], ['foo' => 'in_array_keys:first_key,second_key']); $this->assertFalse($v->passes()); - $this->assertEquals( + $this->assertSame( 'The foo field must contain at least one of the following keys: first_key, second_key.', $v->messages()->first('foo') ); diff --git a/tests/Validation/ValidationNumericRuleTest.php b/tests/Validation/ValidationNumericRuleTest.php index 85b74a6728c1..7d8e5e5108f6 100644 --- a/tests/Validation/ValidationNumericRuleTest.php +++ b/tests/Validation/ValidationNumericRuleTest.php @@ -14,7 +14,7 @@ class ValidationNumericRuleTest extends TestCase public function testDefaultNumericRule() { $rule = Rule::numeric(); - $this->assertEquals('numeric', (string) $rule); + $this->assertSame('numeric', (string) $rule); $rule = new Numeric(); $this->assertSame('numeric', (string) $rule); @@ -23,118 +23,118 @@ public function testDefaultNumericRule() public function testBetweenRule() { $rule = Rule::numeric()->between(1, 10); - $this->assertEquals('numeric|between:1,10', (string) $rule); + $this->assertSame('numeric|between:1,10', (string) $rule); $rule = Rule::numeric()->between(1.5, 10.5); - $this->assertEquals('numeric|between:1.5,10.5', (string) $rule); + $this->assertSame('numeric|between:1.5,10.5', (string) $rule); } public function testDecimalRule() { $rule = Rule::numeric()->decimal(2, 4); - $this->assertEquals('numeric|decimal:2,4', (string) $rule); + $this->assertSame('numeric|decimal:2,4', (string) $rule); $rule = Rule::numeric()->decimal(2); - $this->assertEquals('numeric|decimal:2', (string) $rule); + $this->assertSame('numeric|decimal:2', (string) $rule); } public function testDifferentRule() { $rule = Rule::numeric()->different('some_field'); - $this->assertEquals('numeric|different:some_field', (string) $rule); + $this->assertSame('numeric|different:some_field', (string) $rule); } public function testDigitsRule() { $rule = Rule::numeric()->digits(10); - $this->assertEquals('numeric|integer|digits:10', (string) $rule); + $this->assertSame('numeric|integer|digits:10', (string) $rule); } public function testDigitsBetweenRule() { $rule = Rule::numeric()->digitsBetween(2, 10); - $this->assertEquals('numeric|integer|digits_between:2,10', (string) $rule); + $this->assertSame('numeric|integer|digits_between:2,10', (string) $rule); } public function testGreaterThanRule() { $rule = Rule::numeric()->greaterThan('some_field'); - $this->assertEquals('numeric|gt:some_field', (string) $rule); + $this->assertSame('numeric|gt:some_field', (string) $rule); } public function testGreaterThanOrEqualRule() { $rule = Rule::numeric()->greaterThanOrEqualTo('some_field'); - $this->assertEquals('numeric|gte:some_field', (string) $rule); + $this->assertSame('numeric|gte:some_field', (string) $rule); } public function testIntegerRule() { $rule = Rule::numeric()->integer(); - $this->assertEquals('numeric|integer', (string) $rule); + $this->assertSame('numeric|integer', (string) $rule); $rule = Rule::numeric()->integer(strict: true); - $this->assertEquals('numeric|integer:strict', (string) $rule); + $this->assertSame('numeric|integer:strict', (string) $rule); } public function testLessThanRule() { $rule = Rule::numeric()->lessThan('some_field'); - $this->assertEquals('numeric|lt:some_field', (string) $rule); + $this->assertSame('numeric|lt:some_field', (string) $rule); } public function testLessThanOrEqualRule() { $rule = Rule::numeric()->lessThanOrEqualTo('some_field'); - $this->assertEquals('numeric|lte:some_field', (string) $rule); + $this->assertSame('numeric|lte:some_field', (string) $rule); } public function testMaxRule() { $rule = Rule::numeric()->max(10); - $this->assertEquals('numeric|max:10', (string) $rule); + $this->assertSame('numeric|max:10', (string) $rule); $rule = Rule::numeric()->max(10.5); - $this->assertEquals('numeric|max:10.5', (string) $rule); + $this->assertSame('numeric|max:10.5', (string) $rule); } public function testMaxDigitsRule() { $rule = Rule::numeric()->maxDigits(10); - $this->assertEquals('numeric|max_digits:10', (string) $rule); + $this->assertSame('numeric|max_digits:10', (string) $rule); } public function testMinRule() { $rule = Rule::numeric()->min(10); - $this->assertEquals('numeric|min:10', (string) $rule); + $this->assertSame('numeric|min:10', (string) $rule); $rule = Rule::numeric()->min(10.5); - $this->assertEquals('numeric|min:10.5', (string) $rule); + $this->assertSame('numeric|min:10.5', (string) $rule); } public function testMinDigitsRule() { $rule = Rule::numeric()->minDigits(10); - $this->assertEquals('numeric|min_digits:10', (string) $rule); + $this->assertSame('numeric|min_digits:10', (string) $rule); } public function testMultipleOfRule() { $rule = Rule::numeric()->multipleOf(10); - $this->assertEquals('numeric|multiple_of:10', (string) $rule); + $this->assertSame('numeric|multiple_of:10', (string) $rule); } public function testSameRule() { $rule = Rule::numeric()->same('some_field'); - $this->assertEquals('numeric|same:some_field', (string) $rule); + $this->assertSame('numeric|same:some_field', (string) $rule); } public function testSizeRule() { $rule = Rule::numeric()->exactly(10); - $this->assertEquals('numeric|integer|size:10', (string) $rule); + $this->assertSame('numeric|integer|size:10', (string) $rule); } public function testChainedRules() @@ -144,7 +144,7 @@ public function testChainedRules() ->multipleOf(10) ->lessThanOrEqualTo('some_field') ->max(100); - $this->assertEquals('numeric|integer|multiple_of:10|lte:some_field|max:100', (string) $rule); + $this->assertSame('numeric|integer|multiple_of:10|lte:some_field|max:100', (string) $rule); $rule = Rule::numeric() ->decimal(2) @@ -356,6 +356,6 @@ public function testNumericValidation() public function testUniquenessValidation() { $rule = Rule::numeric()->integer()->digits(2)->exactly(2); - $this->assertEquals('numeric|integer|digits:2|size:2', (string) $rule); + $this->assertSame('numeric|integer|digits:2|size:2', (string) $rule); } } diff --git a/tests/Validation/ValidationProhibitedIfTest.php b/tests/Validation/ValidationProhibitedIfTest.php index c68eb88e95eb..bd6879c3ab5d 100644 --- a/tests/Validation/ValidationProhibitedIfTest.php +++ b/tests/Validation/ValidationProhibitedIfTest.php @@ -47,7 +47,7 @@ public function testItValidatesCallableAndBooleanAreAcceptableArguments() new ProhibitedIf($condition); $this->fail('The ProhibitedIf constructor must not accept '.gettype($condition)); } catch (InvalidArgumentException $exception) { - $this->assertEquals('The provided condition must be a callable or boolean.', $exception->getMessage()); + $this->assertSame('The provided condition must be a callable or boolean.', $exception->getMessage()); } } } diff --git a/tests/Validation/ValidationRuleCanTest.php b/tests/Validation/ValidationRuleCanTest.php index 039b9438b2f9..ecf7074c8012 100644 --- a/tests/Validation/ValidationRuleCanTest.php +++ b/tests/Validation/ValidationRuleCanTest.php @@ -59,7 +59,7 @@ protected function tearDown(): void public function testValidationFails() { $this->gate()->define('update-company', function ($user, $value) { - $this->assertEquals('1', $value); + $this->assertSame('1', $value); return false; }); @@ -78,7 +78,7 @@ public function testValidationPasses() $this->gate()->define('update-company', function ($user, $class, $model, $value) { $this->assertEquals(\App\Models\Company::class, $class); $this->assertInstanceOf(stdClass::class, $model); - $this->assertEquals('1', $value); + $this->assertSame('1', $value); return true; }); diff --git a/tests/Validation/ValidationRuleParserTest.php b/tests/Validation/ValidationRuleParserTest.php index 4f5cd7d51f69..564dc4d3f216 100644 --- a/tests/Validation/ValidationRuleParserTest.php +++ b/tests/Validation/ValidationRuleParserTest.php @@ -187,7 +187,7 @@ public function testExplodeGeneratesNestedRules() 'users.*.name' => Rule::forEach(function ($value, $attribute, $data, $context) { $this->assertSame('Taylor Otwell', $value); $this->assertSame('users.0.name', $attribute); - $this->assertEquals('Taylor Otwell', $data['users.0.name']); + $this->assertSame('Taylor Otwell', $data['users.0.name']); $this->assertEquals(['name' => 'Taylor Otwell', 'email' => 'taylor@laravel.com'], $context); return [Rule::requiredIf(true)]; @@ -217,7 +217,7 @@ public function testExplodeGeneratesNestedRulesForNonNestedData() ]); $this->assertEquals(['name' => ['required']], $results->rules); - $this->assertEquals([], $results->implicitAttributes); + $this->assertSame([], $results->implicitAttributes); } public function testExplodeHandlesForwardSlashesInWildcardRule() diff --git a/tests/Validation/ValidationValidatorTest.php b/tests/Validation/ValidationValidatorTest.php index eb8450c26b5a..a04905319707 100755 --- a/tests/Validation/ValidationValidatorTest.php +++ b/tests/Validation/ValidationValidatorTest.php @@ -4652,10 +4652,10 @@ public function testValidateGtMessagesAreCorrect() ]); $this->assertFalse($v->passes()); - $this->assertEquals('The numeric field must be greater than 10.', $v->messages()->first('numeric')); - $this->assertEquals('The string field must be greater than 5 characters.', $v->messages()->first('string')); - $this->assertEquals('The file field must be greater than 9 kilobytes.', $v->messages()->first('file')); - $this->assertEquals('The array field must have more than 4 items.', $v->messages()->first('array')); + $this->assertSame('The numeric field must be greater than 10.', $v->messages()->first('numeric')); + $this->assertSame('The string field must be greater than 5 characters.', $v->messages()->first('string')); + $this->assertSame('The file field must be greater than 9 kilobytes.', $v->messages()->first('file')); + $this->assertSame('The array field must have more than 4 items.', $v->messages()->first('array')); } public function testValidateGteMessagesAreCorrect() @@ -4692,10 +4692,10 @@ public function testValidateGteMessagesAreCorrect() ]); $this->assertFalse($v->passes()); - $this->assertEquals('The numeric field must be greater than or equal to 10.', $v->messages()->first('numeric')); - $this->assertEquals('The string field must be greater than or equal to 5 characters.', $v->messages()->first('string')); - $this->assertEquals('The file field must be greater than or equal to 9 kilobytes.', $v->messages()->first('file')); - $this->assertEquals('The array field must have 4 items or more.', $v->messages()->first('array')); + $this->assertSame('The numeric field must be greater than or equal to 10.', $v->messages()->first('numeric')); + $this->assertSame('The string field must be greater than or equal to 5 characters.', $v->messages()->first('string')); + $this->assertSame('The file field must be greater than or equal to 9 kilobytes.', $v->messages()->first('file')); + $this->assertSame('The array field must have 4 items or more.', $v->messages()->first('array')); } public function testValidateLtMessagesAreCorrect() @@ -4732,10 +4732,10 @@ public function testValidateLtMessagesAreCorrect() ]); $this->assertFalse($v->passes()); - $this->assertEquals('The numeric field must be less than 5.', $v->messages()->first('numeric')); - $this->assertEquals('The string field must be less than 3 characters.', $v->messages()->first('string')); - $this->assertEquals('The file field must be less than 8 kilobytes.', $v->messages()->first('file')); - $this->assertEquals('The array field must have less than 2 items.', $v->messages()->first('array')); + $this->assertSame('The numeric field must be less than 5.', $v->messages()->first('numeric')); + $this->assertSame('The string field must be less than 3 characters.', $v->messages()->first('string')); + $this->assertSame('The file field must be less than 8 kilobytes.', $v->messages()->first('file')); + $this->assertSame('The array field must have less than 2 items.', $v->messages()->first('array')); } public function testValidateLteMessagesAreCorrect() @@ -4772,10 +4772,10 @@ public function testValidateLteMessagesAreCorrect() ]); $this->assertFalse($v->passes()); - $this->assertEquals('The numeric field must be less than or equal to 5.', $v->messages()->first('numeric')); - $this->assertEquals('The string field must be less than or equal to 3 characters.', $v->messages()->first('string')); - $this->assertEquals('The file field must be less than or equal to 8 kilobytes.', $v->messages()->first('file')); - $this->assertEquals('The array field must not have more than 2 items.', $v->messages()->first('array')); + $this->assertSame('The numeric field must be less than or equal to 5.', $v->messages()->first('numeric')); + $this->assertSame('The string field must be less than or equal to 3 characters.', $v->messages()->first('string')); + $this->assertSame('The file field must be less than or equal to 8 kilobytes.', $v->messages()->first('file')); + $this->assertSame('The array field must not have more than 2 items.', $v->messages()->first('array')); } public function testValidateIp() @@ -6954,7 +6954,7 @@ public function testItemAwareSometimesAddingRules() $v->sometimes(['users'], 'array', function ($i, $item) { return (bool) $item; }); - $this->assertEquals([], $v->getRules()); + $this->assertSame([], $v->getRules()); // ['company.users'] -> if users is not empty it must be validated as array $trans = $this->getIlluminateArrayTranslator(); diff --git a/tests/View/Blade/BladeBoolTest.php b/tests/View/Blade/BladeBoolTest.php index 8fb87f6cb963..5ed0a47a9db6 100644 --- a/tests/View/Blade/BladeBoolTest.php +++ b/tests/View/Blade/BladeBoolTest.php @@ -34,28 +34,28 @@ public function testCompileBool(): void ob_start(); eval(substr($compiled, 6, -3)); - $this->assertEquals('true', ob_get_clean()); + $this->assertSame('true', ob_get_clean()); $someViewVarFalsey = '0'; $compiled = $this->compiler->compileString('@bool($someViewVarFalsey)'); ob_start(); eval(substr($compiled, 6, -3)); - $this->assertEquals('false', ob_get_clean()); + $this->assertSame('false', ob_get_clean()); $anotherSomeViewVarTruthy = new SomeClass(); $compiled = $this->compiler->compileString('@bool($anotherSomeViewVarTruthy)'); ob_start(); eval(substr($compiled, 6, -3)); - $this->assertEquals('true', ob_get_clean()); + $this->assertSame('true', ob_get_clean()); $anotherSomeViewVarFalsey = null; $compiled = $this->compiler->compileString('@bool($anotherSomeViewVarFalsey)'); ob_start(); eval(substr($compiled, 6, -3)); - $this->assertEquals('false', ob_get_clean()); + $this->assertSame('false', ob_get_clean()); } } diff --git a/tests/View/ViewComponentAttributeBagTest.php b/tests/View/ViewComponentAttributeBagTest.php index a2293e6e5f19..0a972ba60e4c 100644 --- a/tests/View/ViewComponentAttributeBagTest.php +++ b/tests/View/ViewComponentAttributeBagTest.php @@ -279,7 +279,7 @@ public function testWhenFilled() $result = $bag->whenFilled('name', function ($value) { return 'callback-'.$value; }); - $this->assertEquals('callback-test', $result); + $this->assertSame('callback-test', $result); $result = $bag->whenFilled('empty', function ($value) { return 'callback-'.$value; @@ -291,7 +291,7 @@ public function testWhenFilled() }, function () { return 'default-callback'; }); - $this->assertEquals('default-callback', $result); + $this->assertSame('default-callback', $result); } public function testWhenHas() @@ -301,7 +301,7 @@ public function testWhenHas() $result = $bag->whenHas('name', function ($value) { return 'callback-'.$value; }); - $this->assertEquals('callback-test', $result); + $this->assertSame('callback-test', $result); $result = $bag->whenHas('missing', function ($value) { return 'callback-'.$value; @@ -313,7 +313,7 @@ public function testWhenHas() }, function () { return 'default-callback'; }); - $this->assertEquals('default-callback', $result); + $this->assertSame('default-callback', $result); } public function testWhenMissing() @@ -328,14 +328,14 @@ public function testWhenMissing() $result = $bag->whenMissing('missing', function () { return 'callback'; }); - $this->assertEquals('callback', $result); + $this->assertSame('callback', $result); $result = $bag->whenMissing('name', function () { return 'callback'; }, function () { return 'default-callback'; }); - $this->assertEquals('default-callback', $result); + $this->assertSame('default-callback', $result); } public function testString() @@ -347,10 +347,10 @@ public function testString() ]); $this->assertInstanceOf(\Illuminate\Support\Stringable::class, $bag->string('name')); - $this->assertEquals('test', (string) $bag->string('name')); - $this->assertEquals('', (string) $bag->string('empty')); - $this->assertEquals('123', (string) $bag->string('number')); - $this->assertEquals('default', (string) $bag->string('missing', 'default')); + $this->assertSame('test', (string) $bag->string('name')); + $this->assertSame('', (string) $bag->string('empty')); + $this->assertSame('123', (string) $bag->string('number')); + $this->assertSame('default', (string) $bag->string('missing', 'default')); } public function testBoolean()