updated contrib modules

This commit is contained in:
Bachir Soussi Chiadmi
2018-03-13 14:16:18 +01:00
parent e668535a4e
commit 272fa07ccf
202 changed files with 5165 additions and 1725 deletions
@@ -6,8 +6,8 @@ package: Testing
dependencies:
- entity
# Information added by Drupal.org packaging script on 2017-09-20
version: '8.x-1.0-beta1'
# Information added by Drupal.org packaging script on 2018-03-12
version: '8.x-1.0-beta2'
core: '8.x'
project: 'entity'
datestamp: 1505895847
datestamp: 1520873296
@@ -6,8 +6,8 @@ package: Testing
dependencies:
- entity
# Information added by Drupal.org packaging script on 2017-09-20
version: '8.x-1.0-beta1'
# Information added by Drupal.org packaging script on 2018-03-12
version: '8.x-1.0-beta2'
core: '8.x'
project: 'entity'
datestamp: 1505895847
datestamp: 1520873296
@@ -3,8 +3,8 @@ type: module
package: Testing
# core: 8.x
# Information added by Drupal.org packaging script on 2017-09-20
version: '8.x-1.0-beta1'
# Information added by Drupal.org packaging script on 2018-03-12
version: '8.x-1.0-beta2'
core: '8.x'
project: 'entity'
datestamp: 1505895847
datestamp: 1520873296
@@ -1,7 +0,0 @@
entity.entity_test_enhanced.collection:
path: '/entity_test_enhanced'
defaults:
_entity_list: 'entity_test_enhanced'
_title: 'Entity test with enhancements'
requirements:
_permission: 'administer entity_test_enhanced'
@@ -11,21 +11,31 @@ use Drupal\entity\Revision\RevisionableContentEntityBase;
*
* @ContentEntityType(
* id = "entity_test_enhanced",
* label = @Translation("Entity test with enhancements"),
* label = @Translation("Enhanced entity"),
* label_collection = @Translation("Enhanced entities"),
* label_singular = @Translation("enhanced entity"),
* label_plural = @Translation("enhanced entities"),
* label_count = @PluralTranslation(
* singular = "@count enhanced entity",
* plural = "@count enhanced entities",
* ),
* handlers = {
* "storage" = "\Drupal\Core\Entity\Sql\SqlContentEntityStorage",
* "access" = "\Drupal\Core\Entity\EntityAccessControlHandler",
* "permission_provider" = "\Drupal\entity\EntityPermissionProvider",
* "form" = {
* "add" = "\Drupal\entity\Form\RevisionableContentEntityForm",
* "edit" = "\Drupal\entity\Form\RevisionableContentEntityForm",
* "add" = "\Drupal\Core\Entity\ContentEntityForm",
* "edit" = "\Drupal\Core\Entity\ContentEntityForm",
* "delete" = "\Drupal\Core\Entity\EntityDeleteForm",
* },
* "route_provider" = {
* "html" = "\Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider",
* "html" = "\Drupal\entity\Routing\DefaultHtmlRouteProvider",
* "revision" = "\Drupal\entity\Routing\RevisionRouteProvider",
* "delete-multiple" = "\Drupal\entity\Routing\DeleteMultipleRouteProvider",
* },
* "local_action_provider" = {
* "collection" = "\Drupal\entity\Menu\EntityCollectionLocalActionProvider",
* },
* "list_builder" = "\Drupal\Core\Entity\EntityListBuilder",
* },
* base_table = "entity_test_enhanced",
@@ -4,7 +4,7 @@ namespace Drupal\entity_module_test\Entity;
use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
use Drupal\Core\Entity\EntityDescriptionInterface;
use Drupal\entity\Entity\RevisionableEntityBundleInterface;
use Drupal\Core\Entity\RevisionableEntityBundleInterface;
/**
* Provides bundles for the test entity.
@@ -0,0 +1,77 @@
<?php
namespace Drupal\Tests\entity\Functional;
use Drupal\entity_module_test\Entity\EnhancedEntity;
use Drupal\entity_module_test\Entity\EnhancedEntityBundle;
use Drupal\Tests\block\Traits\BlockCreationTrait;
use Drupal\Tests\BrowserTestBase;
/**
* Tests the collection route access check.
*
* @group entity
*
* @runTestsInSeparateProcesses
*
* @preserveGlobalState disabled
*/
class CollectionRouteAccessTest extends BrowserTestBase {
use BlockCreationTrait;
/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['entity_module_test', 'user', 'entity', 'block'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
EnhancedEntityBundle::create([
'id' => 'default',
'label' => 'Default',
])->save();
$this->placeBlock('local_tasks_block');
$this->placeBlock('system_breadcrumb_block');
}
/**
* Test the collection route access.
*/
public function testCollectionRouteAccess() {
$entity = EnhancedEntity::create([
'name' => 'rev 1',
'type' => 'default',
]);
$entity->save();
// User without any relevant permissions.
$account = $this->drupalCreateUser(['access administration pages']);
$this->drupalLogin($account);
$this->drupalGet($entity->toUrl('collection'));
$this->assertSession()->statusCodeEquals(403);
// User with "access overview" permissions.
$account = $this->drupalCreateUser(['access entity_test_enhanced overview']);
$this->drupalLogin($account);
$this->drupalGet($entity->toUrl('collection'));
$this->assertSession()->statusCodeEquals(200);
// User with full administration permissions.
$account = $this->drupalCreateUser(['administer entity_test_enhanced']);
$this->drupalLogin($account);
$this->drupalGet($entity->toUrl('collection'));
$this->assertSession()->statusCodeEquals(200);
}
}
@@ -18,7 +18,7 @@ class DeleteMultipleFormTest extends BrowserTestBase {
/**
* The current user.
*
* @var \Drupal\Core\Session\AccountInterface;
* @var \Drupal\Core\Session\AccountInterface
*/
protected $account;
@@ -60,13 +60,13 @@ class DeleteMultipleFormTest extends BrowserTestBase {
$selection[$entity->id()][$langcode] = $langcode;
}
// Add the selection to the tempstore just like DeleteAction would.
$tempstore = \Drupal::service('user.private_tempstore')->get('entity_delete_multiple_confirm');
$tempstore->set($this->account->id(), $selection);
$tempstore = \Drupal::service('tempstore.private')->get('entity_delete_multiple_confirm');
$tempstore->set($this->account->id() . ':entity_test_enhanced', $selection);
$this->drupalGet('/entity_test_enhanced/delete');
$assert = $this->assertSession();
$assert->statusCodeEquals(200);
$assert->elementTextContains('css', '.page-title', 'Are you sure you want to delete these items?');
$assert->elementTextContains('css', '.page-title', 'Are you sure you want to delete these enhanced entities?');
$delete_button = $this->getSession()->getPage()->findButton('Delete');
$delete_button->click();
$assert = $this->assertSession();
@@ -0,0 +1,44 @@
<?php
namespace Drupal\Tests\entity\Functional\Menu;
use Drupal\Tests\BrowserTestBase;
/**
* Tests that entity local actions are generated correctly.
*
* @group entity
*
* @runTestsInSeparateProcesses
*
* @preserveGlobalState disabled
*/
class EntityLocalActionTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = ['block', 'entity', 'entity_module_test'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->drupalPlaceBlock('local_actions_block');
$account = $this->drupalCreateUser(['administer entity_test_enhanced']);
$this->drupalLogin($account);
}
/**
* Tests the local action on the collection is provided correctly.
*/
public function testCollectionLocalAction() {
$this->drupalGet('/entity_test_enhanced');
$this->assertSession()->linkByHrefExists('/entity_test_enhanced/add');
$this->assertSession()->linkExists('Add enhanced entity');
}
}
@@ -4,7 +4,7 @@ namespace Drupal\Tests\entity\Functional;
use Drupal\entity_module_test\Entity\EnhancedEntity;
use Drupal\entity_module_test\Entity\EnhancedEntityBundle;
use Drupal\simpletest\BlockCreationTrait;
use Drupal\Tests\block\Traits\BlockCreationTrait;
use Drupal\Tests\BrowserTestBase;
/**
@@ -75,7 +75,7 @@ class RevisionRouteAccessTest extends BrowserTestBase {
$this->drupalGet('/entity_test_enhanced/1/revisions');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->responseContains('Revisions');
$collection_link = $this->getSession()->getPage()->findLink('Entity test with enhancements');
$collection_link = $this->getSession()->getPage()->findLink('Enhanced entities');
$collection_link->click();
$this->assertSession()->addressEquals('/entity_test_enhanced');
$this->assertSession()->responseContains('Edit');
@@ -74,8 +74,8 @@ class DeleteActionTest extends KernelTestBase {
$action->execute($entities);
// Confirm that the entity ids and langcodes are now in the tempstore.
$tempstore = \Drupal::service('user.private_tempstore')->get('entity_delete_multiple_confirm');
$selection = $tempstore->get($this->user->id());
$tempstore = \Drupal::service('tempstore.private')->get('entity_delete_multiple_confirm');
$selection = $tempstore->get($this->user->id() . ':entity_test_enhanced');
$this->assertEquals(array_keys($entities), array_keys($selection));
$this->assertEquals([['en' => 'en'], ['en' => 'en']], array_values($selection));
}