Skip to content

Commit 4c95784

Browse files
authored
Enforce stricter assertions. (#41165)
1 parent bb4d381 commit 4c95784

31 files changed

+159
-159
lines changed

tests/Cache/CacheManagerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function testCustomDriverOverridesInternalDrivers()
5656

5757
$driver = $cacheManager->store('my_store');
5858

59-
$this->assertEquals('mm(u_u)mm', $driver->flag);
59+
$this->assertSame('mm(u_u)mm', $driver->flag);
6060
}
6161

6262
public function testItMakesRepositoryWhenContainerHasNoDispatcher()

tests/Cache/CacheRateLimiterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function testAttemptsCallbackReturnsCallbackReturn()
105105

106106
$rateLimiter = new RateLimiter($cache);
107107

108-
$this->assertEquals('foo', $rateLimiter->attempt('key', 1, function () {
108+
$this->assertSame('foo', $rateLimiter->attempt('key', 1, function () {
109109
return 'foo';
110110
}, 1));
111111
}

tests/Console/ConsoleEventSchedulerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,15 @@ public function testItUsesCommandDescriptionAsEventDescription()
124124
{
125125
$schedule = $this->schedule;
126126
$event = $schedule->command(ConsoleCommandStub::class);
127-
$this->assertEquals('This is a description about the command', $event->description);
127+
$this->assertSame('This is a description about the command', $event->description);
128128
}
129129

130130
public function testItShouldBePossibleToOverwriteTheDescription()
131131
{
132132
$schedule = $this->schedule;
133133
$event = $schedule->command(ConsoleCommandStub::class)
134134
->description('This is an alternative description');
135-
$this->assertEquals('This is an alternative description', $event->description);
135+
$this->assertSame('This is an alternative description', $event->description);
136136
}
137137

138138
public function testCallCreatesNewJobWithTimezone()

tests/Cookie/CookieTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,10 @@ public function testExpire()
120120
$cookieJar->expire('foobar', '/path', '/domain');
121121

122122
$cookie = $cookieJar->queued('foobar');
123-
$this->assertEquals('foobar', $cookie->getName());
123+
$this->assertSame('foobar', $cookie->getName());
124124
$this->assertEquals(null, $cookie->getValue());
125-
$this->assertEquals('/path', $cookie->getPath());
126-
$this->assertEquals('/domain', $cookie->getDomain());
125+
$this->assertSame('/path', $cookie->getPath());
126+
$this->assertSame('/domain', $cookie->getDomain());
127127
$this->assertTrue($cookie->getExpiresTime() < time());
128128
$this->assertCount(1, $cookieJar->getQueuedCookies());
129129
}

tests/Database/DatabaseEloquentBelongsToManySyncReturnValueTypeTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function testSyncReturnValueType()
9090
});
9191

9292
$user->articles->each(function (BelongsToManySyncTestTestArticle $article) {
93-
$this->assertEquals('0', $article->pivot->visible);
93+
$this->assertSame('0', (string) $article->pivot->visible);
9494
});
9595
}
9696

@@ -108,7 +108,7 @@ public function testSyncWithPivotDefaultsReturnValueType()
108108
});
109109

110110
$user->articles->each(function (BelongsToManySyncTestTestArticle $article) {
111-
$this->assertEquals('1', $article->pivot->visible);
111+
$this->assertSame('1', (string) $article->pivot->visible);
112112
});
113113
}
114114

tests/Database/DatabaseEloquentBelongsToManySyncTouchesParentTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function testSyncWithDetachedValuesShouldTouch()
8989
Carbon::setTestNow('2021-07-20 19:13:14');
9090
$result = $article->users()->sync([1, 2]);
9191
$this->assertCount(1, collect($result['detached']));
92-
$this->assertSame('3', collect($result['detached'])->first());
92+
$this->assertSame('3', (string) collect($result['detached'])->first());
9393

9494
$article->refresh();
9595
$this->assertSame('2021-07-20 19:13:14', $article->updated_at->format('Y-m-d H:i:s'));

tests/Database/DatabaseEloquentBelongsToTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function __toString()
127127

128128
$this->assertEquals(1, $models[0]->foo->getAttribute('id'));
129129
$this->assertEquals(2, $models[1]->foo->getAttribute('id'));
130-
$this->assertEquals('3', $models[2]->foo->getAttribute('id'));
130+
$this->assertSame('3', (string) $models[2]->foo->getAttribute('id'));
131131
}
132132

133133
public function testAssociateMethodSetsForeignKeyOnModel()

tests/Database/DatabaseEloquentHasOneTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public function __toString()
183183
$this->assertEquals(1, $models[0]->foo->foreign_key);
184184
$this->assertEquals(2, $models[1]->foo->foreign_key);
185185
$this->assertNull($models[2]->foo);
186-
$this->assertEquals('4', $models[3]->foo->foreign_key);
186+
$this->assertSame('4', (string) $models[3]->foo->foreign_key);
187187
}
188188

189189
public function testRelationCountQueryCanBeBuilt()

tests/Database/DatabaseEloquentStrictMorphsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function testStrictModeDoesNotThrowExceptionWhenMorphMap()
3434
]);
3535

3636
$morphName = $model->getMorphClass();
37-
$this->assertEquals('test', $morphName);
37+
$this->assertSame('test', $morphName);
3838
}
3939

4040
public function testMapsCanBeEnforcedInOneMethod()
@@ -48,7 +48,7 @@ public function testMapsCanBeEnforcedInOneMethod()
4848
]);
4949

5050
$morphName = $model->getMorphClass();
51-
$this->assertEquals('test', $morphName);
51+
$this->assertSame('test', $morphName);
5252
}
5353

5454
protected function tearDown(): void

tests/Foundation/FoundationFormRequestTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function testValidatedMethodReturnsOnlyRequestedValidatedData()
135135

136136
$request->validateResolved();
137137

138-
$this->assertEquals('specified', $request->validated('name'));
138+
$this->assertSame('specified', $request->validated('name'));
139139
}
140140

141141
public function testValidatedMethodReturnsOnlyRequestedNestedValidatedData()
@@ -146,7 +146,7 @@ public function testValidatedMethodReturnsOnlyRequestedNestedValidatedData()
146146

147147
$request->validateResolved();
148148

149-
$this->assertEquals('bar', $request->validated('nested.foo'));
149+
$this->assertSame('bar', $request->validated('nested.foo'));
150150
}
151151

152152
/**

0 commit comments

Comments
 (0)