File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -489,7 +489,7 @@ public function getStoreLabels()
489
489
*/
490
490
public function getStoreLabel ($ storeId = null )
491
491
{
492
- if ($ this ->hasData ('store_label ' )) {
492
+ if ($ this ->hasData ('store_label ' ) && $ storeId === null ) {
493
493
return $ this ->getData ('store_label ' );
494
494
}
495
495
$ store = $ this ->_storeManager ->getStore ($ storeId );
Original file line number Diff line number Diff line change 11
11
use Magento \Eav \Model \Entity \Attribute \FrontendLabel ;
12
12
use Magento \Eav \Model \Entity \Attribute \FrontendLabelFactory ;
13
13
use Magento \Framework \TestFramework \Unit \Helper \ObjectManager ;
14
+ use Magento \Store \Api \Data \StoreInterface ;
15
+ use Magento \Store \Model \StoreManagerInterface ;
14
16
use PHPUnit \Framework \MockObject \MockObject ;
15
17
use PHPUnit \Framework \TestCase ;
16
18
@@ -41,6 +43,28 @@ protected function tearDown(): void
41
43
$ this ->_model = null ;
42
44
}
43
45
46
+ /**
47
+ * @return void
48
+ */
49
+ public function testGetStoreLabel (): void
50
+ {
51
+ $ objectManager = new ObjectManager ($ this );
52
+ $ storeMock = $ this ->createMock (StoreInterface::class);
53
+ $ storeManagerMock = $ this ->createMock (StoreManagerInterface::class);
54
+ $ storeManagerMock ->method ('getStore ' )->willReturn ($ storeMock );
55
+ $ resource = $ this ->getMockBuilder (\Magento \Eav \Model \ResourceModel \Entity \Attribute::class)
56
+ ->setMethods (['getStoreLabelsByAttributeId ' ])
57
+ ->disableOriginalConstructor ()
58
+ ->getMock ();
59
+ $ arguments = [
60
+ '_resource ' => $ resource ,
61
+ 'storeManager ' => $ storeManagerMock ,
62
+ ];
63
+ $ this ->_model = $ objectManager ->getObject (Attribute::class, $ arguments );
64
+
65
+ $ this ->assertEmpty ($ this ->_model ->getStoreLabel ());
66
+ }
67
+
44
68
/**
45
69
* @param string $givenFrontendInput
46
70
* @param string $expectedBackendType
You can’t perform that action at this time.
0 commit comments