commerce_license-8.x-2.x-dev/tests/modules/commerce_license_test/src/Plugin/Commerce/LicenseType/TestLicenseBase.php
tests/modules/commerce_license_test/src/Plugin/Commerce/LicenseType/TestLicenseBase.php
<?php namespace Drupal\commerce_license_test\Plugin\Commerce\LicenseType; use Drupal\commerce_license\Entity\LicenseInterface; use Drupal\commerce_license\Plugin\Commerce\LicenseType\LicenseTypeBase; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Base class for test license types: implements the needed methods. */ class TestLicenseBase extends LicenseTypeBase { /** * The state service. * * @var \Drupal\Core\State\StateInterface */ protected $state; /** * {@inheritDoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { $instance = parent::create($container, $configuration, $plugin_id, $plugin_definition); $instance->state = $container->get('state'); return $instance; } /** * {@inheritdoc} */ public function buildLabel(LicenseInterface $license) { return 'test license'; } /** * {@inheritdoc} */ public function grantLicense(LicenseInterface $license) { } /** * {@inheritdoc} */ public function revokeLicense(LicenseInterface $license) { } }