Skip to content

Commit ae90e89

Browse files
authored
PHPLIB-1515 Replace assertObjectHasAttribute with assertObjectHasProperty (#1405)
https://github.com/sebastianbergmann/phpunit/blob/9.6/DEPRECATIONS.md
1 parent 3929135 commit ae90e89

35 files changed

+143
-143
lines changed

tests/Collection/CollectionFunctionalTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,13 @@ function (): void {
157157
},
158158
function (array $event): void {
159159
$command = $event['started']->getCommand();
160-
$this->assertObjectHasAttribute('comment', $command);
161-
$this->assertObjectHasAttribute('commitQuorum', $command);
162-
$this->assertObjectHasAttribute('lsid', $command);
163-
$this->assertObjectHasAttribute('maxTimeMS', $command);
164-
$this->assertObjectHasAttribute('writeConcern', $command);
165-
$this->assertObjectHasAttribute('sparse', $command->indexes[0]);
166-
$this->assertObjectHasAttribute('unique', $command->indexes[0]);
160+
$this->assertObjectHasProperty('comment', $command);
161+
$this->assertObjectHasProperty('commitQuorum', $command);
162+
$this->assertObjectHasProperty('lsid', $command);
163+
$this->assertObjectHasProperty('maxTimeMS', $command);
164+
$this->assertObjectHasProperty('writeConcern', $command);
165+
$this->assertObjectHasProperty('sparse', $command->indexes[0]);
166+
$this->assertObjectHasProperty('unique', $command->indexes[0]);
167167
},
168168
);
169169
}
@@ -752,8 +752,8 @@ function () use ($method, $collection, $session): void {
752752
call_user_func($method, $collection, $session);
753753
},
754754
function (array $event): void {
755-
$this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand());
756-
$this->assertObjectNotHasAttribute('readConcern', $event['started']->getCommand());
755+
$this->assertObjectNotHasProperty('writeConcern', $event['started']->getCommand());
756+
$this->assertObjectNotHasProperty('readConcern', $event['started']->getCommand());
757757
},
758758
);
759759
}

tests/Database/DatabaseFunctionalTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function testCommand(): void
8383
$commandResult = current($cursor->toArray());
8484

8585
$this->assertCommandSucceeded($commandResult);
86-
$this->assertObjectHasAttribute('ok', $commandResult);
86+
$this->assertObjectHasProperty('ok', $commandResult);
8787
$this->assertSame(1, (int) $commandResult->ok);
8888
}
8989

tests/DocumentationExamplesTest.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ public function testExample_42_50(): void
591591
$this->assertCount(3, $documents);
592592
foreach ($documents as $document) {
593593
foreach (['_id', 'item', 'status', 'size', 'instock'] as $field) {
594-
$this->assertObjectHasAttribute($field, $document);
594+
$this->assertObjectHasProperty($field, $document);
595595
}
596596
}
597597

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

612612
foreach (['size', 'instock'] as $field) {
613-
$this->assertObjectNotHasAttribute($field, $document);
613+
$this->assertObjectNotHasProperty($field, $document);
614614
}
615615
}
616616

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

631631
foreach (['_id', 'size', 'instock'] as $field) {
632-
$this->assertObjectNotHasAttribute($field, $document);
632+
$this->assertObjectNotHasProperty($field, $document);
633633
}
634634
}
635635

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

650650
foreach (['status', 'instock'] as $field) {
651-
$this->assertObjectNotHasAttribute($field, $document);
651+
$this->assertObjectNotHasProperty($field, $document);
652652
}
653653
}
654654

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

669-
$this->assertObjectNotHasAttribute('instock', $document);
670-
$this->assertObjectHasAttribute('uom', $document->size);
671-
$this->assertObjectNotHasAttribute('h', $document->size);
672-
$this->assertObjectNotHasAttribute('w', $document->size);
669+
$this->assertObjectNotHasProperty('instock', $document);
670+
$this->assertObjectHasProperty('uom', $document->size);
671+
$this->assertObjectNotHasProperty('h', $document->size);
672+
$this->assertObjectNotHasProperty('w', $document->size);
673673
}
674674

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

689-
$this->assertObjectHasAttribute('h', $document->size);
690-
$this->assertObjectHasAttribute('w', $document->size);
691-
$this->assertObjectNotHasAttribute('uom', $document->size);
689+
$this->assertObjectHasProperty('h', $document->size);
690+
$this->assertObjectHasProperty('w', $document->size);
691+
$this->assertObjectNotHasProperty('uom', $document->size);
692692
}
693693

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

708-
$this->assertObjectNotHasAttribute('size', $document);
708+
$this->assertObjectNotHasProperty('size', $document);
709709
foreach ($document->instock as $instock) {
710-
$this->assertObjectHasAttribute('qty', $instock);
711-
$this->assertObjectNotHasAttribute('warehouse', $instock);
710+
$this->assertObjectHasProperty('qty', $instock);
711+
$this->assertObjectNotHasProperty('warehouse', $instock);
712712
}
713713
}
714714

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

