Core and composer updates
This commit is contained in:
parent
a82634bb98
commit
62cac30480
1118 changed files with 21770 additions and 6306 deletions
|
@ -85,11 +85,30 @@ class AccessTest extends KernelTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Tests that the status field is not editable.
|
||||
* Tests file entity field access.
|
||||
*
|
||||
* @see \Drupal\file\FileAccessControlHandler::checkFieldAccess()
|
||||
*/
|
||||
public function testStatusFieldIsNotEditable() {
|
||||
public function testCheckFieldAccess() {
|
||||
\Drupal::currentUser()->setAccount($this->user1);
|
||||
$this->assertFalse($this->file->get('status')->access('edit'));
|
||||
/** @var \Drupal\file\FileInterface $file */
|
||||
$file = File::create([
|
||||
'uri' => 'public://test.png'
|
||||
]);
|
||||
// While creating a file entity access will be allowed for create-only
|
||||
// fields.
|
||||
$this->assertTrue($file->get('uri')->access('edit'));
|
||||
$this->assertTrue($file->get('filemime')->access('edit'));
|
||||
$this->assertTrue($file->get('filesize')->access('edit'));
|
||||
// Access to the status field is denied whilst creating a file entity.
|
||||
$this->assertFalse($file->get('status')->access('edit'));
|
||||
$file->save();
|
||||
// After saving the entity is no longer new and, therefore, access to
|
||||
// create-only fields and the status field will be denied.
|
||||
$this->assertFalse($file->get('uri')->access('edit'));
|
||||
$this->assertFalse($file->get('filemime')->access('edit'));
|
||||
$this->assertFalse($file->get('filesize')->access('edit'));
|
||||
$this->assertFalse($file->get('status')->access('edit'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -45,6 +45,7 @@ class FileItemValidationTest extends KernelTestBase {
|
|||
'status' => 1,
|
||||
]);
|
||||
$this->user->save();
|
||||
$this->container->get('current_user')->setAccount($this->user);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -85,6 +86,7 @@ class FileItemValidationTest extends KernelTestBase {
|
|||
// Test for max filesize.
|
||||
$file = File::create([
|
||||
'uri' => 'vfs://drupal_root/sites/default/files/test.txt',
|
||||
'uid' => $this->user->id(),
|
||||
]);
|
||||
$file->setPermanent();
|
||||
$file->save();
|
||||
|
|
|
@ -12,19 +12,25 @@ use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
|
|||
*/
|
||||
class MigrateUploadEntityDisplayTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['menu_ui'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->migrateFields();
|
||||
$this->executeMigration('d6_upload_entity_display');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the Drupal 6 upload settings to Drupal 8 entity display migration.
|
||||
* Tests Drupal 6 upload settings to Drupal 8 entity display migration.
|
||||
*/
|
||||
public function testUploadEntityDisplay() {
|
||||
$this->executeMigration('d6_upload_entity_display');
|
||||
|
||||
$display = EntityViewDisplay::load('node.page.default');
|
||||
$component = $display->getComponent('upload');
|
||||
$this->assertIdentical('file_default', $component['type']);
|
||||
|
@ -41,4 +47,23 @@ class MigrateUploadEntityDisplayTest extends MigrateDrupal6TestBase {
|
|||
$this->assertIdentical(['node', 'page', 'default', 'upload'], $this->getMigration('d6_upload_entity_display')->getIdMap()->lookupDestinationID(['page']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that entity displays are ignored appropriately.
|
||||
*
|
||||
* Entity displays should be ignored when they belong to node types which
|
||||
* were not migrated.
|
||||
*/
|
||||
public function testSkipNonExistentNodeType() {
|
||||
// The "story" node type is migrated by d6_node_type but we need to pretend
|
||||
// that it didn't occur, so record that in the map table.
|
||||
$this->mockFailure('d6_node_type', ['type' => 'story']);
|
||||
|
||||
// d6_upload_entity_display should skip over the "story" node type config
|
||||
// because, according to the map table, it didn't occur.
|
||||
$migration = $this->getMigration('d6_upload_entity_display');
|
||||
|
||||
$this->executeMigration($migration);
|
||||
$this->assertNull($migration->getIdMap()->lookupDestinationIds(['node_type' => 'story'])[0][0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,19 +12,25 @@ use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
|
|||
*/
|
||||
class MigrateUploadEntityFormDisplayTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['menu_ui'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->migrateFields();
|
||||
$this->executeMigration('d6_upload_entity_form_display');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the Drupal 6 upload settings to Drupal 8 entity form display migration.
|
||||
* Tests Drupal 6 upload settings to Drupal 8 entity form display migration.
|
||||
*/
|
||||
public function testUploadEntityFormDisplay() {
|
||||
$this->executeMigration('d6_upload_entity_form_display');
|
||||
|
||||
$display = EntityFormDisplay::load('node.page.default');
|
||||
$component = $display->getComponent('upload');
|
||||
$this->assertIdentical('file_generic', $component['type']);
|
||||
|
@ -41,4 +47,23 @@ class MigrateUploadEntityFormDisplayTest extends MigrateDrupal6TestBase {
|
|||
$this->assertIdentical(['node', 'page', 'default', 'upload'], $this->getMigration('d6_upload_entity_form_display')->getIdMap()->lookupDestinationID(['page']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that entity displays are ignored appropriately.
|
||||
*
|
||||
* Entity displays should be ignored when they belong to node types which
|
||||
* were not migrated.
|
||||
*/
|
||||
public function testSkipNonExistentNodeType() {
|
||||
// The "story" node type is migrated by d6_node_type but we need to pretend
|
||||
// that it didn't occur, so record that in the map table.
|
||||
$this->mockFailure('d6_node_type', ['type' => 'story']);
|
||||
|
||||
// d6_upload_entity_form_display should skip over the "story" node type
|
||||
// config because according to the map table, it didn't occur.
|
||||
$migration = $this->getMigration('d6_upload_entity_form_display');
|
||||
|
||||
$this->executeMigration($migration);
|
||||
$this->assertNull($migration->getIdMap()->lookupDestinationIds(['node_type' => 'story'])[0][0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,11 @@ use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
|
|||
*/
|
||||
class MigrateUploadFieldTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['menu_ui'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -12,6 +12,11 @@ use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
|
|||
*/
|
||||
class MigrateUploadInstanceTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['menu_ui'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -13,6 +13,11 @@ use Drupal\node\Entity\Node;
|
|||
*/
|
||||
class MigrateUploadTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['menu_ui'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
Reference in a new issue