14 use Magento\Theme\Model\ResourceModel\ThemeFactory;
16 use PHPUnit_Framework_MockObject_MockObject as Mock;
31 private $deploymentConfigMock;
36 private $themeFactoryMock;
41 private $dataObjectFactoryMock;
46 private $dataObjectMock;
56 private $connectionMock;
65 $this->deploymentConfigMock = $this->getMockBuilder(DeploymentConfig::class)
66 ->disableOriginalConstructor()
68 $this->themeFactoryMock = $this->getMockBuilder(ThemeFactory::class)
69 ->setMethods([
'create'])
70 ->disableOriginalConstructor()
72 $this->themeMock = $this->getMockBuilder(Theme::class)
73 ->disableOriginalConstructor()
75 $this->selectMock = $this->getMockBuilder(Select::class)
76 ->disableOriginalConstructor()
77 ->setMethods([
'sort',
'from'])
79 $this->connectionMock = $this->getMockBuilder(AdapterInterface::class)
80 ->getMockForAbstractClass();
81 $this->dataObjectFactoryMock = $this->getMockBuilder(DataObjectFactory::class)
82 ->setMethods([
'create'])
83 ->disableOriginalConstructor()
85 $this->dataObjectMock = $this->getMockBuilder(DataObject::class)
86 ->disableOriginalConstructor()
89 $this->themeMock->expects($this->any())
90 ->method(
'getConnection')
91 ->willReturn($this->connectionMock);
92 $this->themeFactoryMock->expects($this->any())
94 ->willReturn($this->themeMock);
95 $this->connectionMock->expects($this->any())
97 ->willReturn($this->selectMock);
98 $this->selectMock->expects($this->any())
101 $this->selectMock->expects($this->any())
106 $this->deploymentConfigMock,
107 $this->themeFactoryMock,
108 $this->dataObjectFactoryMock
114 $this->deploymentConfigMock->expects($this->once())
115 ->method(
'isDbAvailable')
118 $this->assertSame([], $this->model->get());
123 $this->deploymentConfigMock->expects($this->once())
124 ->method(
'isDbAvailable')
126 $this->connectionMock->expects($this->once())
127 ->method(
'fetchAssoc')
133 'theme_path' =>
'Magento/backend',
134 'theme_title' =>
'Magento 2 backend',
135 'is_featured' =>
'0',
136 'area' =>
'adminhtml',
138 'code' =>
'Magento/backend',
143 'theme_path' =>
'Magento/blank',
144 'theme_title' =>
'Magento Blank',
145 'is_featured' =>
'0',
146 'area' =>
'frontend',
148 'code' =>
'Magento/blank',
153 'theme_path' =>
'Magento/luma',
154 'theme_title' =>
'Magento Luma',
155 'is_featured' =>
'0',
156 'area' =>
'frontend',
158 'code' =>
'Magento/luma',
162 $this->dataObjectFactoryMock->expects($this->once())
166 'adminhtml/Magento/backend' => [
168 'theme_path' =>
'Magento/backend',
169 'theme_title' =>
'Magento 2 backend',
170 'is_featured' =>
'0',
171 'area' =>
'adminhtml',
173 'code' =>
'Magento/backend',
175 'frontend/Magento/blank' => [
177 'theme_path' =>
'Magento/blank',
178 'theme_title' =>
'Magento Blank',
179 'is_featured' =>
'0',
180 'area' =>
'frontend',
182 'code' =>
'Magento/blank',
184 'frontend/Magento/luma' => [
185 'parent_id' =>
'Magento/blank',
186 'theme_path' =>
'Magento/luma',
187 'theme_title' =>
'Magento Luma',
188 'is_featured' =>
'0',
189 'area' =>
'frontend',
191 'code' =>
'Magento/luma',
195 ->willReturn($this->dataObjectMock);
196 $this->dataObjectMock->expects($this->once())