update drupal

This commit is contained in:
Tessier
2020-10-15 11:59:37 +02:00
parent ebb5db14b5
commit d8b9162932
558 changed files with 5954 additions and 4475 deletions
@@ -2,8 +2,6 @@
namespace Drupal\Tests\file\Functional;
use Drupal\Core\Entity\Plugin\Validation\Constraint\ReferenceAccessConstraint;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\file\Entity\File;
use Drupal\node\Entity\NodeType;
use Drupal\user\RoleInterface;
@@ -92,11 +90,10 @@ class FilePrivateTest extends FileFieldTestBase {
$this->drupalGet('node/' . $new_node->id() . '/edit');
$this->getSession()->getPage()->find('css', 'input[name="' . $field_name . '[0][fids]"]')->setValue($node_file->id());
$this->getSession()->getPage()->pressButton(t('Save'));
// Make sure the form submit failed - we stayed on the edit form.
$this->assertUrl('node/' . $new_node->id() . '/edit');
// Check that we got the expected constraint form error.
$constraint = new ReferenceAccessConstraint();
$this->assertRaw(new FormattableMarkup($constraint->message, ['%type' => 'file', '%id' => $node_file->id()]));
$this->assertUrl('node/' . $new_node->id());
// Make sure the submitted hidden file field is empty.
$new_node = \Drupal::entityTypeManager()->getStorage('node')->loadUnchanged($new_node->id());
$this->assertTrue($new_node->get($field_name)->isEmpty());
// Attempt to reuse the existing file when creating a new node, and confirm
// that access is still denied.
$edit = [];
@@ -107,9 +104,10 @@ class FilePrivateTest extends FileFieldTestBase {
$this->getSession()->getPage()->find('css', 'input[name="' . $field_name . '[0][fids]"]')->setValue($node_file->id());
$this->getSession()->getPage()->pressButton(t('Save'));
$new_node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
$this->assertTrue(empty($new_node), 'Node was not created.');
$this->assertUrl('node/add/' . $type_name);
$this->assertRaw(new FormattableMarkup($constraint->message, ['%type' => 'file', '%id' => $node_file->id()]));
$this->assertUrl('node/' . $new_node->id());
// Make sure the submitted hidden file field is empty.
$new_node = \Drupal::entityTypeManager()->getStorage('node')->loadUnchanged($new_node->id());
$this->assertTrue($new_node->get($field_name)->isEmpty());
// Now make file_test_file_download() return everything.
\Drupal::state()->set('file_test.allow_all', TRUE);
@@ -28,7 +28,7 @@ class FileModuleTest extends KernelTestBase {
$file_name = $this->randomMachineName();
$file_info = $this->createMock(UploadedFile::class);
$file_info->expects($this->once())->method('getError')->willReturn(UPLOAD_ERR_FORM_SIZE);
$file_info->expects($this->once())->method('getFileName')->willReturn($file_name);
$file_info->expects($this->once())->method('getClientOriginalName')->willReturn($file_name);
$this->assertFalse(\_file_save_upload_single($file_info, 'name'));
$expected_message = new TranslatableMarkup('The file %file could not be saved because it exceeds %maxsize, the maximum allowed size for uploads.', ['%file' => $file_name, '%maxsize' => format_size(Environment::getUploadMaxSize())]);
$this->assertEquals($expected_message, \Drupal::messenger()->all()['error'][0]);
@@ -117,6 +117,7 @@ class FileTest extends MigrateSqlSourceTestBase {
'filesize' => '3620',
'status' => '1',
'timestamp' => '1421727515',
'filepath' => 'sites/default/files/cube.jpeg',
],
];
// Do an automatic count.
@@ -143,6 +144,7 @@ class FileTest extends MigrateSqlSourceTestBase {
'filesize' => '3620',
'status' => '1',
'timestamp' => '1421727515',
'filepath' => 'sites/default/files/cube.jpeg',
],
];
// Do an automatic count.
@@ -31,7 +31,7 @@ class FieldFileTest extends UnitTestCase {
$options = [
'alt' => 'Foobaz',
'title' => 'Wambooli',
'title' => 'Bar',
];
$value = [
'fid' => 1,
@@ -45,7 +45,7 @@ class FieldFileTest extends UnitTestCase {
'display' => TRUE,
'description' => '',
'alt' => 'Foobaz',
'title' => 'Wambooli',
'title' => 'Bar',
];
$this->assertSame($expected, $transformed);
}