diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/View/Deployment/VersionTest.php b/dev/tests/integration/testsuite/Magento/Framework/App/View/Deployment/VersionTest.php index 351c509fe27f1c0d48af796ed43871627af446f5..5a313c318f9e9126ac84848a3b7ddf62e71d6585 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/View/Deployment/VersionTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/View/Deployment/VersionTest.php @@ -84,7 +84,6 @@ class VersionTest extends \PHPUnit_Framework_TestCase $this->getVersionModel(State::MODE_PRODUCTION)->getValue(); } - public function testGetValueInDeveloperMode() { $this->assertFalse($this->directoryWrite->isExist($this->fileName)); diff --git a/lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/Version/Storage/FileTest.php b/lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/Version/Storage/FileTest.php index 3981511ad47018c8847c8c9cddf889122e059d58..e7206bf5566075f4df04a977185b5f343ed42b8f 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/Version/Storage/FileTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/Version/Storage/FileTest.php @@ -34,48 +34,15 @@ class FileTest extends \PHPUnit_Framework_TestCase public function testLoad() { - $this->directory - ->expects($this->once()) - ->method('readFile') + $this->directory->expects($this->once()) + ->method('isReadable') ->with('fixture_file.txt') - ->will($this->returnValue('123')); - $this->assertEquals('123', $this->object->load()); - } - - /** - * @expectedException \Exception - * @expectedExceptionMessage Exception to be propagated - */ - public function testLoadExceptionPropagation() - { - $this->directory - ->expects($this->once()) + ->willReturn(true); + $this->directory->expects($this->once()) ->method('readFile') ->with('fixture_file.txt') - ->will($this->throwException(new \Exception('Exception to be propagated'))); - $this->object->load(); - } - - /** - * @expectedException \UnexpectedValueException - * @expectedExceptionMessage Unable to retrieve deployment version of static files from the file system - */ - public function testLoadExceptionWrapping() - { - $filesystemException = new \Magento\Framework\Exception\FileSystemException( - new \Magento\Framework\Phrase('File does not exist') - ); - $this->directory - ->expects($this->once()) - ->method('readFile') - ->with('fixture_file.txt') - ->will($this->throwException($filesystemException)); - try { - $this->object->load(); - } catch (\Exception $e) { - $this->assertSame($filesystemException, $e->getPrevious(), 'Wrapping of original exception is expected'); - throw $e; - } + ->willReturn('123'); + $this->assertEquals('123', $this->object->load()); } public function testSave() diff --git a/lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/VersionTest.php b/lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/VersionTest.php index 6f2fec559221a8f940e03e3cd725530b54122eae..8d804102f7a56038fded4118692931030593caa7 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/VersionTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/VersionTest.php @@ -6,7 +6,6 @@ namespace Magento\Framework\App\Test\Unit\View\Deployment; use Magento\Framework\App\View\Deployment\Version; -use Magento\Framework\Exception\FileSystemException; /** * Class VersionTest @@ -70,7 +69,8 @@ class VersionTest extends \PHPUnit_Framework_TestCase ]; } - public function testGetValueInNonProductionMode() { + public function testGetValueInNonProductionMode() + { $version = 123123123123; $this->versionStorageMock->expects($this->once()) ->method('load') diff --git a/lib/internal/Magento/Framework/App/View/Deployment/Version.php b/lib/internal/Magento/Framework/App/View/Deployment/Version.php index 64f7ed1d5e18acda2e50038dc820f475e62dfffa..73d4a0c926cea88c5b2cfbd6db34888f3ef651fb 100644 --- a/lib/internal/Magento/Framework/App/View/Deployment/Version.php +++ b/lib/internal/Magento/Framework/App/View/Deployment/Version.php @@ -7,7 +7,6 @@ namespace Magento\Framework\App\View\Deployment; use Psr\Log\LoggerInterface; -use Magento\Framework\Exception\FileSystemException; /** * Deployment version of static files @@ -72,7 +71,7 @@ class Version if ($appMode == \Magento\Framework\App\State::MODE_PRODUCTION) { $this->getLogger()->critical('Can not load static content version.'); throw new \UnexpectedValueException( - __('Unable to retrieve deployment version of static files from the file system.') + "Unable to retrieve deployment version of static files from the file system." ); } $result = $this->generateVersion();