Skip to content

Commit 8ba6098

Browse files
committed
SDK-766: Check image content is correct
1 parent ea6271d commit 8ba6098

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

tests/Util/Profile/AttributeConverterTest.php

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,23 @@ public function testConvertToYotiAttributeDocumentImages()
104104
$this->assertEquals(2, count($multiValue->getValue()));
105105
$this->assertTrue(is_array($multiValue->getValue()));
106106

107-
foreach ($multiValue->getValue() as $image) {
108-
$this->assertInstanceOf(Image::class, $image);
109-
$this->assertEquals('image/jpeg', $image->getMimeType());
110-
$this->assertNotEmpty($image->getContent());
111-
$this->assertNotEmpty($image->getBase64Content());
112-
}
107+
$this->assertIsExpectedImage($multiValue->getValue()[0], 'image/jpeg', 'vWgD//2Q==');
108+
$this->assertIsExpectedImage($multiValue->getValue()[1], 'image/jpeg', '38TVEH/9k=');
109+
}
110+
111+
/**
112+
* Asserts that provided image is expected.
113+
*
114+
* @param \Yoti\Entity\Image $image
115+
* @param string $mimeType
116+
* @param string $base64last10
117+
*/
118+
private function assertIsExpectedImage($image, $mimeType, $base64last10)
119+
{
120+
$this->assertInstanceOf(Image::class, $image);
121+
$this->assertEquals($mimeType, $image->getMimeType());
122+
$this->assertNotEmpty($image->getContent());
123+
$this->assertEquals(substr($image->getBase64Content(), -10), $base64last10);
113124
}
114125

115126
/**

0 commit comments

Comments
 (0)