729-
$this->assertObjectNotHasAttribute('size', $document);
729+
$this->assertObjectNotHasProperty('size', $document);
730730
$this->assertCount(1, $document->instock);
731731
}
732732
}
@@ -786,10 +786,10 @@ public function testAggregationProjectionExample_1(): void
786786
$this->assertCount(3, $documents);
787787
foreach ($documents as $document) {
788788
foreach (['item', 'status', 'area', 'reportNumber'] as $field) {
789-
$this->assertObjectHasAttribute($field, $document);
789+
$this->assertObjectHasProperty($field, $document);
790790
}
791791

792-
$this->assertObjectNotHasAttribute('_id', $document);
792+
$this->assertObjectNotHasProperty('_id', $document);
793793
$this->assertIsString($document->status);
794794
$this->assertIsString($document->area);
795795
$this->assertSame(1, $document->reportNumber);

tests/Operation/AggregateFunctionalTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function (): void {
3333
$operation->execute($this->getPrimaryServer());
3434
},
3535
function (array $event): void {
36-
$this->assertObjectNotHasAttribute('allowDiskUse', $event['started']->getCommand());
36+
$this->assertObjectNotHasProperty('allowDiskUse', $event['started']->getCommand());
3737
},
3838
);
3939
}
@@ -92,7 +92,7 @@ function (): void {
9292
$operation->execute($this->getPrimaryServer());
9393
},
9494
function (array $event): void {
95-
$this->assertObjectNotHasAttribute('readConcern', $event['started']->getCommand());
95+
$this->assertObjectNotHasProperty('readConcern', $event['started']->getCommand());
9696
},
9797
);
9898
}
@@ -111,7 +111,7 @@ function (): void {
111111
$operation->execute($this->getPrimaryServer());
112112
},
113113
function (array $event): void {
114-
$this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand());
114+
$this->assertObjectNotHasProperty('writeConcern', $event['started']->getCommand());
115115
},
116116
);
117117

@@ -156,7 +156,7 @@ function (): void {
156156
$operation->execute($this->getPrimaryServer());
157157
},
158158
function (array $event): void {
159-
$this->assertObjectHasAttribute('lsid', $event['started']->getCommand());
159+
$this->assertObjectHasProperty('lsid', $event['started']->getCommand());
160160
},
161161
);
162162
}
@@ -218,14 +218,14 @@ function () use ($pipeline, $options): void {
218218

219219
if (isset($result->shards)) {
220220
foreach ($result->shards as $shard) {
221-
$this->assertObjectHasAttribute('stages', $shard);
221+
$this->assertObjectHasProperty('stages', $shard);
222222
}
223223
} else {
224-
$this->assertObjectHasAttribute('stages', $result);
224+
$this->assertObjectHasProperty('stages', $result);
225225
}
226226
},
227227
function (array $event): void {
228-
$this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand());
228+
$this->assertObjectNotHasProperty('writeConcern', $event['started']->getCommand());
229229
},
230230
);
231231

@@ -246,7 +246,7 @@ function (): void {
246246
$operation->execute($this->getPrimaryServer());
247247
},
248248
function (array $event): void {
249-
$this->assertObjectHasAttribute('bypassDocumentValidation', $event['started']->getCommand());
249+
$this->assertObjectHasProperty('bypassDocumentValidation', $event['started']->getCommand());
250250
$this->assertEquals(true, $event['started']->getCommand()->bypassDocumentValidation);
251251
},
252252
);
@@ -266,7 +266,7 @@ function (): void {
266266
$operation->execute($this->getPrimaryServer());
267267
},
268268
function (array $event): void {
269-
$this->assertObjectNotHasAttribute('bypassDocumentValidation', $event['started']->getCommand());
269+
$this->assertObjectNotHasProperty('bypassDocumentValidation', $event['started']->getCommand());
270270
},
271271
);
272272
}

tests/Operation/BulkWriteFunctionalTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ function (): void {
379379
$operation->execute($this->getPrimaryServer());
380380
},
381381
function (array $event): void {
382-
$this->assertObjectHasAttribute('lsid', $event['started']->getCommand());
382+
$this->assertObjectHasProperty('lsid', $event['started']->getCommand());
383383
},
384384
);
385385
}
@@ -398,7 +398,7 @@ function (): void {
398398
$operation->execute($this->getPrimaryServer());
399399
},
400400
function (array $event): void {
401-
$this->assertObjectHasAttribute('bypassDocumentValidation', $event['started']->getCommand());
401+
$this->assertObjectHasProperty('bypassDocumentValidation', $event['started']->getCommand());
402402
$this->assertEquals(true, $event['started']->getCommand()->bypassDocumentValidation);
403403
},
404404
);
@@ -418,7 +418,7 @@ function (): void {
418418
$operation->execute($this->getPrimaryServer());
419419
},
420420
function (array $event): void {
421-
$this->assertObjectNotHasAttribute('bypassDocumentValidation', $event['started']->getCommand());
421+
$this->assertObjectNotHasProperty('bypassDocumentValidation', $event['started']->getCommand());
422422
},
423423
);
424424
}

