/** * Retrieve modifiers instantiated * * @return ModifierInterface[] * @throws LocalizedException */ public function getModifiersInstances() { if ($this->modifiersInstances) { return $this->modifiersInstances; } foreach ($this->modifiers as $modifier) { if (empty($modifier['class'])) { throw new LocalizedException(__('Parameter "class" must be present.')); } if (empty($modifier['sortOrder'])) { throw new LocalizedException(__('Parameter "sortOrder" must be present.')); } $this->modifiersInstances[$modifier['class']] = $this->factory->create($modifier['class']); } return $this->modifiersInstances; }
/** * Get modifiers list * * @return ModifierInterface[] */ protected function getModifiers() { if (empty($this->modifiersInstances)) { foreach ($this->modifiers as $modifierClass) { $this->modifiersInstances[$modifierClass] = $this->modifierFactory->create($modifierClass); } } return $this->modifiersInstances; }
/** * @expectedException \InvalidArgumentException */ public function testCreateWithException() { $this->objectManagerMock->expects($this->once())->method('create')->willReturn(null); $this->model->create(''); }