32 $this->objectManagerMock = $this->getMockBuilder(\
Magento\Framework\ObjectManagerInterface::class)
33 ->getMockForAbstractClass();
35 ->disableOriginalConstructor()
37 $this->collectionFactoryMock = $this->getMockBuilder(
40 ->disableOriginalConstructor()
41 ->setMethods([
'create'])
44 ->disableOriginalConstructor()
46 $this->backendModel = $this->getMockBuilder(\
Magento\Framework\
App\
Config\Value::class)
47 ->disableOriginalConstructor()
48 ->setMethods([
'setValue'])
51 $this->model = new \Magento\Theme\Model\Design\BackendModelFactory(
52 $this->objectManagerMock,
53 $this->metadataProviderMock,
54 $this->collectionFactoryMock
64 'scopeId' => $scopeId,
67 'path' =>
'design/head/default_title',
68 'backend_model' => \Magento\Framework\App\Config\Value::class
71 $this->metadataProviderMock->expects($this->once())
74 'head_default_title' => [
75 'path' =>
'design/head/default_title' 78 $this->collectionFactoryMock->expects($this->once())
80 ->willReturn($this->collection);
81 $this->collection->expects($this->once())
82 ->method(
'addPathsFilter')
83 ->with([
'head_default_title' =>
'design/head/default_title']);
84 $this->collection->expects($this->once())
85 ->method(
'addFieldToFilter')
86 ->with(
'scope', $scope);
87 $this->collection->expects($this->once())
88 ->method(
'addScopeIdFilter')
90 $this->collection->expects($this->once())
95 'path' =>
'design/head/default_title' 98 $this->objectManagerMock->expects($this->once())
104 'path' =>
'design/head/default_title',
106 'scope_id' => $scopeId,
107 'field_config' =>
$data[
'config'],
112 ->willReturn($this->backendModel);
113 $this->backendModel->expects($this->once())
115 ->willReturn(
'value');
116 $this->assertSame($this->backendModel, $this->model->create(
$data));
121 $path =
'design/head/default_title';
122 $backendModelType = \Magento\Theme\Model\Design\Backend\Exceptions::class;
124 ->disableOriginalConstructor()
127 $this->metadataProviderMock->expects($this->once())
130 'head_default_title' => [
132 'backend_model' => $backendModelType
135 $this->objectManagerMock->expects($this->once())
137 ->with($backendModelType, [
'data' => []])