Skip to content

Commit

Permalink
PHPLIB-1515 Replace assertObjectHasAttribute with assertObjectHasProp…
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN authored Sep 13, 2024
1 parent 3929135 commit ae90e89
Show file tree
Hide file tree
Showing 35 changed files with 143 additions and 143 deletions.
18 changes: 9 additions & 9 deletions tests/Collection/CollectionFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,13 @@ function (): void {
},
function (array $event): void {
$command = $event['started']->getCommand();
$this->assertObjectHasAttribute('comment', $command);
$this->assertObjectHasAttribute('commitQuorum', $command);
$this->assertObjectHasAttribute('lsid', $command);
$this->assertObjectHasAttribute('maxTimeMS', $command);
$this->assertObjectHasAttribute('writeConcern', $command);
$this->assertObjectHasAttribute('sparse', $command->indexes[0]);
$this->assertObjectHasAttribute('unique', $command->indexes[0]);
$this->assertObjectHasProperty('comment', $command);
$this->assertObjectHasProperty('commitQuorum', $command);
$this->assertObjectHasProperty('lsid', $command);
$this->assertObjectHasProperty('maxTimeMS', $command);
$this->assertObjectHasProperty('writeConcern', $command);
$this->assertObjectHasProperty('sparse', $command->indexes[0]);
$this->assertObjectHasProperty('unique', $command->indexes[0]);
},
);
}
Expand Down Expand Up @@ -752,8 +752,8 @@ function () use ($method, $collection, $session): void {
call_user_func($method, $collection, $session);
},
function (array $event): void {
$this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand());
$this->assertObjectNotHasAttribute('readConcern', $event['started']->getCommand());
$this->assertObjectNotHasProperty('writeConcern', $event['started']->getCommand());
$this->assertObjectNotHasProperty('readConcern', $event['started']->getCommand());
},
);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Database/DatabaseFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function testCommand(): void
$commandResult = current($cursor->toArray());

$this->assertCommandSucceeded($commandResult);
$this->assertObjectHasAttribute('ok', $commandResult);
$this->assertObjectHasProperty('ok', $commandResult);
$this->assertSame(1, (int) $commandResult->ok);
}

Expand Down
48 changes: 24 additions & 24 deletions tests/DocumentationExamplesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ public function testExample_42_50(): void
$this->assertCount(3, $documents);
foreach ($documents as $document) {
foreach (['_id', 'item', 'status', 'size', 'instock'] as $field) {
$this->assertObjectHasAttribute($field, $document);
$this->assertObjectHasProperty($field, $document);
}
}

Expand All @@ -606,11 +606,11 @@ public function testExample_42_50(): void
$this->assertCount(3, $documents);
foreach ($documents as $document) {
foreach (['_id', 'item', 'status'] as $field) {
$this->assertObjectHasAttribute($field, $document);
$this->assertObjectHasProperty($field, $document);
}

foreach (['size', 'instock'] as $field) {
$this->assertObjectNotHasAttribute($field, $document);
$this->assertObjectNotHasProperty($field, $document);
}
}

Expand All @@ -625,11 +625,11 @@ public function testExample_42_50(): void
$this->assertCount(3, $documents);
foreach ($documents as $document) {
foreach (['item', 'status'] as $field) {
$this->assertObjectHasAttribute($field, $document);
$this->assertObjectHasProperty($field, $document);
}

foreach (['_id', 'size', 'instock'] as $field) {
$this->assertObjectNotHasAttribute($field, $document);
$this->assertObjectNotHasProperty($field, $document);
}
}

Expand All @@ -644,11 +644,11 @@ public function testExample_42_50(): void
$this->assertCount(3, $documents);
foreach ($documents as $document) {
foreach (['_id', 'item', 'size'] as $field) {
$this->assertObjectHasAttribute($field, $document);
$this->assertObjectHasProperty($field, $document);
}

foreach (['status', 'instock'] as $field) {
$this->assertObjectNotHasAttribute($field, $document);
$this->assertObjectNotHasProperty($field, $document);
}
}

Expand All @@ -663,13 +663,13 @@ public function testExample_42_50(): void
$this->assertCount(3, $documents);
foreach ($documents as $document) {
foreach (['_id', 'item', 'status', 'size'] as $field) {
$this->assertObjectHasAttribute($field, $document);
$this->assertObjectHasProperty($field, $document);
}

$this->assertObjectNotHasAttribute('instock', $document);
$this->assertObjectHasAttribute('uom', $document->size);
$this->assertObjectNotHasAttribute('h', $document->size);
$this->assertObjectNotHasAttribute('w', $document->size);
$this->assertObjectNotHasProperty('instock', $document);
$this->assertObjectHasProperty('uom', $document->size);
$this->assertObjectNotHasProperty('h', $document->size);
$this->assertObjectNotHasProperty('w', $document->size);
}