tests/Operation/CountFunctionalTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function (): void {
4343
$operation->execute($this->getPrimaryServer());
4444
},
4545
function (array $event): void {
46-
$this->assertObjectNotHasAttribute('readConcern', $event['started']->getCommand());
46+
$this->assertObjectNotHasProperty('readConcern', $event['started']->getCommand());
4747
},
4848
);
4949
}
@@ -99,7 +99,7 @@ function (): void {
9999
$operation->execute($this->getPrimaryServer());
100100
},
101101
function (array $event): void {
102-
$this->assertObjectHasAttribute('lsid', $event['started']->getCommand());
102+
$this->assertObjectHasProperty('lsid', $event['started']->getCommand());
103103
},
104104
);
105105
}

tests/Operation/CreateCollectionFunctionalTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function (): void {
2020
$operation->execute($this->getPrimaryServer());
2121
},
2222
function (array $event): void {
23-
$this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand());
23+
$this->assertObjectNotHasProperty('writeConcern', $event['started']->getCommand());
2424
},
2525
);
2626
}
@@ -38,7 +38,7 @@ function (): void {
3838
$operation->execute($this->getPrimaryServer());
3939
},
4040
function (array $event): void {
41-
$this->assertObjectHasAttribute('lsid', $event['started']->getCommand());
41+
$this->assertObjectHasProperty('lsid', $event['started']->getCommand());
4242
},
4343
);
4444
}

tests/Operation/CreateIndexesFunctionalTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ function (): void {
162162
$operation->execute($this->getPrimaryServer());
163163
},
164164
function (array $event): void {
165-
$this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand());
165+
$this->assertObjectNotHasProperty('writeConcern', $event['started']->getCommand());
166166
},
167167
);
168168
}
@@ -181,7 +181,7 @@ function (): void {
181181
$operation->execute($this->getPrimaryServer());
182182
},
183183
function (array $event): void {
184-
$this->assertObjectHasAttribute('lsid', $event['started']->getCommand());
184+
$this->assertObjectHasProperty('lsid', $event['started']->getCommand());
185185
},
186186
);
187187
}
@@ -206,7 +206,7 @@ function (): void {
206206
$operation->execute($this->getPrimaryServer());
207207
},
208208
function (array $event): void {
209-
$this->assertObjectHasAttribute('commitQuorum', $event['started']->getCommand());
209+
$this->assertObjectHasProperty('commitQuorum', $event['started']->getCommand());
210210
},
211211
);
212212
}

tests/Operation/DatabaseCommandFunctionalTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function (): void {
5555
$operation->execute($this->getPrimaryServer());
5656
},
5757
function (array $event): void {
58-
$this->assertObjectHasAttribute('lsid', $event['started']->getCommand());
58+
$this->assertObjectHasProperty('lsid', $event['started']->getCommand());
5959
},
6060
);
6161
}

tests/Operation/DeleteFunctionalTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ function (): void {
115115
$operation->execute($this->getPrimaryServer());
116116
},
117117
function (array $event): void {
118-
$this->assertObjectHasAttribute('lsid', $event['started']->getCommand());
118+
$this->assertObjectHasProperty('lsid', $event['started']->getCommand());
119119
},
120120
);
121121
}

tests/Operation/DistinctFunctionalTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function (): void {
5050
$operation->execute($this->getPrimaryServer());
5151
},
5252
function (array $event): void {
53-
$this->assertObjectNotHasAttribute('readConcern', $event['started']->getCommand());
53+
$this->assertObjectNotHasProperty('readConcern', $event['started']->getCommand());
5454
},
5555
);
5656
}
@@ -70,7 +70,7 @@ function (): void {
7070
$operation->execute($this->getPrimaryServer());
7171
},
7272
function (array $event): void {
73-
$this->assertObjectHasAttribute('lsid', $event['started']->getCommand());
73+
$this->assertObjectHasProperty('lsid', $event['started']->getCommand());
7474
},
7575
);
7676
}

tests/Operation/DropCollectionFunctionalTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function (): void {
2121
$operation->execute($this->getPrimaryServer());
2222
},
2323
function (array $event): void {
24-
$this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand());
24+
$this->assertObjectNotHasProperty('writeConcern', $event['started']->getCommand());
2525
},
2626
);
2727
}
@@ -67,7 +67,7 @@ function (): void {
6767
$operation->execute($this->getPrimaryServer());
6868
},
6969
function (array $event): void {
70-
$this->assertObjectHasAttribute('lsid', $event['started']->getCommand());
70+
$this->assertObjectHasProperty('lsid', $event['started']->getCommand());
7171
},
7272
);
7373
}

0 commit comments

Comments
 (0)