Skip to content

Commit a3a1206

Browse files
committed
MAGETWO-59003: Js file version regenerated in browser on every page reload in develop mode
1 parent c7dbb9f commit a3a1206

File tree

4 files changed

+9
-44
lines changed

4 files changed

+9
-44
lines changed

dev/tests/integration/testsuite/Magento/Framework/App/View/Deployment/VersionTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ public function testGetValueInProductionModeWithoutVersion()
8484
$this->getVersionModel(State::MODE_PRODUCTION)->getValue();
8585
}
8686

87-
8887
public function testGetValueInDeveloperMode()
8988
{
9089
$this->assertFalse($this->directoryWrite->isExist($this->fileName));

lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/Version/Storage/FileTest.php

Lines changed: 6 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -34,48 +34,15 @@ protected function setUp()
3434

3535
public function testLoad()
3636
{
37-
$this->directory
38-
->expects($this->once())
39-
->method('readFile')
37+
$this->directory->expects($this->once())
38+
->method('isReadable')
4039
->with('fixture_file.txt')
41-
->will($this->returnValue('123'));
42-
$this->assertEquals('123', $this->object->load());
43-
}
44-
45-
/**
46-
* @expectedException \Exception
47-
* @expectedExceptionMessage Exception to be propagated
48-
*/
49-
public function testLoadExceptionPropagation()
50-
{
51-
$this->directory
52-
->expects($this->once())
40+
->willReturn(true);
41+
$this->directory->expects($this->once())
5342
->method('readFile')
5443
->with('fixture_file.txt')
55-
->will($this->throwException(new \Exception('Exception to be propagated')));
56-
$this->object->load();
57-
}
58-
59-
/**
60-
* @expectedException \UnexpectedValueException
61-
* @expectedExceptionMessage Unable to retrieve deployment version of static files from the file system
62-
*/
63-
public function testLoadExceptionWrapping()
64-
{
65-
$filesystemException = new \Magento\Framework\Exception\FileSystemException(
66-
new \Magento\Framework\Phrase('File does not exist')
67-
);
68-
$this->directory
69-
->expects($this->once())
70-
->method('readFile')
71-
->with('fixture_file.txt')
72-
->will($this->throwException($filesystemException));
73-
try {
74-
$this->object->load();
75-
} catch (\Exception $e) {
76-
$this->assertSame($filesystemException, $e->getPrevious(), 'Wrapping of original exception is expected');
77-
throw $e;
78-
}
44+
->willReturn('123');
45+
$this->assertEquals('123', $this->object->load());
7946
}
8047

8148
public function testSave()

lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/VersionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
namespace Magento\Framework\App\Test\Unit\View\Deployment;
77

88
use Magento\Framework\App\View\Deployment\Version;
9-
use Magento\Framework\Exception\FileSystemException;
109

1110
/**
1211
* Class VersionTest
@@ -70,7 +69,8 @@ public function getValueFromStorageDataProvider()
7069
];
7170
}
7271

73-
public function testGetValueInNonProductionMode() {
72+
public function testGetValueInNonProductionMode()
73+
{
7474
$version = 123123123123;
7575
$this->versionStorageMock->expects($this->once())
7676
->method('load')

lib/internal/Magento/Framework/App/View/Deployment/Version.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
namespace Magento\Framework\App\View\Deployment;
88

99
use Psr\Log\LoggerInterface;
10-
use Magento\Framework\Exception\FileSystemException;
1110

1211
/**
1312
* Deployment version of static files
@@ -72,7 +71,7 @@ protected function readValue($appMode)
7271
if ($appMode == \Magento\Framework\App\State::MODE_PRODUCTION) {
7372
$this->getLogger()->critical('Can not load static content version.');
7473
throw new \UnexpectedValueException(
75-
__('Unable to retrieve deployment version of static files from the file system.')
74+
"Unable to retrieve deployment version of static files from the file system."
7675
);
7776
}
7877
$result = $this->generateVersion();

0 commit comments

Comments
 (0)