/** * Run test prepare method * * @param string $name * @param array $filterData * @param array|null $expectedCondition * @dataProvider getPrepareDataProvider * @return void */ public function testPrepare($name, $filterData, $expectedCondition) { $this->contextMock->expects($this->any())->method('getNamespace')->willReturn(Range::NAME); $this->contextMock->expects($this->any())->method('addComponentDefinition')->with(Range::NAME, ['extends' => Range::NAME]); $this->contextMock->expects($this->any())->method('getRequestParam')->with(UiContext::FILTER_VAR)->willReturn($filterData); if ($expectedCondition !== null) { /** @var DataProviderInterface $dataProvider */ $dataProvider = $this->getMockForAbstractClass('Magento\\Framework\\View\\Element\\UiComponent\\DataProvider\\DataProviderInterface', [], '', false); $dataProvider->expects($this->any())->method('addFilter')->with($expectedCondition, $name); $this->contextMock->expects($this->any())->method('getDataProvider')->willReturn($dataProvider); } $range = new Range($this->contextMock, $this->uiComponentFactory, [], ['name' => $name]); $range->prepare(); }
/** * Prepare component configuration * * @return void */ public function prepare() { $this->wrappedComponent = $this->uiComponentFactory->create($this->getName(), static::COMPONENT, ['context' => $this->getContext()]); $this->wrappedComponent->prepare(); parent::prepare(); }