6 declare(strict_types=1);
15 private $presentation;
20 private $attributeMock;
24 $this->presentation = new \Magento\Catalog\Model\Product\Attribute\Frontend\Inputtype\Presentation();
25 $this->attributeMock = $this->getMockBuilder(\
Magento\Catalog\Model\
ResourceModel\Eav\Attribute::class)
26 ->disableOriginalConstructor()
38 $this->attributeMock->expects($this->once())->method(
'getFrontendInput')->willReturn($inputType);
39 $this->attributeMock->expects($this->any())->method(
'getIsWysiwygEnabled')->willReturn($isWysiwygEnabled);
40 $this->assertEquals($expectedResult, $this->presentation->getPresentationInputType($this->attributeMock));
49 'attribute_is_textarea_and_wysiwyg_enabled' => [
'textarea',
true,
'texteditor'],
50 'attribute_is_input_and_wysiwyg_enabled' => [
'input',
true,
'input'],
51 'attribute_is_textarea_and_wysiwyg_disabled' => [
'textarea',
false,
'textarea'],
62 $this->assertEquals($expectedResult, $this->presentation->convertPresentationDataToInputType(
$data));
71 [[
'key' =>
'value'], [
'key' =>
'value']],
73 [
'frontend_input' =>
'texteditor'],
74 [
'frontend_input' =>
'textarea',
'is_wysiwyg_enabled' => 1]
77 [
'frontend_input' =>
'textarea'],
78 [
'frontend_input' =>
'textarea',
'is_wysiwyg_enabled' => 0]
81 [
'frontend_input' =>
'input'],
82 [
'frontend_input' =>
'input']
testConvertPresentationDataToInputType(array $data, array $expectedResult)
testGetPresentationInputType(string $inputType, bool $isWysiwygEnabled, string $expectedResult)
getPresentationInputTypeDataProvider()
convertPresentationDataToInputTypeDataProvider()