Commit b8a481ee authored by Gabriel Caruso's avatar Gabriel Caruso Committed by Jeremy Mikola

Use dedicated PHPUnit assertions

parent f4801b80
...@@ -91,7 +91,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase ...@@ -91,7 +91,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase
$commandResult = current($cursor->toArray()); $commandResult = current($cursor->toArray());
$this->assertCommandSucceeded($commandResult); $this->assertCommandSucceeded($commandResult);
$this->assertTrue(isset($commandResult->ismaster)); $this->assertObjectHasAttribute('ismaster', $commandResult);
$this->assertTrue($commandResult->ismaster); $this->assertTrue($commandResult->ismaster);
} }
...@@ -110,7 +110,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase ...@@ -110,7 +110,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase
$this->assertCommandSucceeded($commandResult); $this->assertCommandSucceeded($commandResult);
$this->assertInternalType('array', $commandResult); $this->assertInternalType('array', $commandResult);
$this->assertTrue(isset($commandResult['ismaster'])); $this->assertArrayHasKey('ismaster', $commandResult);
$this->assertTrue($commandResult['ismaster']); $this->assertTrue($commandResult['ismaster']);
} }
......
...@@ -80,7 +80,7 @@ class IndexInfoTest extends TestCase ...@@ -80,7 +80,7 @@ class IndexInfoTest extends TestCase
$this->assertFalse($info->isSparse()); $this->assertFalse($info->isSparse());
$this->assertTrue($info->isTtl()); $this->assertTrue($info->isTtl());
$this->assertFalse($info->isUnique()); $this->assertFalse($info->isUnique());
$this->assertTrue(isset($info['expireAfterSeconds'])); $this->assertArrayHasKey('expireAfterSeconds', $info);
$this->assertSame(100, $info['expireAfterSeconds']); $this->assertSame(100, $info['expireAfterSeconds']);
} }
...@@ -107,7 +107,7 @@ class IndexInfoTest extends TestCase ...@@ -107,7 +107,7 @@ class IndexInfoTest extends TestCase
]); ]);
$this->assertInstanceOf('ArrayAccess', $info); $this->assertInstanceOf('ArrayAccess', $info);
$this->assertTrue(isset($info['name'])); $this->assertArrayHasKey('name', $info);
$this->assertSame('x_1', $info['name']); $this->assertSame('x_1', $info['name']);
} }
......
...@@ -143,7 +143,7 @@ class ChangeStreamFunctionalTest extends FunctionalTestCase ...@@ -143,7 +143,7 @@ class ChangeStreamFunctionalTest extends FunctionalTestCase
$changeStreamResult = $this->collection->watch(); $changeStreamResult = $this->collection->watch();
$this->assertSame(null, $changeStreamResult->key()); $this->assertNull($changeStreamResult->key());
$result = $this->collection->insertOne(['x' => 1]); $result = $this->collection->insertOne(['x' => 1]);
$this->assertInstanceOf('MongoDB\InsertOneResult', $result); $this->assertInstanceOf('MongoDB\InsertOneResult', $result);
...@@ -153,15 +153,15 @@ class ChangeStreamFunctionalTest extends FunctionalTestCase ...@@ -153,15 +153,15 @@ class ChangeStreamFunctionalTest extends FunctionalTestCase
$this->assertSame(1, $changeStreamResult->key()); $this->assertSame(1, $changeStreamResult->key());
$changeStreamResult->next(); $changeStreamResult->next();
$this->assertSame(null, $changeStreamResult->key()); $this->assertNull($changeStreamResult->key());
$changeStreamResult->next(); $changeStreamResult->next();
$this->assertSame(null, $changeStreamResult->key()); $this->assertNull($changeStreamResult->key());
$operation = new DatabaseCommand($this->getDatabaseName(), ["killCursors" => $this->getCollectionName(), "cursors" => [$changeStreamResult->getCursorId()]]); $operation = new DatabaseCommand($this->getDatabaseName(), ["killCursors" => $this->getCollectionName(), "cursors" => [$changeStreamResult->getCursorId()]]);
$operation->execute($this->getPrimaryServer()); $operation->execute($this->getPrimaryServer());
$changeStreamResult->next(); $changeStreamResult->next();
$this->assertSame(null, $changeStreamResult->key()); $this->assertNull($changeStreamResult->key());
$result = $this->collection->insertOne(['x' => 2]); $result = $this->collection->insertOne(['x' => 2]);
$this->assertInstanceOf('MongoDB\InsertOneResult', $result); $this->assertInstanceOf('MongoDB\InsertOneResult', $result);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment