47 private $serializerMock;
49 protected function setUp()
51 $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
53 $this->scopeConfigMock = $this->createMock(\
Magento\Framework\
App\Config\ScopeConfigInterface::class);
54 $this->scopeConfigMock->expects($this->any())->method(
'getValue')->willReturn([
'test' => 1]);
56 $this->structureMock = $this->createMock(\
Magento\Config\Model\Config\Structure::class);
57 $this->structureMock->expects($this->any())->method(
'getFieldPathsByAttribute')->willReturn([
'path' =>
'test']);
59 $this->resourceModelMock = $this->createMock(\
Magento\Email\Model\
ResourceModel\Template::class);
60 $this->resourceModelMock->expects($this->any())
61 ->method(
'getSystemConfigByPathsAndTemplateId')
62 ->willReturn([
'test_config' => 2015]);
64 $objectManagerMock = $this->createMock(\
Magento\Framework\ObjectManagerInterface::class);
65 $objectManagerMock->expects($this->any())
68 ->will($this->returnValue($this->resourceModelMock));
72 $this->serializerMock = $this->getMockBuilder(\
Magento\Framework\Serialize\Serializer\Json::class)->getMock();
74 $this->model =
$helper->getObject(
75 \
Magento\Email\Model\BackendTemplate::class,
77 'scopeConfig' => $this->scopeConfigMock,
78 'structure' => $this->structureMock,
79 'serializer' => $this->serializerMock
84 protected function tearDown()
88 $objectManagerMock = $this->createMock(\
Magento\Framework\ObjectManagerInterface::class);
94 $this->assertEquals([], $this->model->getSystemConfigPathsWhereCurrentlyUsed());
99 $this->model->setId(1);
100 $this->assertEquals([
'test_config' => 2015], $this->model->getSystemConfigPathsWhereCurrentlyUsed());
testGetSystemConfigPathsWhereCurrentlyUsedValidId()
static setInstance(\Magento\Framework\ObjectManagerInterface $objectManager)
testGetSystemConfigPathsWhereCurrentlyUsedNoId()