You are here

class TestAvailabilityChecker in Commerce Core 8.2

Test availability checker.

Hierarchy

Expanded class hierarchy of TestAvailabilityChecker

1 string reference to 'TestAvailabilityChecker'
commerce_order_test.services.yml in modules/order/tests/modules/commerce_order_test/commerce_order_test.services.yml
modules/order/tests/modules/commerce_order_test/commerce_order_test.services.yml
1 service uses TestAvailabilityChecker
commerce_order_test.test_availability_checker in modules/order/tests/modules/commerce_order_test/commerce_order_test.services.yml
Drupal\commerce_order_test\TestAvailabilityChecker

File

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

Namespace

Drupal\commerce_order_test
View source
class TestAvailabilityChecker implements AvailabilityCheckerInterface {

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

  /**
   * {@inheritdoc}
   */
  public function check(OrderItemInterface $order_item, Context $context) {
    return AvailabilityResult::unavailable();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
TestAvailabilityChecker::applies public function Determines whether the checker applies to the given order item. Overrides AvailabilityCheckerInterface::applies
TestAvailabilityChecker::check public function Checks the availability of the given order item. Overrides AvailabilityCheckerInterface::check