Skip to content

Commit 8d908f0

Browse files
author
Dale Sikkema
committed
MAGETWO-44154: Random PAT build failures due to 400/503 HTTP response errors being thrown
- rename getResultFileName - re-introduce delay in sending requests in Installation test
1 parent 47df11a commit 8d908f0

File tree

16 files changed

+19
-19
lines changed

16 files changed

+19
-19
lines changed

dev/tests/integration/testsuite/Magento/Framework/Code/GeneratorTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function testGenerateClassFactoryWithNamespace()
9595
// This test is only valid if the factory created the object if Autoloader did not pick it up automatically
9696
if (\Magento\Framework\Code\Generator::GENERATION_SUCCESS == $generatorResult) {
9797
$content = $this->_clearDocBlock(
98-
file_get_contents($this->_ioObject->getResultFileName(self::CLASS_NAME_WITH_NAMESPACE . 'Factory'))
98+
file_get_contents($this->_ioObject->makeGeneratedClassFileName(self::CLASS_NAME_WITH_NAMESPACE . 'Factory'))
9999
);
100100
$expectedContent = $this->_clearDocBlock(
101101
file_get_contents(__DIR__ . '/_expected/SourceClassWithNamespaceFactory.php.sample')
@@ -120,7 +120,7 @@ public function testGenerateClassProxyWithNamespace()
120120
// This test is only valid if the factory created the object if Autoloader did not pick it up automatically
121121
if (\Magento\Framework\Code\Generator::GENERATION_SUCCESS == $generatorResult) {
122122
$content = $this->_clearDocBlock(
123-
file_get_contents($this->_ioObject->getResultFileName(self::CLASS_NAME_WITH_NAMESPACE . '\Proxy'))
123+
file_get_contents($this->_ioObject->makeGeneratedClassFileName(self::CLASS_NAME_WITH_NAMESPACE . '\Proxy'))
124124
);
125125
$expectedContent = $this->_clearDocBlock(
126126
file_get_contents(__DIR__ . '/_expected/SourceClassWithNamespaceProxy.php.sample')
@@ -142,7 +142,7 @@ public function testGenerateClassInterceptorWithNamespace()
142142
if (\Magento\Framework\Code\Generator::GENERATION_SUCCESS == $generatorResult) {
143143
$content = $this->_clearDocBlock(
144144
file_get_contents(
145-
$this->_ioObject->getResultFileName(self::CLASS_NAME_WITH_NAMESPACE . '\Interceptor')
145+
$this->_ioObject->makeGeneratedClassFileName(self::CLASS_NAME_WITH_NAMESPACE . '\Interceptor')
146146
)
147147
);
148148
$expectedContent = $this->_clearDocBlock(

lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/EntityChildTestAbstract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function testGenerate()
109109

110110
//Mocking generation
111111
$this->ioObjectMock->expects($this->any())
112-
->method('getResultFileName')
112+
->method('makeGeneratedClassFileName')
113113
->with($this->getResultClassName())
114114
->willReturn($resultFileName);
115115
$this->ioObjectMock->expects($this->once())

lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/GenerateMapperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function testGenerate()
5151
);
5252
$sampleMapperCode = file_get_contents(__DIR__ . '/_files/SampleMapper.txt');
5353
$this->ioObjectMock->expects($this->once())
54-
->method('getResultFileName')
54+
->method('makeGeneratedClassFileName')
5555
->with('\Magento\Framework\Api\Code\Generator\SampleMapper')
5656
->will($this->returnValue('SampleMapper.php'));
5757
$this->ioObjectMock->expects($this->once())

lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/GenerateSearchResultsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function testGenerate()
5252
);
5353
$sampleSearchResultBuilderCode = file_get_contents(__DIR__ . '/_files/SampleSearchResults.txt');
5454
$this->ioObjectMock->expects($this->once())
55-
->method('getResultFileName')
55+
->method('makeGeneratedClassFileName')
5656
->with('\Magento\Framework\Api\Code\Generator\SampleSearchResults')
5757
->will($this->returnValue('SampleSearchResults.php'));
5858
$this->ioObjectMock->expects($this->once())

lib/internal/Magento/Framework/Code/Generator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ protected function shouldSkipGeneration($resultEntityType, $sourceClassName, $re
191191
if (!$resultEntityType || !$sourceClassName) {
192192
return self::GENERATION_ERROR;
193193
} else if ($this->definedClasses->isClassLoadableFromDisc($resultClass)) {
194-
$generatedFileName = $this->_ioObject->getResultFileName($resultClass);
194+
$generatedFileName = $this->_ioObject->makeGeneratedClassFileName($resultClass);
195195
/**
196196
* Must handle two edge cases: a competing process has generated the class and written it to disc already,
197197
* or the class exists in committed code, despite matching pattern to be generated.

lib/internal/Magento/Framework/Code/Generator/EntityAbstract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function generate()
9797
if ($this->_validateData()) {
9898
$sourceCode = $this->_generateCode();
9999
if ($sourceCode) {
100-
$fileName = $this->_ioObject->getResultFileName($this->_getResultClassName());
100+
$fileName = $this->_ioObject->makeGeneratedClassFileName($this->_getResultClassName());
101101
$this->_ioObject->writeResultFile($fileName, $sourceCode);
102102
return $fileName;
103103
} else {

lib/internal/Magento/Framework/Code/Generator/Io.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ protected function initGeneratorDirectory($directory = null)
6161
*/
6262
public function getResultFileDirectory($className)
6363
{
64-
$fileName = $this->getResultFileName($className);
64+
$fileName = $this->makeGeneratedClassFileName($className);
6565
$pathParts = explode('/', $fileName);
6666
unset($pathParts[count($pathParts) - 1]);
6767

@@ -72,7 +72,7 @@ public function getResultFileDirectory($className)
7272
* @param string $className
7373
* @return string
7474
*/
75-
public function getResultFileName($className)
75+
public function makeGeneratedClassFileName($className)
7676
{
7777
return $this->_generationDirectory . ltrim(str_replace(['\\', '_'], '/', $className), '/') . '.php';
7878
}

lib/internal/Magento/Framework/Code/Test/Unit/Generator/EntityAbstractTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ protected function _prepareMocksForGenerateCode($willWriteCode)
286286
if ($willWriteCode) {
287287
$ioObject->expects($this->once())->method('writeResultFile')->with(self::RESULT_FILE, self::RESULT_CODE);
288288
}
289-
$ioObject->expects($this->any())->method('getResultFileName')->willReturn(self::RESULT_FILE);
289+
$ioObject->expects($this->any())->method('makeGeneratedClassFileName')->willReturn(self::RESULT_FILE);
290290

291291
return [
292292
'source_class' => $mocks['source_class'],

lib/internal/Magento/Framework/Code/Test/Unit/Generator/IoTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function testGetResultFileDirectory()
7272
public function testGetResultFileName()
7373
{
7474
$expectedFileName = self::GENERATION_DIRECTORY . '/class/name.php';
75-
$this->assertEquals($expectedFileName, $this->_object->getResultFileName(self::CLASS_NAME));
75+
$this->assertEquals($expectedFileName, $this->_object->makeGeneratedClassFileName(self::CLASS_NAME));
7676
}
7777

7878
/**

lib/internal/Magento/Framework/Code/Test/Unit/GeneratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function testGenerateClassWithExistName($fileExists)
120120
->willReturn(true);
121121

122122
$resultClassFileName = '/Magento/Path/To/Class.php';
123-
$this->ioObjectMock->expects($this->once())->method('getResultFileName')->willReturn($resultClassFileName);
123+
$this->ioObjectMock->expects($this->once())->method('makeGeneratedClassFileName')->willReturn($resultClassFileName);
124124
$this->ioObjectMock->expects($this->once())->method('fileExists')->willReturn($fileExists);
125125
$includeFileInvokeCount = $fileExists ? 1 : 0;
126126
$this->ioObjectMock->expects($this->exactly($includeFileInvokeCount))->method('includeFile');

0 commit comments

Comments
 (0)