mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
commit
de21e24ccc
12 changed files with 12 additions and 16 deletions
|
|
@ -85,9 +85,7 @@ final class ManagingProductVariantsContext implements Context
|
|||
*/
|
||||
public function iShouldSeeTheProductVariantLabeledAs($label)
|
||||
{
|
||||
$itemsLabels = array_map(function ($item) {
|
||||
return $item['descriptor'];
|
||||
}, $this->getJSONResponse());
|
||||
$itemsLabels = array_column($this->getJSONResponse(), 'descriptor');
|
||||
|
||||
Assert::oneOf($label, $itemsLabels, 'Expected "%s" to be on the list, found: %s.');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,9 +97,7 @@ final class ManagingTaxonsContext implements Context
|
|||
public function iShouldSeeTheTaxonNamedAnd(...$expectedTaxonNames)
|
||||
{
|
||||
$response = json_decode($this->client->getResponse()->getContent(), true);
|
||||
$taxonNames = array_map(function ($item) {
|
||||
return $item['name'];
|
||||
}, $response);
|
||||
$taxonNames = array_column($response, 'name');
|
||||
|
||||
Assert::allOneOf($taxonNames, $expectedTaxonNames);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -342,7 +342,7 @@ final class ProductContext implements Context
|
|||
$productVariantName,
|
||||
$price,
|
||||
StringInflector::nameToUppercaseCode($productVariantName),
|
||||
(null !== $channel) ? $channel : $this->sharedStorage->get('channel')
|
||||
$channel ?? $this->sharedStorage->get('channel')
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -848,7 +848,7 @@ final class ManagingOrdersContext implements Context
|
|||
*/
|
||||
private function assertElementValidationMessage($type, $element, $expectedMessage)
|
||||
{
|
||||
$element = sprintf('%s_%s', $type, implode('_', explode(' ', $element)));
|
||||
$element = sprintf('%s_%s', $type, str_replace(' ', '_', $element));
|
||||
Assert::true($this->updatePage->checkValidationMessageFor($element, $expectedMessage));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -412,7 +412,7 @@ final class CheckoutAddressingContext implements Context
|
|||
*/
|
||||
private function assertElementValidationMessage($type, $element, $expectedMessage)
|
||||
{
|
||||
$element = sprintf('%s_%s', $type, implode('_', explode(' ', $element)));
|
||||
$element = sprintf('%s_%s', $type, str_replace(' ', '_', $element));
|
||||
Assert::true($this->addressPage->checkValidationMessageFor($element, $expectedMessage));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
|
|||
*/
|
||||
public function chooseDefaultTaxZone($taxZone)
|
||||
{
|
||||
$this->getDocument()->selectFieldOption('Default tax zone', (null === $taxZone) ? '' : $taxZone);
|
||||
$this->getDocument()->selectFieldOption('Default tax zone', $taxZone ?? '');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
|
|||
*/
|
||||
private function chooseCountry($country, $addressType)
|
||||
{
|
||||
$this->getElement($addressType . '_country')->selectOption((null !== $country) ? $country : 'Select');
|
||||
$this->getElement($addressType . '_country')->selectOption($country ?? 'Select');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ abstract class SymfonyPage extends Page implements SymfonyPageInterface
|
|||
$replace[sprintf('?%s=%s', $key, $value)] = '';
|
||||
}
|
||||
|
||||
$path = str_replace(array_keys($replace), array_values($replace), $path);
|
||||
$path = str_replace(array_keys($replace), $replace, $path);
|
||||
|
||||
return $this->makePathAbsolute($path);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,6 +113,6 @@ final class LocaleStrippingRouter implements RouterInterface, WarmableInterface
|
|||
sprintf('?%s=%s', $key, $value) => '',
|
||||
];
|
||||
|
||||
return str_replace(array_keys($replace), array_values($replace), $url);
|
||||
return str_replace(array_keys($replace), $replace, $url);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ final class CircularDependencyChecker implements CircularDependencyCheckerInterf
|
|||
return;
|
||||
}
|
||||
|
||||
$previousThemes = array_merge($previousThemes, [$theme]);
|
||||
$previousThemes[] = $theme;
|
||||
foreach ($theme->getParents() as $parent) {
|
||||
if (in_array($parent, $previousThemes, true)) {
|
||||
throw new CircularDependencyFoundException(array_merge($previousThemes, [$parent]));
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ final class DefaultChannelFactory implements DefaultChannelFactoryInterface
|
|||
*/
|
||||
private function provideCurrency(?string $currencyCode): CurrencyInterface
|
||||
{
|
||||
$currencyCode = (null !== $currencyCode) ? $currencyCode : self::DEFAULT_CHANNEL_CURRENCY;
|
||||
$currencyCode = $currencyCode ?? self::DEFAULT_CHANNEL_CURRENCY;
|
||||
|
||||
/** @var CurrencyInterface $currency */
|
||||
$currency = $this->currencyRepository->findOneBy(['code' => $currencyCode]);
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ class Promotion implements PromotionInterface
|
|||
*/
|
||||
public function setPriority(?int $priority): void
|
||||
{
|
||||
$this->priority = null === $priority ? -1 : $priority;
|
||||
$this->priority = $priority ?? -1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue