Skip to content

Commit 364f9e0

Browse files
committed
MAGETWO-58924: SQL error wait timeout error when saving categories
- fix static issues
1 parent f1e86df commit 364f9e0

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

lib/internal/Magento/Framework/DB/TemporaryTableService.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
*/
1717
class TemporaryTableService
1818
{
19-
CONST HASH = 'HASH';
20-
CONST INNODB = 'INNODB';
19+
const INDEX_METHOD_HASH = 'HASH';
20+
const INDEX_METHOD_INNODB = 'INNODB';
2121

2222
/**
2323
* @var string[]
@@ -46,8 +46,8 @@ class TemporaryTableService
4646
*/
4747
public function __construct(
4848
\Magento\Framework\Math\Random $random,
49-
$allowedIndexMethods = [self::HASH],
50-
$allowedEngines = [self::INNODB]
49+
$allowedIndexMethods = [],
50+
$allowedEngines = []
5151
) {
5252
$this->random = $random;
5353
$this->allowedIndexMethods = $allowedIndexMethods;
@@ -83,18 +83,18 @@ public function createFromSelect(
8383
Select $select,
8484
AdapterInterface $adapter,
8585
array $indexes = [],
86-
$indexMethod = self::HASH,
87-
$dbEngine = self::INNODB
86+
$indexMethod = self::INDEX_METHOD_HASH,
87+
$dbEngine = self::INDEX_METHOD_INNODB
8888
) {
8989
if (!in_array($indexMethod, $this->allowedIndexMethods)) {
9090
throw new \InvalidArgumentException(
91-
sprintf('indexMethod must be of type %s', implode(',', $this->allowedIndexMethods))
91+
sprintf('indexMethod must be one of %s', implode(',', $this->allowedIndexMethods))
9292
);
9393
}
9494

9595
if (!in_array($dbEngine, $this->allowedEngines)) {
9696
throw new \InvalidArgumentException(
97-
sprintf('dbEngine must be of type %s', implode(',', $this->allowedEngines))
97+
sprintf('dbEngine must be one of %s', implode(',', $this->allowedEngines))
9898
);
9999
}
100100

lib/internal/Magento/Framework/DB/Test/Unit/TemporaryTableServiceTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ protected function setUp()
4646
$this->temporaryTableService = (new ObjectManager($this))->getObject(
4747
TemporaryTableService::class,
4848
[
49-
'random' => $this->randomMock
49+
'random' => $this->randomMock,
50+
'allowedIndexMethods' => ['HASH'],
51+
'allowedEngines' => ['INNODB']
5052
]
5153
);
5254
}
@@ -72,8 +74,8 @@ public function testCreateFromSelectWithException()
7274
$this->selectMock,
7375
$this->adapterMock,
7476
$indexes,
75-
TemporaryTableService::HASH . "Other",
76-
TemporaryTableService::INNODB . "Other"
77+
TemporaryTableService::INDEX_METHOD_HASH . "Other",
78+
TemporaryTableService::INDEX_METHOD_INNODB . "Other"
7779
)
7880
);
7981
}

0 commit comments

Comments
 (0)