Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
luklewluk committed Dec 13, 2019
1 parent ab6cabd commit 0b7c34e
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,10 @@ protected function setUp()
$this->cacheMock = $this->getMockBuilder(CacheInterface::class)->getMock();

$objectManager = new ObjectManager($this);
$this->productMetadata = $objectManager->getObject(ProductMetadata::class);
$this->productMetadata = $objectManager->getObject(ProductMetadata::class, ['cache' => $this->cacheMock]);
$reflectionProperty = new \ReflectionProperty($this->productMetadata, 'composerInformation');
$reflectionProperty->setAccessible(true);
$reflectionProperty->setValue($this->productMetadata, $this->composerInformationMock);

$reflectionProperty = new \ReflectionProperty($this->productMetadata, 'cache');
$reflectionProperty->setAccessible(true);
$reflectionProperty->setValue($this->productMetadata, $this->cacheMock);
}

/**
Expand All @@ -63,6 +59,7 @@ public function testGetVersionCached()
$expectedVersion = '1.2.3';
$this->composerInformationMock->expects($this->never())->method('getSystemPackages');
$this->cacheMock->expects($this->once())->method('load')->willReturn($expectedVersion);
$this->cacheMock->expects($this->never())->method('save');
$productVersion = $this->productMetadata->getVersion();
$this->assertEquals($expectedVersion, $productVersion);
}
Expand Down

0 comments on commit 0b7c34e

Please sign in to comment.