File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed
lib/internal/Magento/Framework/App/Test/Unit Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -34,14 +34,10 @@ protected function setUp()
34
34
$ this ->cacheMock = $ this ->getMockBuilder (CacheInterface::class)->getMock ();
35
35
36
36
$ objectManager = new ObjectManager ($ this );
37
- $ this ->productMetadata = $ objectManager ->getObject (ProductMetadata::class);
37
+ $ this ->productMetadata = $ objectManager ->getObject (ProductMetadata::class, [ ' cache ' => $ this -> cacheMock ] );
38
38
$ reflectionProperty = new \ReflectionProperty ($ this ->productMetadata , 'composerInformation ' );
39
39
$ reflectionProperty ->setAccessible (true );
40
40
$ reflectionProperty ->setValue ($ this ->productMetadata , $ this ->composerInformationMock );
41
-
42
- $ reflectionProperty = new \ReflectionProperty ($ this ->productMetadata , 'cache ' );
43
- $ reflectionProperty ->setAccessible (true );
44
- $ reflectionProperty ->setValue ($ this ->productMetadata , $ this ->cacheMock );
45
41
}
46
42
47
43
/**
@@ -63,6 +59,7 @@ public function testGetVersionCached()
63
59
$ expectedVersion = '1.2.3 ' ;
64
60
$ this ->composerInformationMock ->expects ($ this ->never ())->method ('getSystemPackages ' );
65
61
$ this ->cacheMock ->expects ($ this ->once ())->method ('load ' )->willReturn ($ expectedVersion );
62
+ $ this ->cacheMock ->expects ($ this ->never ())->method ('save ' );
66
63
$ productVersion = $ this ->productMetadata ->getVersion ();
67
64
$ this ->assertEquals ($ expectedVersion , $ productVersion );
68
65
}
You can’t perform that action at this time.
0 commit comments