// Start Example 48
Expand All @@ -683,12 +683,12 @@ public function testExample_42_50(): void
$this->assertCount(3, $documents);
foreach ($documents as $document) {
foreach (['_id', 'item', 'status', 'size', 'instock'] as $field) {
$this->assertObjectHasAttribute($field, $document);
$this->assertObjectHasProperty($field, $document);
}

$this->assertObjectHasAttribute('h', $document->size);
$this->assertObjectHasAttribute('w', $document->size);
$this->assertObjectNotHasAttribute('uom', $document->size);
$this->assertObjectHasProperty('h', $document->size);
$this->assertObjectHasProperty('w', $document->size);
$this->assertObjectNotHasProperty('uom', $document->size);
}

// Start Example 49
Expand All @@ -702,13 +702,13 @@ public function testExample_42_50(): void
$this->assertCount(3, $documents);
foreach ($documents as $document) {
foreach (['_id', 'item', 'status', 'instock'] as $field) {
$this->assertObjectHasAttribute($field, $document);
$this->assertObjectHasProperty($field, $document);
}

$this->assertObjectNotHasAttribute('size', $document);
$this->assertObjectNotHasProperty('size', $document);
foreach ($document->instock as $instock) {
$this->assertObjectHasAttribute('qty', $instock);
$this->assertObjectNotHasAttribute('warehouse', $instock);
$this->assertObjectHasProperty('qty', $instock);
$this->assertObjectNotHasProperty('warehouse', $instock);
}
}

Expand All @@ -723,10 +723,10 @@ public function testExample_42_50(): void
$this->assertCount(3, $documents);
foreach ($documents as $document) {
foreach (['_id', 'item', 'status', 'instock'] as $field) {
$this->assertObjectHasAttribute($field, $document);
$this->assertObjectHasProperty($field, $document);
}

$this->assertObjectNotHasAttribute('size', $document);
$this->assertObjectNotHasProperty('size', $document);
$this->assertCount(1, $document->instock);
}
}
Expand Down Expand Up @@ -786,10 +786,10 @@ public function testAggregationProjectionExample_1(): void
$this->assertCount(3, $documents);
foreach ($documents as $document) {
foreach (['item', 'status', 'area', 'reportNumber'] as $field) {
$this->assertObjectHasAttribute($field, $document);
$this->assertObjectHasProperty($field, $document);
}

$this->assertObjectNotHasAttribute('_id', $document);
$this->assertObjectNotHasProperty('_id', $document);
$this->assertIsString($document->status);
$this->assertIsString($document->area);
$this->assertSame(1, $document->reportNumber);
Expand Down
18 changes: 9 additions & 9 deletions tests/Operation/AggregateFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function (): void {
$operation->execute($this->getPrimaryServer());
},
function (array $event): void {
$this->assertObjectNotHasAttribute('allowDiskUse', $event['started']->getCommand());
$this->assertObjectNotHasProperty('allowDiskUse', $event['started']->getCommand());
},
);
}
Expand Down Expand Up @@ -92,7 +92,7 @@ function (): void {
$operation->execute($this->getPrimaryServer());
},
function (array $event): void {
$this->assertObjectNotHasAttribute('readConcern', $event['started']->getCommand());
$this->assertObjectNotHasProperty('readConcern', $event['started']->getCommand());
},
);
}
Expand All @@ -111,7 +111,7 @@ function (): void {
$operation->execute($this->getPrimaryServer());
},
function (array $event): void {
$this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand());
$this->assertObjectNotHasProperty('writeConcern', $event['started']->getCommand());
},
);

Expand Down Expand Up @@ -156,7 +156,7 @@ function (): void {
$operation->execute($this->getPrimaryServer());
},
function (array $event): void {
$this->assertObjectHasAttribute('lsid', $event['started']->getCommand());
$this->assertObjectHasProperty('lsid', $event['started']->getCommand());
},
);
}
Expand Down Expand Up @@ -218,14 +218,14 @@ function () use ($pipeline, $options): void {

if (isset($result->shards)) {
foreach ($result->shards as $shard) {
$this->assertObjectHasAttribute('stages', $shard);
$this->assertObjectHasProperty('stages', $shard);
}
} else {
$this->assertObjectHasAttribute('stages', $result);
$this->assertObjectHasProperty('stages', $result);
}
},
function (array $event): void {
$this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand());
$this->assertObjectNotHasProperty('writeConcern', $event['started']->getCommand());
},
);

