Skip to content

Unit Test a CMS block collection factory

I am currently exploring the unit testing in Magento 2. I have grasp some of the fundamentals by basing on the core code but I cannot seem to create a unit test on the code below

$blocks = $this->blockFactory->create();

        foreach ($blocks as $block) {
            if ($block->getIdentifier() == 'terms-and-conditions') {
                return $block->getUpdateTime();
            }
        }

        return '';

The block factory is derived from

use MagentoCmsModelResourceModelBlockCollectionFactory as BlockFactory;

Do you guys have any idea how to tackle this.