Class WebsiteTest
@SuppressWarnings(PHPMD.CouplingBetweenObjects)
Definition at line 22 of file WebsiteTest.php.
◆ setUp()
Definition at line 54 of file WebsiteTest.php.
56 $this->collectionFactory = $this->getMockBuilder(ScopedFactory::class)
57 ->disableOriginalConstructor()
58 ->setMethods([
'create'])
59 ->getMockForAbstractClass();
60 $this->converter = $this->getMockBuilder(Converter::class)
61 ->disableOriginalConstructor()
63 $this->websiteFactory = $this->getMockBuilder(\
Magento\Store\Model\WebsiteFactory::class)
64 ->disableOriginalConstructor()
65 ->setMethods([
'create'])
66 ->getMockForAbstractClass();
67 $this->website = $this->getMockBuilder(\
Magento\Store\Model\Website::class)
68 ->disableOriginalConstructor()
70 $this->defaultScopeReader = $this->getMockBuilder(DefaultScope::class)
71 ->disableOriginalConstructor()
73 $this->websiteSource =
new WebsiteSource(
74 $this->collectionFactory,
76 $this->websiteFactory,
77 $this->defaultScopeReader
◆ testGet()
Definition at line 81 of file WebsiteTest.php.
83 $scopeCode =
'myWebsite';
85 'config/key1' =>
'default_db_value1',
86 'config/key3' =>
'default_db_value3',
88 $this->websiteFactory->expects($this->once())
90 ->willReturn($this->website);
91 $this->website->expects($this->once())
94 $this->website->expects($this->once())
97 $this->collectionFactory->expects($this->once())
101 new DataObject([
'path' =>
'config/key1',
'value' =>
'default_db_value1']),
102 new DataObject([
'path' =>
'config/key3',
'value' =>
'default_db_value3']),
104 $this->defaultScopeReader->expects($this->once())
107 $this->converter->expects($this->once())
109 ->with($expectedResult)
110 ->willReturnArgument(0);
111 $this->assertEquals($expectedResult, $this->websiteSource->get($scopeCode));
The documentation for this class was generated from the following file:
- vendor/magento/module-store/Test/Unit/Model/Config/Reader/Source/Dynamic/WebsiteTest.php