Skip to content

Commit dd493bd

Browse files
author
Joan He
committed
MAGETWO-89260: Fix Travis build issues
1 parent 069067b commit dd493bd

File tree

10 files changed

+33
-29
lines changed

10 files changed

+33
-29
lines changed

app/code/Magento/Backend/Block/Menu.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,12 @@ public function renderNavigation($menu, $level = 0, $limit = 0, $colBrakes = [])
387387
$itemName = substr($menuId, strrpos($menuId, '::') + 2);
388388
$itemClass = str_replace('_', '-', strtolower($itemName));
389389

390-
if (count($colBrakes) && $colBrakes[$itemPosition]['colbrake'] && $itemPosition != 1) {
390+
if (
391+
is_array($colBrakes)
392+
&& count($colBrakes)
393+
&& $colBrakes[$itemPosition]['colbrake']
394+
&& $itemPosition != 1
395+
) {
391396
$output .= '</ul></li><li class="column"><ul role="menu">';
392397
}
393398

@@ -401,7 +406,7 @@ public function renderNavigation($menu, $level = 0, $limit = 0, $colBrakes = [])
401406
$itemPosition++;
402407
}
403408

404-
if (count($colBrakes) && $limit) {
409+
if (is_array($colBrakes) && count($colBrakes) && $limit) {
405410
$output = '<li class="column"><ul role="menu">' . $output . '</ul></li>';
406411
}
407412

app/code/Magento/Theme/Block/Html/Topmenu.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ protected function _getHtml(
244244
}
245245
}
246246

