Loading modules/order/src/OrderRefresh.php +5 −1 Changes for modules/order/src/OrderRefresh.php: 5 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -71,9 +71,13 @@ class OrderRefresh implements OrderRefreshInterface { * {@inheritdoc} */ public function needsRefresh(OrderInterface $order) { // Refresh should only run on draft orders. if ($order->getState()->value != 'draft') { return FALSE; } /** @var \Drupal\commerce_order\Entity\OrderTypeInterface $order_type */ $order_type = $this->orderTypeStorage->load($order->bundle()); // Check the order's changed time against the refresh frequency. // We use time() since the REQUEST_TIME constant can become stale. This is // especially true during CLI operations. Loading modules/order/tests/src/Kernel/OrderRefreshTest.php +9 −1 Changes for modules/order/tests/src/Kernel/OrderRefreshTest.php: 9 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ use Drupal\profile\Entity\Profile; class OrderRefreshTest extends EntityKernelTestBase { /** * The order refresh service. * The order refresh. * * @var \Drupal\commerce_order\OrderRefreshInterface */ Loading Loading @@ -63,6 +63,8 @@ class OrderRefreshTest extends EntityKernelTestBase { protected $variation2; /** * The order item storage. * * @var \Drupal\commerce_order\OrderItemStorageInterface */ protected $orderItemStorage; Loading Loading @@ -193,6 +195,12 @@ class OrderRefreshTest extends EntityKernelTestBase { $this->assertFalse($this->orderRefresh->needsRefresh($this->order)); $this->order->setOwner($this->user); $this->assertTrue($this->orderRefresh->needsRefresh($this->order)); sleep(1); $workflow = $this->order->getState()->getWorkflow(); $this->order->getState()->applyTransition($workflow->getTransition('place')); $this->order->save(); $this->assertFalse($this->orderRefresh->needsRefresh($this->order)); } /** Loading Loading
modules/order/src/OrderRefresh.php +5 −1 Changes for modules/order/src/OrderRefresh.php: 5 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -71,9 +71,13 @@ class OrderRefresh implements OrderRefreshInterface { * {@inheritdoc} */ public function needsRefresh(OrderInterface $order) { // Refresh should only run on draft orders. if ($order->getState()->value != 'draft') { return FALSE; } /** @var \Drupal\commerce_order\Entity\OrderTypeInterface $order_type */ $order_type = $this->orderTypeStorage->load($order->bundle()); // Check the order's changed time against the refresh frequency. // We use time() since the REQUEST_TIME constant can become stale. This is // especially true during CLI operations. Loading
modules/order/tests/src/Kernel/OrderRefreshTest.php +9 −1 Changes for modules/order/tests/src/Kernel/OrderRefreshTest.php: 9 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ use Drupal\profile\Entity\Profile; class OrderRefreshTest extends EntityKernelTestBase { /** * The order refresh service. * The order refresh. * * @var \Drupal\commerce_order\OrderRefreshInterface */ Loading Loading @@ -63,6 +63,8 @@ class OrderRefreshTest extends EntityKernelTestBase { protected $variation2; /** * The order item storage. * * @var \Drupal\commerce_order\OrderItemStorageInterface */ protected $orderItemStorage; Loading Loading @@ -193,6 +195,12 @@ class OrderRefreshTest extends EntityKernelTestBase { $this->assertFalse($this->orderRefresh->needsRefresh($this->order)); $this->order->setOwner($this->user); $this->assertTrue($this->orderRefresh->needsRefresh($this->order)); sleep(1); $workflow = $this->order->getState()->getWorkflow(); $this->order->getState()->applyTransition($workflow->getTransition('place')); $this->order->save(); $this->assertFalse($this->orderRefresh->needsRefresh($this->order)); } /** Loading