0

I have created one more custom attribute (custom_image_type) based on frontend_input = media_image.

enter image description here

I just ran the following File level unit test on below file.

\Magento\CatalogImportExport\Test\Unit\Model\Import\Product\ImageTypeProcessorTest::testGetImageTypes

File level executing command on Magento 2.4 instance.

/usr/bin/php7.4 /var/www/html/magento2/vendor/phpunit/phpunit/phpunit --configuration /var/www/html/magento2/dev/tests/unit/phpunit.xml.dist --filter Magento\\CatalogImportExport\\Test\\Unit\\Model\\Import\\Product\\ImageTypeProcessorTest --test-suffix ImageTypeProcessorTest.php /var/www/html/magento2/vendor/magento/module-catalog-import-export/Test/Unit/Model/Import/Product --teamcity

and respective model file is as follows:

\Magento\CatalogImportExport\Model\Import\Product\ImageTypeProcessor::getImageTypes

I get the passed result instead of failure.

Further I looked at the assertEquals condition and i can see below:

$this->assertEquals(
        ['image', 'small_image', 'thumbnail', 'swatch_image', '_media_image'],
        $typeProcessor->getImageTypes()
);

$typeProcessor->getImageTypes() - I tried to execute this method via script and I get the latest result with custom_image_type as well.

But when i tried to see the array difference(by removing any of the default media_type) I do not get the custom_image_type while executing Unit Test and getting failures (as expected).

Does any one know ? I suspect the resource that is passing on $typeProcessor would be the reason.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.