247-
if (count($colBrakes) && $colBrakes[$counter]['colbrake']) {
247+
if (is_array($colBrakes) && count($colBrakes) && $colBrakes[$counter]['colbrake']) {
248248
$html .= '</ul></li><li class="column"><ul>';
249249
}
250250

@@ -261,7 +261,7 @@ protected function _getHtml(
261261
$counter++;
262262
}
263263

264-
if (count($colBrakes) && $limit) {
264+
if (is_array($colBrakes) && count($colBrakes) && $limit) {
265265
$html = '<li class="column"><ul>' . $html . '</ul></li>';
266266
}
267267

dev/tests/integration/testsuite/Magento/Framework/Session/ConfigTest.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,24 @@
1313
class ConfigTest extends \PHPUnit\Framework\TestCase
1414
{
1515
/** @var \Magento\Framework\Session\Config */
16-
protected $_model;
16+
private $_model;
1717

1818
/** @var string */
19-
protected $_cacheLimiter = 'private_no_expire';
19+
private $_cacheLimiter = 'private_no_expire';
2020

2121
/** @var \Magento\TestFramework\ObjectManager */
22-
protected $_objectManager;
22+
private $_objectManager;
2323

2424
/** @var string Default value for session.save_path setting */
25-
protected $defaultSavePath;
25+
private $defaultSavePath;
2626

2727
/** @var \Magento\Framework\App\DeploymentConfig | \PHPUnit_Framework_MockObject_MockObject */
28-
protected $deploymentConfigMock;
28+
private $deploymentConfigMock;
2929

3030
protected function setUp()
3131
{
3232
$this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
33-
/** @var $sessionManager \Magento\Framework\Session\SessionManager */
34-
$sessionManager = $this->_objectManager->create(\Magento\Framework\Session\SessionManager::class);
35-
if ($sessionManager->isSessionExists()) {
36-
$sessionManager->writeClose();
37-
}
33+
3834
$this->deploymentConfigMock = $this->createMock(\Magento\Framework\App\DeploymentConfig::class);
3935
$this->deploymentConfigMock
4036
->method('get')

dev/tests/integration/testsuite/Magento/Framework/Session/SaveHandlerTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,8 @@ public function testSetSaveHandler($deploymentConfigHandler, $iniHandler)
5555
$expected,
5656
ObjectManager::getInstance()->get(ConfigInterface::class)->getOption('session.save_handler')
5757
);
58-
}
5958

60-
public function tearDown()
61-
{
62-
if (isset($this->originalSaveHandler)) {
59+
if ($iniHandler && isset($this->originalSaveHandler) && $iniHandler != $this->originalSaveHandler) {
6360
ini_set('session.save_handler', $this->originalSaveHandler);
6461
}
6562
}

dev/tests/integration/testsuite/Magento/Framework/Session/SessionManagerTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ protected function tearDown()
114114
{
115115
global $mockPHPFunctions;
116116
$mockPHPFunctions = false;
117+
$this->_model->destroy();
117118
}
118119

119120
public function testSessionNameFromIni()
@@ -149,7 +150,9 @@ public function testGetName()
149150

150151
public function testSetName()
151152
{
153+
$this->_model->destroy();
152154
$this->_model->setName('test');
155+
$this->_model->start();
153156
$this->assertEquals('test', $this->_model->getName());
154157
}
155158

dev/tests/integration/testsuite/Magento/Framework/Session/SidResolverTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,12 @@ public function testGetSessionIdQueryParam()
154154

155155
public function testGetSessionIdQueryParamCustom()
156156
{
157+
$this->session->destroy();
157158
$oldSessionName = $this->session->getName();
158159
$this->session->setName($this->customSessionName);
159160
$this->assertEquals($this->customSessionQueryParam, $this->model->getSessionIdQueryParam($this->session));
160161
$this->session->setName($oldSessionName);
162+
$this->session->start();
161163
}
162164

163165
public function testSetGetUseSessionVar()

lib/internal/Magento/Framework/Encryption/Test/Unit/CryptTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,10 @@ public function getConstructorExceptionData()
111111
$tooShortInitVector = str_repeat('-', $this->_getInitVectorSize($cipher, $mode) - 1);
112112
$tooLongInitVector = str_repeat('-', $this->_getInitVectorSize($cipher, $mode) + 1);
113113
$result['tooLongKey-' . $cipher . '-' . $mode . '-false'] = [$tooLongKey, $cipher, $mode, false];
114-
$result['key-' . $cipher . '-' . $mode . '-tooShortInitVector'] = [$this->_key, $cipher, $mode, $tooShortInitVector];
115-
$result['key-' . $cipher . '-' . $mode . '-tooLongInitVector'] = [$this->_key, $cipher, $mode, $tooLongInitVector];
114+
$result['key-' . $cipher . '-' . $mode . '-tooShortInitVector']
115+
= [$this->_key, $cipher, $mode, $tooShortInitVector];
116+
$result['key-' . $cipher . '-' . $mode . '-tooLongInitVector']
117+
= [$this->_key, $cipher, $mode, $tooLongInitVector];
116118
}
117119
}
118120
return $result;

lib/internal/Magento/Framework/File/Uploader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ private function _setUploadFileId($fileId)
534534

535535
preg_match("/^(.*?)\[(.*?)\]$/", $fileId, $file);
536536

537-
if (count($file) > 0 && count($file[0]) > 0 && count($file[1]) > 0) {
537+
if (is_array($file) && count($file) > 0 && count($file[0]) > 0 && count($file[1]) > 0) {
538538
array_shift($file);
539539
$this->_uploadType = self::MULTIPLE_STYLE;
540540

@@ -547,7 +547,7 @@ private function _setUploadFileId($fileId)
547547

548548
$fileAttributes = $tmpVar;
549549
$this->_file = $fileAttributes;
550-
} elseif (count($fileId) > 0 && isset($_FILES[$fileId])) {
550+
} elseif (!empty($fileId) && isset($_FILES[$fileId])) {
551551
$this->_uploadType = self::SINGLE_STYLE;
552552
$this->_file = $_FILES[$fileId];
553553
} elseif ($fileId == '') {

setup/src/Magento/Setup/Fixtures/ConfigurableProductsFixture.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -847,10 +847,11 @@ private function getDescriptionClosure(
847847
$minAmountOfWordsDescription,
848848
$descriptionPrefix
849849
) {
850+
$countSearchTerms = is_array($searchTerms) ? count($searchTerms) : 0;
850851
$count = !$searchTerms
851852
? 0
852853
: round(
853-
$searchTerms[$index % count($searchTerms)]['count'] * (
854+
$searchTerms[$index % $countSearchTerms]['count'] * (
854855
$configurableProductsCount / ($simpleProductsCount + $configurableProductsCount)
855856
)
856857
);
@@ -860,8 +861,8 @@ private function getDescriptionClosure(
860861
$maxAmountOfWordsDescription,
861862
$descriptionPrefix . '-' . $index
862863
) .
863-
($index <= ($count * count($searchTerms)) ? ' ' .
864-
$searchTerms[$index % count($searchTerms)]['term'] : '');
864+
($index <= ($count * $countSearchTerms) ? ' ' .
865+
$searchTerms[$index % $countSearchTerms]['term'] : '');
865866
};
866867
}
867868

setup/src/Magento/Setup/Model/FixtureGenerator/ProductGenerator.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,8 @@ public function generate($products, $fixtureMap)
170170
],
171171
],
172172
];
173-
if (
174-
!is_array($fixtureMap['website_ids'](1, 0)) ||
175-
count($fixtureMap['website_ids'](1, 0)) === 1
176-
) {
173+
$websiteIdsFixtures = $fixtureMap['website_ids'](1, 0);
174+
if ((is_array($websiteIdsFixtures) && count($websiteIdsFixtures) === 1) || !is_null($websiteIdsFixtures)) {
177175
// Get website id from fixture in case when one site is assigned per product
178176
$customTableMap['catalog_product_website'] = [
179177
'fields' => [

0 commit comments

Comments
 (0)