assertEquals($result, Base64::isEncoded($value)); } /** * @dataProvider base64EncodingImageDataProvider * * @param $value * @param bool $result */ public function testBase64EncodingImage($value, bool $result): void { $this->assertEquals($result, Base64::isEncodedImage($value)); } /** * @return array */ public function base64EncodingDataProvider(): array { return [ 'object' => [ 'value' => new stdClass(), 'result' => false, ], 'string' => [ 'value' => 'string', 'result' => false, ], 'encodedString' => [ 'value' => self::ENCODED_FILE, 'result' => true, ], 'encodedImage' => [ 'value' => self::ENCODED_IMAGE, 'result' => true, ], ]; } /** * @return array */ public function base64EncodingImageDataProvider(): array { return [ 'object' => [ 'value' => new stdClass(), 'result' => false, ], 'string' => [ 'value' => 'string', 'result' => false, ], 'encodedString' => [ 'value' => self::ENCODED_FILE, 'result' => false, ], 'encodedImage' => [ 'value' => self::ENCODED_IMAGE, 'result' => true, ], ]; } }