Expand All @@ -246,7 +246,7 @@ function (): void {
$operation->execute($this->getPrimaryServer());
},
function (array $event): void {
$this->assertObjectHasAttribute('bypassDocumentValidation', $event['started']->getCommand());
$this->assertObjectHasProperty('bypassDocumentValidation', $event['started']->getCommand());
$this->assertEquals(true, $event['started']->getCommand()->bypassDocumentValidation);
},
);
Expand All @@ -266,7 +266,7 @@ function (): void {
$operation->execute($this->getPrimaryServer());
},
function (array $event): void {
$this->assertObjectNotHasAttribute('bypassDocumentValidation', $event['started']->getCommand());
$this->assertObjectNotHasProperty('bypassDocumentValidation', $event['started']->getCommand());
},
);
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Operation/BulkWriteFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ function (): void {
$operation->execute($this->getPrimaryServer());
},
function (array $event): void {
$this->assertObjectHasAttribute('lsid', $event['started']->getCommand());
$this->assertObjectHasProperty('lsid', $event['started']->getCommand());
},
);
}
Expand All @@ -398,7 +398,7 @@ function (): void {
$operation->execute($this->getPrimaryServer());
},
function (array $event): void {
$this->assertObjectHasAttribute('bypassDocumentValidation', $event['started']->getCommand());
$this->assertObjectHasProperty('bypassDocumentValidation', $event['started']->getCommand());
$this->assertEquals(true, $event['started']->getCommand()->bypassDocumentValidation);
},
);
Expand All @@ -418,7 +418,7 @@ function (): void {
$operation->execute($this->getPrimaryServer());
},
function (array $event): void {
$this->assertObjectNotHasAttribute('bypassDocumentValidation', $event['started']->getCommand());
$this->assertObjectNotHasProperty('bypassDocumentValidation', $event['started']->getCommand());
},
);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Operation/CountFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function (): void {
$operation->execute($this->getPrimaryServer());
},
function (array $event): void {
$this->assertObjectNotHasAttribute('readConcern', $event['started']->getCommand());
$this->assertObjectNotHasProperty('readConcern', $event['started']->getCommand());
},
);
}
Expand Down Expand Up @@ -99,7 +99,7 @@ function (): void {
$operation->execute($this->getPrimaryServer());
},
function (array $event): void {
$this->assertObjectHasAttribute('lsid', $event['started']->getCommand());
$this->assertObjectHasProperty('lsid', $event['started']->getCommand());
},
);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Operation/CreateCollectionFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function (): void {
$operation->execute($this->getPrimaryServer());
},
function (array $event): void {
$this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand());
$this->assertObjectNotHasProperty('writeConcern', $event['started']->getCommand());
},
);
}
Expand All @@ -38,7 +38,7 @@ function (): void {
$operation->execute($this->getPrimaryServer());
},
function (array $event): void {
$this->assertObjectHasAttribute('lsid', $event['started']->getCommand());
$this->assertObjectHasProperty('lsid', $event['started']->getCommand());
},
);
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Operation/CreateIndexesFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function (): void {
$operation->execute($this->getPrimaryServer());
},
function (array $event): void {
$this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand());
$this->assertObjectNotHasProperty('writeConcern', $event['started']->getCommand());
},
);
}
Expand All @@ -181,7 +181,7 @@ function (): void {
$operation->execute($this->getPrimaryServer());
},
function (array $event): void {
$this->assertObjectHasAttribute('lsid', $event['started']->getCommand());
$this->assertObjectHasProperty('lsid', $event['started']->getCommand());
},
);
}
Expand All @@ -206,7 +206,7 @@ function (): void {
$operation->execute($this->getPrimaryServer());
},
function (array $event): void {
$this->assertObjectHasAttribute('commitQuorum', $event['started']->getCommand());
$this->assertObjectHasProperty('commitQuorum', $event['started']->getCommand());
},
);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Operation/DatabaseCommandFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function (): void {
$operation->execute($this->getPrimaryServer());
},
function (array $event): void {
$this->assertObjectHasAttribute('lsid', $event['started']->getCommand());
$this->assertObjectHasProperty('lsid', $event['started']->getCommand());
},
);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Operation/DeleteFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function (): void {
$operation->execute($this->getPrimaryServer());
},
function (array $event): void {
$this->assertObjectHasAttribute('lsid', $event['started']->getCommand());
$this->assertObjectHasProperty('lsid', $event['started']->getCommand());
},
);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Operation/DistinctFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function (): void {
$operation->execute($this->getPrimaryServer());
},
function (array $event): void {
$this->assertObjectNotHasAttribute('readConcern', $event['started']->getCommand());
$this->assertObjectNotHasProperty('readConcern', $event['started']->getCommand());
},
);
}
Expand All @@ -70,7 +70,7 @@ function (): void {
$operation->execute($this->getPrimaryServer());
},
function (array $event): void {
$this->assertObjectHasAttribute('lsid', $event['started']->getCommand());
$this->assertObjectHasProperty('lsid', $event['started']->getCommand());
},
);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Operation/DropCollectionFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function (): void {
$operation->execute($this->getPrimaryServer());
},
function (array $event): void {
$this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand());
$this->assertObjectNotHasProperty('writeConcern', $event['started']->getCommand());
},
);
}
Expand Down Expand Up @@ -67,7 +67,7 @@ function (): void {
$operation->execute($this->getPrimaryServer());
},
function (array $event): void {
$this->assertObjectHasAttribute('lsid', $event['started']->getCommand());
$this->assertObjectHasProperty('lsid', $event['started']->getCommand());
},
);
}
Expand Down
Loading

0 comments on commit ae90e89

Please sign in to comment.