Skip to content
Snippets Groups Projects
Commit a3a12064 authored by Ievgen Kolesov's avatar Ievgen Kolesov
Browse files

MAGETWO-59003: Js file version regenerated in browser on every page reload in develop mode

parent c7dbb9f0
No related merge requests found
......@@ -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));
......
......@@ -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()
......
......@@ -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')
......
......@@ -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();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment