/** * {@inheritdoc} */ public function modifyMeta(array $meta) { if ($this->allowedProductTypes->isAllowedProductType($this->locator->getProduct())) { foreach ($this->modifiers as $modifierClass) { /** @var ModifierInterface $bundleModifier */ $modifier = $this->objectManager->get($modifierClass); if (!$modifier instanceof ModifierInterface) { throw new \InvalidArgumentException(__('Type %1 is not an instance of %2', $modifierClass, ModifierInterface::class)); } $meta = $modifier->modifyMeta($meta); } } return $meta; }
public function testDisallowModifyMeta() { $meta = ['some meta']; $modifiers = ['modifier1', 'modifier2']; $this->productMock->expects(static::any())->method('getTypeId')->willReturn(ConfigurableType::TYPE_CODE); $this->allowedProductTypesMock->expects(static::once())->method('isAllowedProductType')->with($this->productMock)->willReturn(false); $this->objectManagerMock->expects(static::never())->method('get'); $this->assertSame($meta, $this->createCompositeModifier($modifiers)->modifyMeta($meta)); }