/** * @return void */ public function testWidgetDirective() { $result = 'some text'; $construction = ['{{widget type="Widget\\Link" anchor_text="Test" template="block.phtml" id_path="p/1"}}', 'widget', ' type="" anchor_text="Test" template="block.phtml" id_path="p/1"']; $this->appStateMock->expects($this->once())->method('emulateAreaCode')->with('frontend', [$this->filterEmulate, 'generateWidget'], [$construction])->willReturn($result); $this->assertSame($result, $this->filterEmulate->widgetDirective($construction)); }
/** * Generate widget HTML if template variables are assigned * * @param string[] $construction * @return string */ public function widgetDirective($construction) { if (!isset($this->templateVars['subscriber'])) { return $construction[0]; } $construction[2] .= sprintf(' store_id ="%s"', $this->getStoreId()); return parent::widgetDirective($construction); }