class TestAvailabilityChecker in Commerce Core 8.2
Test availability checker.
Hierarchy
- class \Drupal\commerce_order_test\TestAvailabilityChecker implements AvailabilityCheckerInterface
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_testView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
TestAvailabilityChecker:: |
public | function |
Determines whether the checker applies to the given order item. Overrides AvailabilityCheckerInterface:: |
|
TestAvailabilityChecker:: |
public | function |
Checks the availability of the given order item. Overrides AvailabilityCheckerInterface:: |