Skip to content

Commit a893103

Browse files
authored
Merge pull request #1775 from deguif/use-assertArrayHasKey
Use assertArrayHasKey() instead of array_key_exists()
2 parents 25f6a68 + 06c1aa9 commit a893103

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/Unit/Transformer/ModelToElasticaAutoTransformerTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ public function testThatNullValuesAreNotFilteredOut()
279279
$document = $transformer->transform(new POPO3(), ['nullValue' => []]);
280280
$data = $document->getData();
281281

282-
$this->assertTrue(\array_key_exists('nullValue', $data));
282+
$this->assertArrayHasKey('nullValue', $data);
283283
}
284284

285285
public function testThatCannotTransformObjectWhenGetterDoesNotExistForPrivateMethod()
@@ -321,7 +321,7 @@ public function testNestedMapping()
321321
]);
322322
$data = $document->getData();
323323

324-
$this->assertTrue(\array_key_exists('sub', $data));
324+
$this->assertArrayHasKey('sub', $data);
325325
$this->assertIsArray($data['sub']);
326326
$this->assertSame([
327327
['foo' => 'foo'],
@@ -340,7 +340,7 @@ public function tesObjectMapping()
340340
]);
341341
$data = $document->getData();
342342

343-
$this->assertTrue(\array_key_exists('sub', $data));
343+
$this->assertArrayHasKey('sub', $data);
344344
$this->assertIsArray($data['sub']);
345345
$this->assertSame([
346346
['bar' => 'foo'],
@@ -358,7 +358,7 @@ public function testObjectDoesNotRequireProperties()
358358
]);
359359
$data = $document->getData();
360360

361-
$this->assertTrue(\array_key_exists('obj', $data));
361+
$this->assertArrayHasKey('obj', $data);
362362
$this->assertIsArray($data['obj']);
363363
$this->assertSame([
364364
'foo' => 'foo',
@@ -391,8 +391,8 @@ public function testObjectsMappingOfAtLeastOneAutoMappedObjectAndAtLeastOneManua
391391
);
392392
$data = $document->getData();
393393

394-
$this->assertTrue(\array_key_exists('obj', $data));
395-
$this->assertTrue(\array_key_exists('nestedObject', $data));
394+
$this->assertArrayHasKey('obj', $data);
395+
$this->assertArrayHasKey('nestedObject', $data);
396396
$this->assertIsArray($data['obj']);
397397
$this->assertIsArray($data['nestedObject']);
398398
$this->assertSame(
@@ -426,7 +426,7 @@ public function testThatMappedObjectsDontNeedAnIdentifierField()
426426
]);
427427
$data = $document->getData();
428428

429-
$this->assertTrue(\array_key_exists('objWithoutIdentifier', $data));
429+
$this->assertArrayHasKey('objWithoutIdentifier', $data);
430430
$this->assertIsArray($data['objWithoutIdentifier']);
431431
$this->assertSame([
432432
'foo' => 'foo',
@@ -448,7 +448,7 @@ public function testThatNestedObjectsDontNeedAnIdentifierField()
448448
]);
449449
$data = $document->getData();
450450

451-
$this->assertTrue(\array_key_exists('subWithoutIdentifier', $data));
451+
$this->assertArrayHasKey('subWithoutIdentifier', $data);
452452
$this->assertIsArray($data['subWithoutIdentifier']);
453453
$this->assertSame([
454454
['foo' => 'foo', 'bar' => 'foo'],

0 commit comments

Comments
 (0)