You are here

public function TestAvailabilityChecker::applies in Commerce Core 8.2

Determines whether the checker applies to the given order item.

Parameters

\Drupal\commerce_order\Entity\OrderItemInterface $order_item: The order item.

Return value

bool TRUE if the checker applies to the given order item, FALSE otherwise.

Overrides AvailabilityCheckerInterface::applies

File

modules/order/tests/modules/commerce_order_test/src/TestAvailabilityChecker.php, line 19

Class

TestAvailabilityChecker
Test availability checker.

Namespace

Drupal\commerce_order_test

Code

public function applies(OrderItemInterface $order_item) {
  $purchased_entity = $order_item
    ->getPurchasedEntity();
  return $purchased_entity instanceof ProductVariationInterface && strpos($purchased_entity
    ->getSku(), 'TEST_') !== FALSE;
}