PurchasedEntityConditionTest.php in Commerce Core 8.2
File
modules/order/tests/src/Kernel/Plugin/Commerce/Condition/PurchasedEntityConditionTest.php
View source
<?php
namespace Drupal\Tests\commerce_order\Kernel\Plugin\Commerce\Condition;
use Drupal\Core\Plugin\PluginBase;
use Drupal\Tests\commerce_order\Kernel\OrderKernelTestBase;
class PurchasedEntityConditionTest extends OrderKernelTestBase {
public function testDerivative(string $base_plugin_id, string $purchasable_entity_type_id, string $expected_label) {
$plugin_manager = $this->container
->get('plugin.manager.commerce_condition');
$plugin = $plugin_manager
->getDefinition($base_plugin_id . PluginBase::DERIVATIVE_SEPARATOR . $purchasable_entity_type_id);
$this
->assertNotNull($plugin);
$this
->assertEquals($expected_label, $plugin['label']);
$this
->assertEquals($purchasable_entity_type_id, $plugin['purchasable_entity_type']);
}
public function derivativeData() : \Generator {
(yield [
'order_purchased_entity',
'commerce_product_variation',
'Product variation',
]);
(yield [
'order_item_purchased_entity',
'commerce_product_variation',
'Product variation',
]);
}
}