Skip to content

Commit 2b07ee7

Browse files
author
Serhiy Shkolyarenko
committed
MAGETWO-46206: Fix random fails of Magento\Checkout\Test\TestCase\OnePageCheckoutTest functional test
- CR changes
1 parent c74eef3 commit 2b07ee7

File tree

1 file changed

+15
-25
lines changed
  • dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart

1 file changed

+15
-25
lines changed

dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/Shipping.php

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -92,29 +92,6 @@ public function selectShippingMethod(array $shipping)
9292
}
9393
}
9494

95-
/**
96-
* Compare elements according to $this->estimationFields order
97-
*
98-
* @param $a
99-
* @param $b
100-
* @return int
101-
*/
102-
public function compare($a, $b)
103-
{
104-
$a = array_search($a, $this->estimationFields);
105-
$b = array_search($b, $this->estimationFields);
106-
switch (true) {
107-
case false !== $a && false !== $b:
108-
return $a - $b;
109-
case false !== $a:
110-
return -1;
111-
case false !== $b:
112-
return 1;
113-
default:
114-
return 0;
115-
}
116-
}
117-
11895
/**
11996
* Fill shipping and tax form.
12097
*
@@ -126,8 +103,21 @@ public function fillEstimateShippingAndTax(Address $address)
126103
$this->openEstimateShippingAndTax();
127104
$data = $address->getData();
128105
$mapping = $this->dataMapping(array_intersect_key($data, array_flip($this->estimationFields)));
129-
// sort array according to $this->estimationFields element order
130-
uksort($mapping, [$this, 'compare']);
106+
// sort array according to $this->estimationFields elements order
107+
uksort($mapping, function ($a, $b) {
108+
$a = array_search($a, $this->estimationFields);
109+
$b = array_search($b, $this->estimationFields);
110+
switch (true) {
111+
case false !== $a && false !== $b:
112+
return $a - $b;
113+
case false !== $a:
114+
return -1;
115+
case false !== $b:
116+
return 1;
117+
default:
118+
return 0;
119+
}
120+
});
131121

132122
// Test environment may become unstable when form fields are filled in a default manner.
133123
// Imitating behavior closer to the real user.

0 commit comments

Comments
 (0)