Skip to content

Commit 20479d4

Browse files
committed
AssertEquals instead of AssertSame
1 parent 5809d9b commit 20479d4

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/Codeception/Module/MongoDb.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ public function seeElementIsArray(string $collection, array $criteria = [], stri
408408
'Error: you should test against a single element criteria when asserting that elementIsArray'
409409
);
410410
}
411-
\PHPUnit\Framework\Assert::assertEquals(1, $res, 'Specified element is not a Mongo Object');
411+
\PHPUnit\Framework\Assert::assertSame(1, $res, 'Specified element is not a Mongo Object');
412412
}
413413

414414
/**
@@ -437,7 +437,7 @@ public function seeElementIsObject(string $collection, array $criteria = [], str
437437
'Error: you should test against a single element criteria when asserting that elementIsObject'
438438
);
439439
}
440-
\PHPUnit\Framework\Assert::assertEquals(1, $res, 'Specified element is not a Mongo Object');
440+
\PHPUnit\Framework\Assert::assertSame(1, $res, 'Specified element is not a Mongo Object');
441441
}
442442

443443
/**

tests/unit/Codeception/Module/MongoDbTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function testGrabFromCollection()
9090
{
9191
$user = $this->module->grabFromCollection('users', ['id' => 1]);
9292
$this->assertArrayHasKey('email', $user);
93-
$this->assertEquals('miles@davis.com', $user['email']);
93+
$this->assertSame('miles@davis.com', $user['email']);
9494
}
9595

9696
public function testSeeNumElementsInCollection()
@@ -105,8 +105,8 @@ public function testGrabCollectionCount()
105105
$this->userCollection->insertOne(['id' => 2, 'email' => 'louis@armstrong.com']);
106106
$this->userCollection->insertOne(['id' => 3, 'email' => 'dizzy@gillespie.com']);
107107

108-
$this->assertEquals(1, $this->module->grabCollectionCount('users', ['id' => 3]));
109-
$this->assertEquals(3, $this->module->grabCollectionCount('users'));
108+
$this->assertSame(1, $this->module->grabCollectionCount('users', ['id' => 3]));
109+
$this->assertSame(3, $this->module->grabCollectionCount('users'));
110110
}
111111

112112
public function testSeeElementIsArray()
@@ -191,17 +191,17 @@ public function testCleanupDirty()
191191

192192
$hash1 = $this->module->driver->getDbHash();
193193
$this->module->seeNumElementsInCollection('96_bulls', 7);
194-
$this->assertEquals($hash1, $this->module->driver->getDbHash());
194+
$this->assertSame($hash1, $this->module->driver->getDbHash());
195195

196196
$this->module->_after($test);
197197

198198
$this->module->_before($test); // No cleanup expected
199199

200-
$this->assertEquals($hash1, $this->module->driver->getDbHash());
200+
$this->assertSame($hash1, $this->module->driver->getDbHash());
201201
$collection->insertOne(['name' => 'Coby White','position' => 'pg']);
202202

203203
$hashDirty = $this->module->driver->getDbHash();
204-
$this->assertNotEquals($hash1, $hashDirty);
204+
$this->assertNotSame($hash1, $hashDirty);
205205

206206
$this->module->_after($test);
207207

@@ -210,13 +210,13 @@ public function testCleanupDirty()
210210

211211
$hash2 = $this->module->driver->getDbHash();
212212

213-
$this->assertNotEquals($hash1, $hash2);
214-
$this->assertNotEquals($hashDirty, $hash2);
213+
$this->assertNotSame($hash1, $hash2);
214+
$this->assertNotSame($hashDirty, $hash2);
215215

216216
$this->module->_after($test);
217217

218218
$this->module->_before($test); // No cleanup expected
219219

220-
$this->assertEquals($hash2, $this->module->driver->getDbHash());
220+
$this->assertSame($hash2, $this->module->driver->getDbHash());
221221
}
222222
}

0 commit comments

Comments
 (0)