Skip to content

Commit 83ad4b1

Browse files
committed
MC-33069: Stabilize Unit tests
1 parent 431a535 commit 83ad4b1

File tree

7 files changed

+12
-8
lines changed

7 files changed

+12
-8
lines changed

app/code/Magento/Customer/Model/Customer/DataProviderWithDefaultAddresses.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ private function prepareDefaultAddress($address): array
165165
if (isset($addressData['street']) && !\is_array($address['street'])) {
166166
$addressData['street'] = explode("\n", $addressData['street']);
167167
}
168-
$addressData['country'] = $this->countryFactory->create()
169-
->loadByCode($addressData['country_id'])->getName();
168+
$countryId = $addressData['country_id'] ?? null;
169+
$addressData['country'] = $this->countryFactory->create()->loadByCode($countryId)->getName();
170170
}
171171

172172
return $addressData;

app/code/Magento/Eav/Model/Entity/AbstractEntity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ public function getLinkField()
766766
if (!$this->linkIdField) {
767767
$indexList = $this->getConnection()->getIndexList($this->getEntityTable());
768768
$pkName = $this->getConnection()->getPrimaryKeyName($this->getEntityTable());
769-
$this->linkIdField = $indexList[$pkName]['COLUMNS_LIST'][0];
769+
$this->linkIdField = $indexList[$pkName]['COLUMNS_LIST'][0] ?? null;
770770
if (!$this->linkIdField) {
771771
$this->linkIdField = $this->getEntityIdField();
772772
}

app/code/Magento/Indexer/Console/Command/IndexerReindexCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8383

8484
$startTime = microtime(true);
8585
$indexerConfig = $this->getConfig()->getIndexer($indexer->getId());
86-
$sharedIndex = $indexerConfig['shared_index'];
86+
$sharedIndex = $indexerConfig['shared_index'] ?? null;
8787

8888
// Skip indexers having shared index that was already complete
8989
if (!in_array($sharedIndex, $this->sharedIndexesComplete)) {

app/code/Magento/Indexer/Model/Processor.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,17 @@ public function reindexAllInvalid()
6565
$indexerConfig = $this->config->getIndexer($indexerId);
6666
if ($indexer->isInvalid()) {
6767
// Skip indexers having shared index that was already complete
68-
if (!in_array($indexerConfig['shared_index'], $sharedIndexesComplete)) {
68+
$sharedIndex = $indexerConfig['shared_index'] ?? null;
69+
if (!in_array($sharedIndex, $sharedIndexesComplete)) {
6970
$indexer->reindexAll();
7071
} else {
7172
/** @var \Magento\Indexer\Model\Indexer\State $state */
7273
$state = $indexer->getState();
7374
$state->setStatus(StateInterface::STATUS_VALID);
7475
$state->save();
7576
}
76-
if ($indexerConfig['shared_index']) {
77-
$sharedIndexesComplete[] = $indexerConfig['shared_index'];
77+
if ($sharedIndex) {
78+
$sharedIndexesComplete[] = $sharedIndex;
7879
}
7980
}
8081
}

app/code/Magento/VaultGraphQl/Model/Resolver/DeletePaymentToken.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public function resolve(
5858
throw new GraphQlAuthorizationException(__('The current customer isn\'t authorized.'));
5959
}
6060

61+
$args['public_hash'] = $args['public_hash'] ?? '';
6162
$token = $this->paymentTokenManagement->getByPublicHash($args['public_hash'], $context->getUserId());
6263
if (!$token) {
6364
throw new GraphQlNoSuchEntityException(

lib/internal/Magento/Framework/App/Route/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ protected function _getRoutes($scope = null)
9090
}
9191

9292
$routers = $this->_reader->read($scope);
93-
$routes = $routers[$this->_areaList->getDefaultRouter($scope)]['routes'];
93+
$routes = $routers[$this->_areaList->getDefaultRouter($scope)]['routes'] ?? null;
9494
$routesData = $this->getSerializer()->serialize($routes);
9595
$this->_cache->save($routesData, $cacheId);
9696
$this->_routes[$scope] = $routes;

lib/internal/Magento/Framework/Phrase.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ public function render()
101101
{
102102
try {
103103
return self::getRenderer()->render([$this->text], $this->getArguments());
104+
} catch (\Error $e) {
105+
return $this->getText();
104106
} catch (\Exception $e) {
105107
return $this->getText();
106108
}

0 commit comments

Comments
 (0)