Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #6 from bartfeenstra/unit-test-fixes
Browse files Browse the repository at this point in the history
Fix unit tests by chasing Drupal Core and Plugin.
  • Loading branch information
bartfeenstra committed Nov 14, 2015
2 parents b01009f + c3a34dd commit d850d9d
Show file tree
Hide file tree
Showing 38 changed files with 185 additions and 214 deletions.
8 changes: 4 additions & 4 deletions modules/payment_form/src/Entity/Payment/PaymentForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use Drupal\payment\Plugin\Payment\Method\PaymentExecutionPaymentMethodManager;
use Drupal\plugin\Plugin\Plugin\PluginSelector\PluginSelectorManagerInterface;
use Drupal\plugin\PluginDiscovery\LimitedPluginDiscoveryDecorator;
use Drupal\plugin\PluginTypeInterface;
use Drupal\plugin\PluginType\PluginTypeInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
Expand All @@ -34,7 +34,7 @@ class PaymentForm extends ContentEntityForm {
/**
* The payment method plugin type.
*
* @var \Drupal\plugin\PluginTypeInterface
* @var \Drupal\plugin\PluginType\PluginTypeInterface
*/
protected $paymentMethodType;

Expand All @@ -53,7 +53,7 @@ class PaymentForm extends ContentEntityForm {
* @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
* @param \Drupal\Core\Session\AccountInterface $current_user
* @param \Drupal\plugin\Plugin\Plugin\PluginSelector\PluginSelectorManagerInterface $plugin_selector_manager
* @param \Drupal\plugin\PluginTypeInterface $payment_method_type
* @param \Drupal\plugin\PluginType\PluginTypeInterface $payment_method_type
*/
public function __construct(EntityManagerInterface $entity_manager, TranslationInterface $string_translation, AccountInterface $current_user, PluginSelectorManagerInterface $plugin_selector_manager, PluginTypeInterface $payment_method_type) {
parent::__construct($entity_manager);
Expand All @@ -68,7 +68,7 @@ public function __construct(EntityManagerInterface $entity_manager, TranslationI
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
/** @var \Drupal\plugin\PluginTypeManagerInterface $plugin_type_manager */
/** @var \Drupal\plugin\PluginType\PluginTypeManagerInterface $plugin_type_manager */
$plugin_type_manager = $container->get('plugin.plugin_type_manager');

return new static($container->get('entity.manager'), $container->get('string_translation'), $container->get('current_user'), $container->get('plugin.manager.plugin.plugin_selector'), $plugin_type_manager->getPluginType('payment_method'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\payment\Plugin\Payment\Method\PaymentMethodManagerInterface;
use Drupal\plugin\PluginTypeInterface;
use Drupal\plugin\PluginType\PluginTypeInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
Expand All @@ -32,7 +32,7 @@ class PaymentFormConfigurationForm extends ConfigFormBase {
/**
* The plugin selector plugin type.
*
* @var \Drupal\plugin\PluginTypeInterface
* @var \Drupal\plugin\PluginType\PluginTypeInterface
*/
protected $pluginSelectorType;

Expand All @@ -42,7 +42,7 @@ class PaymentFormConfigurationForm extends ConfigFormBase {
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
* @param \Drupal\payment\Plugin\Payment\Method\PaymentMethodManagerInterface $payment_method_manager
* @param \Drupal\plugin\PluginTypeInterface $plugin_selector_type
* @param \Drupal\plugin\PluginType\PluginTypeInterface $plugin_selector_type
*/
public function __construct(ConfigFactoryInterface $config_factory, TranslationInterface $string_translation, PaymentMethodManagerInterface $payment_method_manager, PluginTypeInterface $plugin_selector_type) {
parent::__construct($config_factory);
Expand All @@ -55,7 +55,7 @@ public function __construct(ConfigFactoryInterface $config_factory, TranslationI
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
/** @var \Drupal\plugin\PluginTypeManagerInterface $plugin_type_manager */
/** @var \Drupal\plugin\PluginType\PluginTypeManagerInterface $plugin_type_manager */
$plugin_type_manager = $container->get('plugin.plugin_type_manager');

return new static(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
use Drupal\payment_form\Entity\Payment\PaymentForm;
use Drupal\plugin\Plugin\Plugin\PluginSelector\PluginSelectorInterface;
use Drupal\plugin\Plugin\Plugin\PluginSelector\PluginSelectorManagerInterface;
use Drupal\plugin\PluginType;
use Drupal\plugin\PluginTypeManagerInterface;
use Drupal\plugin\PluginType\PluginType;
use Drupal\plugin\PluginType\PluginTypeManagerInterface;
use Drupal\Tests\payment\Unit\PHPUnitStubMap;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\DependencyInjection\ContainerInterface;
Expand Down Expand Up @@ -91,7 +91,7 @@ class PaymentFormTest extends UnitTestCase {
/**
* The payment method plugin type.
*
* @var \Drupal\plugin\PluginTypeInterface
* @var \Drupal\plugin\PluginType\PluginTypeInterface
*/
protected $paymentMethodType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public function testViewElements() {
->with($payment, 'payment_form')
->willReturn($form);

$this->assertSame($form, $this->sut->viewElements($items));
$this->assertSame($form, $this->sut->viewElements($items, 'en'));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
use Drupal\payment_form\Plugin\Payment\Type\PaymentFormConfigurationForm;
use Drupal\plugin\Plugin\Plugin\PluginSelector\PluginSelectorInterface;
use Drupal\plugin\Plugin\Plugin\PluginSelector\PluginSelectorManagerInterface;
use Drupal\plugin\PluginType;
use Drupal\plugin\PluginTypeManagerInterface;
use Drupal\plugin\PluginType\PluginType;
use Drupal\plugin\PluginType\PluginTypeManagerInterface;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\DependencyInjection\ContainerInterface;

Expand Down Expand Up @@ -66,7 +66,7 @@ class PaymentFormConfigurationFormTest extends UnitTestCase {
/**
* The plugin selector plugin type.
*
* @var \Drupal\plugin\PluginTypeInterface
* @var \Drupal\plugin\PluginType\PluginTypeInterface
*/
protected $pluginSelectorType;

Expand Down
6 changes: 3 additions & 3 deletions modules/payment_reference/src/Element/PaymentReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use Drupal\payment\Element\PaymentReferenceBase;
use Drupal\payment\QueueInterface;
use Drupal\plugin\Plugin\Plugin\PluginSelector\PluginSelectorManagerInterface;
use Drupal\plugin\PluginTypeInterface;
use Drupal\plugin\PluginType\PluginTypeInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RequestStack;

Expand Down Expand Up @@ -52,7 +52,7 @@ class PaymentReference extends PaymentReferenceBase {
* @param \Drupal\Core\Render\RendererInterface $renderer
* @param \Drupal\Core\Session\AccountInterface $current_user
* @param \Drupal\plugin\Plugin\Plugin\PluginSelector\PluginSelectorManagerInterface $plugin_selector_manager
* @param \Drupal\plugin\PluginTypeInterface $payment_method_type
* @param \Drupal\plugin\PluginType\PluginTypeInterface $payment_method_type
* @param \Drupal\payment\QueueInterface $payment_queue
*/
public function __construct($configuration, $plugin_id, $plugin_definition, RequestStack $request_stack, EntityStorageInterface $payment_storage, TranslationInterface $string_translation, DateFormatter $date_formatter, LinkGeneratorInterface $link_generator, RendererInterface $renderer, AccountInterface $current_user, PluginSelectorManagerInterface $plugin_selector_manager, PluginTypeInterface $payment_method_type, Random $random, QueueInterface $payment_queue) {
Expand All @@ -67,7 +67,7 @@ public static function create(ContainerInterface $container, array $configuratio
/** @var \Drupal\Core\Entity\EntityManagerInterface $entity_manager */
$entity_manager = $container->get('entity.manager');

/** @var \Drupal\plugin\PluginTypeManagerInterface $plugin_type_manager */
/** @var \Drupal\plugin\PluginType\PluginTypeManagerInterface $plugin_type_manager */
$plugin_type_manager = $container->get('plugin.plugin_type_manager');

return new static($configuration, $plugin_id, $plugin_definition, $container->get('request_stack'), $entity_manager->getStorage('payment'), $container->get('string_translation'), $container->get('date.formatter'), $container->get('link_generator'), $container->get('renderer'), $container->get('current_user'), $container->get('plugin.manager.plugin.plugin_selector'), $plugin_type_manager->getPluginType('payment_method'), new Random(), $container->get('payment_reference.queue'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\payment\Plugin\Payment\Method\PaymentMethodManagerInterface;
use Drupal\plugin\PluginTypeInterface;
use Drupal\plugin\PluginType\PluginTypeInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
Expand All @@ -31,7 +31,7 @@ class PaymentReferenceConfigurationForm extends ConfigFormBase {
/**
* The plugin selector plugin type.
*
* @var \Drupal\plugin\PluginTypeInterface
* @var \Drupal\plugin\PluginType\PluginTypeInterface
*/
protected $pluginSelectorType;

Expand All @@ -41,7 +41,7 @@ class PaymentReferenceConfigurationForm extends ConfigFormBase {
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
* @param \Drupal\payment\Plugin\Payment\Method\PaymentMethodManagerInterface $payment_method_manager
* @param \Drupal\plugin\PluginTypeInterface $plugin_selector_type
* @param \Drupal\plugin\PluginType\PluginTypeInterface $plugin_selector_type
*/
public function __construct(ConfigFactoryInterface $config_factory, TranslationInterface $string_translation, PaymentMethodManagerInterface $payment_method_manager, PluginTypeInterface $plugin_selector_type) {
parent::__construct($config_factory);
Expand All @@ -54,7 +54,7 @@ public function __construct(ConfigFactoryInterface $config_factory, TranslationI
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
/** @var \Drupal\plugin\PluginTypeManagerInterface $plugin_type_manager */
/** @var \Drupal\plugin\PluginType\PluginTypeManagerInterface $plugin_type_manager */
$plugin_type_manager = $container->get('plugin.plugin_type_manager');

return new static(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
use Drupal\payment\QueueInterface;
use Drupal\payment_reference\Element\PaymentReference;
use Drupal\plugin\Plugin\Plugin\PluginSelector\PluginSelectorManagerInterface;
use Drupal\plugin\PluginType;
use Drupal\plugin\PluginTypeManagerInterface;
use Drupal\plugin\PluginType\PluginType;
use Drupal\plugin\PluginType\PluginTypeManagerInterface;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RequestStack;
Expand Down Expand Up @@ -64,7 +64,7 @@ class PaymentReferenceTest extends UnitTestCase {
/**
* The payment method type.
*
* @var \Drupal\plugin\PluginTypeInterface
* @var \Drupal\plugin\PluginType\PluginTypeInterface
*/
protected $paymentMethodType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
use Drupal\payment_reference\Plugin\Payment\Type\PaymentReferenceConfigurationForm;
use Drupal\plugin\Plugin\Plugin\PluginSelector\PluginSelectorInterface;
use Drupal\plugin\Plugin\Plugin\PluginSelector\PluginSelectorManagerInterface;
use Drupal\plugin\PluginType;
use Drupal\plugin\PluginTypeManagerInterface;
use Drupal\plugin\PluginType\PluginType;
use Drupal\plugin\PluginType\PluginTypeManagerInterface;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\DependencyInjection\ContainerInterface;

Expand Down Expand Up @@ -66,7 +66,7 @@ class PaymentReferenceConfigurationFormTest extends UnitTestCase {
/**
* The plugin selector plugin type.
*
* @var \Drupal\plugin\PluginTypeInterface
* @var \Drupal\plugin\PluginType\PluginTypeInterface
*/
protected $pluginSelectorType;

Expand Down
6 changes: 3 additions & 3 deletions src/Element/PaymentReferenceBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
use Drupal\payment\Plugin\Payment\Method\PaymentExecutionPaymentMethodManager;
use Drupal\plugin\Plugin\Plugin\PluginSelector\PluginSelectorManagerInterface;
use Drupal\plugin\PluginDiscovery\LimitedPluginDiscoveryDecorator;
use Drupal\plugin\PluginTypeInterface;
use Drupal\plugin\PluginType\PluginTypeInterface;
use Symfony\Component\HttpFoundation\RequestStack;

/**
Expand Down Expand Up @@ -75,7 +75,7 @@ abstract class PaymentReferenceBase extends FormElement implements FormElementIn
/**
* The payment method type.
*
* @var \Drupal\plugin\PluginTypeInterface
* @var \Drupal\plugin\PluginType\PluginTypeInterface
*/
protected $paymentMethodType;

Expand Down Expand Up @@ -131,7 +131,7 @@ abstract class PaymentReferenceBase extends FormElement implements FormElementIn
* @param \Drupal\Core\Render\RendererInterface $renderer
* @param \Drupal\Core\Session\AccountInterface $current_user
* @param \Drupal\plugin\Plugin\Plugin\PluginSelector\PluginSelectorManagerInterface $plugin_selector_manager
* @param \Drupal\plugin\PluginTypeInterface $payment_method_type
* @param \Drupal\plugin\PluginType\PluginTypeInterface $payment_method_type
* @param \Drupal\Component\Utility\Random $random
*/
public function __construct(array $configuration, $plugin_id, array $plugin_definition, RequestStack $request_stack, EntityStorageInterface $payment_storage, TranslationInterface $string_translation, DateFormatter $date_formatter, LinkGeneratorInterface $link_generator, RendererInterface $renderer, AccountInterface $current_user, PluginSelectorManagerInterface $plugin_selector_manager, PluginTypeInterface $payment_method_type, Random $random) {
Expand Down
12 changes: 9 additions & 3 deletions src/Entity/Payment/PaymentListBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,12 @@ public function buildHeader() {
'sort' => 'DESC',
'specifier' => 'changed',
];
$header['status'] = $this->t('Status');
$header['amount'] =$this-> t('Amount');
$header['status'] = [
'data' => $this->t('Status'),
];
$header['amount'] = [
'data' => $this-> t('Amount'),
];
$header['payment_method'] = array(
'data' => $this->t('Payment method'),
'class' => array(RESPONSIVE_PRIORITY_LOW),
Expand All @@ -144,7 +148,9 @@ public function buildHeader() {
'data' => $this->t('Payer'),
'class' => array(RESPONSIVE_PRIORITY_MEDIUM),
);
$header['operations'] = $this->t('Operations');
$header['operations'] = [
'data' => $this->t('Operations'),
];

return $header;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Entity/Payment/PaymentStatusForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use Drupal\payment\Plugin\Payment\PaymentAwarePluginManagerDecorator;
use Drupal\plugin\Plugin\Plugin\PluginSelector\PluginSelectorManagerInterface;
use Drupal\plugin\PluginDiscovery\LimitedPluginDiscoveryDecorator;
use Drupal\plugin\PluginTypeManagerInterface;
use Drupal\plugin\PluginType\PluginTypeManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
Expand All @@ -34,7 +34,7 @@ class PaymentStatusForm extends EntityForm {
/**
* The plugin type manager.
*
* @var \Drupal\plugin\PluginTypeManagerInterface
* @var \Drupal\plugin\PluginType\PluginTypeManagerInterface
*/
protected $pluginTypeManager;

Expand All @@ -48,7 +48,7 @@ class PaymentStatusForm extends EntityForm {
* @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
* The string translator.
* @param \Drupal\plugin\Plugin\Plugin\PluginSelector\PluginSelectorManagerInterface $plugin_selector_manager
* @param \Drupal\plugin\PluginTypeManagerInterface $plugin_type_manager
* @param \Drupal\plugin\PluginType\PluginTypeManagerInterface $plugin_type_manager
* The plugin type manager.
*/
function __construct(AccountInterface $current_user, UrlGeneratorInterface $url_generator, TranslationInterface $string_translation, PluginSelectorManagerInterface $plugin_selector_manager, PluginTypeManagerInterface $plugin_type_manager) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
* {@inheritdoc}
*/
public function buildHeader() {
$row['label'] = $this->t('Name');
$row['plugin'] = $this->t('Type');
$row['label'] = [
'data' => $this->t('Name'),
];
$row['plugin'] = [
'data' => $this->t('Type'),
];
$row['owner'] = array(
'data' => $this->t('Owner'),
'class' => array(RESPONSIVE_PRIORITY_LOW),
Expand All @@ -73,7 +77,9 @@ public function buildHeader() {
'data' => $this->t('Status'),
'class' => array(RESPONSIVE_PRIORITY_MEDIUM),
);
$row['operations'] = $this->t('Operations');
$row['operations'] = [
'data' => $this->t('Operations'),
];

return $row;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Entity/PaymentStatus/PaymentStatusForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\plugin\Plugin\Plugin\PluginSelector\PluginSelectorManagerInterface;
use Drupal\plugin\PluginTypeManagerInterface;
use Drupal\plugin\PluginType\PluginTypeManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
Expand All @@ -38,7 +38,7 @@ class PaymentStatusForm extends EntityForm {
/**
* The plugin type manager.
*
* @var \Drupal\plugin\PluginTypeManagerInterface
* @var \Drupal\plugin\PluginType\PluginTypeManagerInterface
*/
protected $pluginTypeManager;

Expand All @@ -51,7 +51,7 @@ class PaymentStatusForm extends EntityForm {
* The payment status storage.
* @param \Drupal\plugin\Plugin\Plugin\PluginSelector\PluginSelectorManagerInterface $plugin_selector_manager
* The plugin selector manager.
* @param \Drupal\plugin\PluginTypeManagerInterface $plugin_type_manager
* @param \Drupal\plugin\PluginType\PluginTypeManagerInterface $plugin_type_manager
* The plugin type manager.
*/
public function __construct(TranslationInterface $string_translation, EntityStorageInterface $payment_status_storage, PluginSelectorManagerInterface $plugin_selector_manager, PluginTypeManagerInterface $plugin_type_manager) {
Expand Down
8 changes: 4 additions & 4 deletions src/Plugin/Action/SetStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\payment\Entity\PaymentInterface;
use Drupal\plugin\Plugin\Plugin\PluginSelector\PluginSelectorManagerInterface;
use Drupal\plugin\PluginTypeInterface;
use Drupal\plugin\PluginType\PluginTypeInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
Expand All @@ -32,7 +32,7 @@ class SetStatus extends ConfigurableActionBase implements ContainerFactoryPlugin
/**
* The payment status type.
*
* @var \Drupal\plugin\PluginTypeInterface
* @var \Drupal\plugin\PluginType\PluginTypeInterface
*/
protected $paymentStatusType;

Expand All @@ -56,7 +56,7 @@ class SetStatus extends ConfigurableActionBase implements ContainerFactoryPlugin
* The string translator.
* @param \Drupal\plugin\Plugin\Plugin\PluginSelector\PluginSelectorManagerInterface $plugin_selector_manager
* The plugin selector manager.
* @param \Drupal\plugin\PluginTypeInterface $payment_status_type
* @param \Drupal\plugin\PluginType\PluginTypeInterface $payment_status_type
* The payment status type.
*/
public function __construct(array $configuration, $plugin_id, array $plugin_definition, TranslationInterface $string_translation, PluginSelectorManagerInterface $plugin_selector_manager, PluginTypeInterface $payment_status_type) {
Expand All @@ -70,7 +70,7 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
/** @var \Drupal\plugin\PluginTypeManagerInterface $plugin_type_manager */
/** @var \Drupal\plugin\PluginType\PluginTypeManagerInterface $plugin_type_manager */
$plugin_type_manager = $container->get('plugin.plugin_type_manager');

return new static($configuration, $plugin_id, $plugin_definition, $container->get('string_translation'), $container->get('plugin.manager.plugin.plugin_selector'), $plugin_type_manager->getPluginType('payment_status'));
Expand Down

0 comments on commit d850d9d

Please sign in to comment.