contrib modules updates

This commit is contained in:
2019-02-27 10:39:59 +01:00
parent 04a4b8895d
commit e3cf889820
579 changed files with 18343 additions and 4076 deletions
@@ -0,0 +1,14 @@
name: Block Display Variant Test
type: module
description: 'Testing infrastructure for CTools block display variants.'
package: Testing
# version: 3.x
# core: 8.x
dependencies:
- ctools:ctools
# Information added by Drupal.org packaging script on 2019-02-21
version: '8.x-3.2'
core: '8.x'
project: 'ctools'
datestamp: 1550728390
@@ -0,0 +1,23 @@
<?php
namespace Drupal\ctools_block_display_test\Plugin\DisplayVariant;
use Drupal\ctools\Plugin\DisplayVariant\BlockDisplayVariant as BaseBlockDisplayVariant;
class BlockDisplayVariant extends BaseBlockDisplayVariant {
/**
* {@inheritdoc}
*/
public function getRegionNames() {
return [];
}
/**
* {@inheritdoc}
*/
public function build() {
return [];
}
}
@@ -5,8 +5,8 @@ package: Testing
# version: 3.x
# core: 8.x
# Information added by Drupal.org packaging script on 2017-04-28
version: '8.x-3.0'
# Information added by Drupal.org packaging script on 2019-02-21
version: '8.x-3.2'
core: '8.x'
project: 'ctools'
datestamp: 1493401747
datestamp: 1550728390
@@ -22,7 +22,7 @@ class ExampleConfigEntityListBuilder extends ConfigEntityListBuilder {
* {@inheritdoc}
*/
public function buildRow(EntityInterface $entity) {
$row['label'] = $this->getLabel($entity);
$row['label'] = $entity->label();
$row['id'] = $entity->id();
// You probably want a few more properties here...
return $row + parent::buildRow($entity);
@@ -36,8 +36,7 @@ class ExampleConfigEntityDeleteForm extends EntityConfirmFormBase {
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->entity->delete();
drupal_set_message(
$this->messenger()->addMessage(
$this->t('content @type: deleted @label.',
[
'@type' => $this->entity->bundle(),
@@ -2,18 +2,20 @@
namespace Drupal\ctools_wizard_test\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\user\SharedTempStoreFactory;
use Drupal\Core\TempStore\SharedTempStoreFactory;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Example form config entity.
*/
class ExampleConfigEntityExternalForm extends FormBase {
/**
* Tempstore factory.
*
* @var \Drupal\user\SharedTempStoreFactory
* @var \Drupal\Core\TempStore\SharedTempStoreFactory
*/
protected $tempstore;
@@ -21,8 +23,9 @@ class ExampleConfigEntityExternalForm extends FormBase {
* Constructs a new ExampleConfigEntityExternalForm.
*
* @param \Drupal\ctools_wizard_test\Form\SharedTempStoreFactory $tempstore
* Creates a shared temporary storage for a collection.
*/
function __construct(SharedTempStoreFactory $tempstore) {
public function __construct(SharedTempStoreFactory $tempstore) {
$this->tempstore = $tempstore;
}
@@ -30,7 +33,7 @@ class ExampleConfigEntityExternalForm extends FormBase {
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container->get('user.shared_tempstore'));
return new static($container->get('tempstore.shared'));
}
/**
@@ -63,4 +66,3 @@ class ExampleConfigEntityExternalForm extends FormBase {
}
}
@@ -64,8 +64,7 @@ class OneForm extends FormBase {
$cached_values[$key] = $form_state->getValue($key);
}
$form_state->setTemporaryValue('wizard', $cached_values);
drupal_set_message($this->t('Dynamic value submitted: @value', ['@value' => $cached_values['dynamic']]));;
$this->messenger()->addMessage($this->t('Dynamic value submitted: @value', ['@value' => $cached_values['dynamic']]));
}
}
@@ -74,8 +74,8 @@ class WizardTest extends FormWizardBase {
*/
public function finish(array &$form, FormStateInterface $form_state) {
$cached_values = $form_state->getTemporaryValue('wizard');
drupal_set_message($this->t('Value One: @one', ['@one' => $cached_values['one']]));
drupal_set_message($this->t('Value Two: @two', ['@two' => $cached_values['two']]));
$this->messenger()->addMessage($this->t('Value One: @one', ['@one' => $cached_values['one']]));
$this->messenger()->addMessage($this->t('Value Two: @two', ['@two' => $cached_values['two']]));
parent::finish($form, $form_state);
}
@@ -0,0 +1,53 @@
<?php
namespace Drupal\Tests\ctools\Kernel;
use Drupal\ctools\Event\BlockVariantEvent;
use Drupal\ctools\Event\BlockVariantEvents;
use Drupal\ctools_block_display_test\Plugin\DisplayVariant\BlockDisplayVariant;
use Drupal\KernelTests\KernelTestBase;
use Prophecy\Argument;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
* @coversDefaultClass \Drupal\ctools\Plugin\DisplayVariant\BlockDisplayVariant
* @group CTools
*/
class BlockDisplayVariantTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['ctools', 'ctools_block_display_test', 'system', 'user'];
/**
* Tests that events are fired when manipulating a block variant.
*/
public function testBlockDisplayVariantEvents() {
/** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher */
$event_dispatcher = $this->prophesize(EventDispatcherInterface::class);
// Swap in a mock event dispatcher so we can spy on method calls.
$this->container->set('event_dispatcher', $event_dispatcher->reveal());
$variant = BlockDisplayVariant::create(
$this->container,
[],
'foobar',
[]
);
// Set up the expected calls to the event dispatcher.
$event = Argument::type(BlockVariantEvent::class);
$event_dispatcher->dispatch(BlockVariantEvents::ADD_BLOCK, $event)
->shouldBeCalled();
$event_dispatcher->dispatch(BlockVariantEvents::UPDATE_BLOCK, $event)
->shouldBeCalled();
$event_dispatcher->dispatch(BlockVariantEvents::DELETE_BLOCK, $event)
->shouldBeCalled();
$block_id = $variant->addBlock(['id' => 'system_powered_by_block']);
$variant->updateBlock($block_id, []);
$variant->removeBlock($block_id);
}
}
@@ -6,7 +6,7 @@ use Drupal\Core\Plugin\Context\Context;
use Drupal\Core\Plugin\Context\ContextDefinition;
/**
* @coversDefaultClass \Drupal\ctools\Plugin\RelationshipManagerInterface
* @coversDefaultClass \Drupal\ctools\Plugin\RelationshipManager
* @group CTools
*/
class RelationshipManagerTest extends RelationshipsTestBase {