/** * Run test for prepare method * * @param array $data * @param array $expectedData * @return void * * @dataProvider prepareSuccessDataProvider */ public function testPrepareSuccess(array $data, array $expectedData) { $this->uiComponentFactoryMock->expects($this->once())->method('create')->with(self::NAME, $data['config']['formElement'], $this->arrayHasKey('context'))->willReturn($this->getWrappedComponentMock()); $this->contextMock->expects($this->any())->method('getNamespace')->willReturn(self::COMPONENT_NAMESPACE); $this->field->setData($data); $this->field->prepare(); $result = $this->field->getData(); $this->assertEquals($expectedData, $result); }