24 $this->validator = new \Magento\Downloadable\Model\File\ContentValidator();
26 $this->fileContentMock = $this->createMock(\
Magento\Downloadable\Api\Data\File\ContentInterface::class);
31 $this->fileContentMock->expects($this->any())->method(
'getFileData')
32 ->will($this->returnValue(base64_encode(
'test content')));
33 $this->fileContentMock->expects($this->any())->method(
'getName')
34 ->will($this->returnValue(
'valid_name'));
36 $this->assertTrue($this->validator->isValid($this->fileContentMock));
45 $this->fileContentMock->expects($this->any())->method(
'getFileData')
46 ->will($this->returnValue(
'not_a_base64_encoded_content'));
47 $this->fileContentMock->expects($this->any())->method(
'getName')
48 ->will($this->returnValue(
'valid_name'));
49 $this->assertTrue($this->validator->isValid($this->fileContentMock));
60 $this->fileContentMock->expects($this->any())->method(
'getFileData')
61 ->will($this->returnValue(base64_encode(
'test content')));
62 $this->fileContentMock->expects($this->any())->method(
'getName')
64 $this->assertTrue($this->validator->isValid($this->fileContentMock));
testIsValidThrowsExceptionIfProvidedImageNameContainsForbiddenCharacters($fileName)
testIsValidThrowsExceptionIfProvidedContentIsNotBase64Encoded()