Skip to content

Commit 0b7c34e

Browse files
committed
Update tests
1 parent ab6cabd commit 0b7c34e

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lib/internal/Magento/Framework/App/Test/Unit/ProductMetadataTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,10 @@ protected function setUp()
3434
$this->cacheMock = $this->getMockBuilder(CacheInterface::class)->getMock();
3535

3636
$objectManager = new ObjectManager($this);
37-
$this->productMetadata = $objectManager->getObject(ProductMetadata::class);
37+
$this->productMetadata = $objectManager->getObject(ProductMetadata::class, ['cache' => $this->cacheMock]);
3838
$reflectionProperty = new \ReflectionProperty($this->productMetadata, 'composerInformation');
3939
$reflectionProperty->setAccessible(true);
4040
$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);
4541
}
4642

4743
/**
@@ -63,6 +59,7 @@ public function testGetVersionCached()
6359
$expectedVersion = '1.2.3';
6460
$this->composerInformationMock->expects($this->never())->method('getSystemPackages');
6561
$this->cacheMock->expects($this->once())->method('load')->willReturn($expectedVersion);
62+
$this->cacheMock->expects($this->never())->method('save');
6663
$productVersion = $this->productMetadata->getVersion();
6764
$this->assertEquals($expectedVersion, $productVersion);
6865
}

0 commit comments

Comments
 (0)