updated core

This commit is contained in:
Bachir Soussi Chiadmi
2018-01-24 13:36:32 +01:00
parent cd7dea45a9
commit f9374cf96d
1997 changed files with 5175 additions and 127715 deletions
@@ -49,7 +49,7 @@ class FileField extends CckFieldPluginBase {
*/
public function processCckFieldValues(MigrationInterface $migration, $field_name, $data) {
$process = [
'plugin' => 'iterator',
'plugin' => 'sub_process',
'source' => $field_name,
'process' => [
'target_id' => 'fid',
@@ -25,7 +25,7 @@ class ImageField extends CckFieldPluginBase {
*/
public function processCckFieldValues(MigrationInterface $migration, $field_name, $data) {
$process = [
'plugin' => 'iterator',
'plugin' => 'sub_process',
'source' => $field_name,
'process' => [
'target_id' => 'fid',
@@ -18,7 +18,7 @@ class FileField extends D6FileField {
*/
public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
$process = [
'plugin' => 'iterator',
'plugin' => 'sub_process',
'source' => $field_name,
'process' => [
'target_id' => 'fid',
@@ -18,7 +18,7 @@ class ImageField extends FieldPluginBase {
*/
public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
$process = [
'plugin' => 'iterator',
'plugin' => 'sub_process',
'source' => $field_name,
'process' => [
'target_id' => 'fid',
@@ -78,7 +78,7 @@ class UploadInstance extends DrupalSqlBase {
/**
* {@inheritdoc}
*/
public function count() {
public function count($refresh = FALSE) {
return count($this->initializeIterator());
}
@@ -17,6 +17,8 @@ class File extends WizardPluginBase {
/**
* Set the created column.
*
* @var string
*/
protected $createdColumn = 'created';
@@ -118,16 +118,6 @@ class DownloadTest extends FileManagedTestBase {
$this->checkUrl('private', '', $basename, $base_path . '/' . $script_path . 'system/files/' . $basename_encoded);
}
$this->assertEqual(file_create_url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='), 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==', t('Generated URL matches expected URL.'));
// Test public files with a different host name from settings.
$test_base_url = 'http://www.example.com/cdn';
$this->settingsSet('file_public_base_url', $test_base_url);
$filepath = file_create_filename('test.txt', '');
$directory_uri = 'public://' . dirname($filepath);
file_prepare_directory($directory_uri, FILE_CREATE_DIRECTORY);
$file = $this->createFile($filepath, NULL, 'public');
$url = file_create_url($file->getFileUri());
$expected_url = $test_base_url . '/' . basename($filepath);
$this->assertEqual($url, $expected_url);
}
/**
@@ -187,4 +187,25 @@ class FileFieldValidateTest extends FileFieldTestBase {
$this->assertText('Article ' . $node->getTitle() . ' has been updated.');
}
/**
* Test the validation message is displayed only once for ajax uploads.
*/
public function testAJAXValidationMessage() {
$field_name = strtolower($this->randomMachineName());
$this->createFileField($field_name, 'node', 'article');
$this->drupalGet('node/add/article');
/** @var \Drupal\file\FileInterface $image_file */
$image_file = $this->getTestFile('image');
$edit = [
'files[' . $field_name . '_0]' => $this->container->get('file_system')->realpath($image_file->getFileUri()),
'title[0][value]' => $this->randomMachineName(),
];
$this->drupalPostAjaxForm(NULL, $edit, $field_name . '_0_upload_button');
$elements = $this->xpath('//div[contains(@class, :class)]', [
':class' => 'messages--error',
]);
$this->assertEqual(count($elements), 1, 'Ajax validation messages are displayed once.');
}
}
@@ -1,69 +0,0 @@
<?php
namespace Drupal\file\Tests;
use Drupal\file\Entity\File;
/**
* Tests access to managed files.
*
* @group file
*/
class FileManagedAccessTest extends FileManagedTestBase {
/**
* Tests if public file is always accessible.
*/
function testFileAccess() {
// Create a new file entity.
$file = File::create(array(
'uid' => 1,
'filename' => 'drupal.txt',
'uri' => 'public://drupal.txt',
'filemime' => 'text/plain',
'status' => FILE_STATUS_PERMANENT,
));
file_put_contents($file->getFileUri(), 'hello world');
// Save it, inserting a new record.
$file->save();
// Create authenticated user to check file access.
$account = $this->createUser(array('access site reports'));
$this->assertTrue($file->access('view', $account), 'Public file is viewable to authenticated user');
$this->assertTrue($file->access('download', $account), 'Public file is downloadable to authenticated user');
// Create anonymous user to check file access.
$account = $this->createUser()->getAnonymousUser();
$this->assertTrue($file->access('view', $account), 'Public file is viewable to anonymous user');
$this->assertTrue($file->access('download', $account), 'Public file is downloadable to anonymous user');
// Create a new file entity.
$file = File::create(array(
'uid' => 1,
'filename' => 'drupal.txt',
'uri' => 'private://drupal.txt',
'filemime' => 'text/plain',
'status' => FILE_STATUS_PERMANENT,
));
file_put_contents($file->getFileUri(), 'hello world');
// Save it, inserting a new record.
$file->save();
// Create authenticated user to check file access.
$account = $this->createUser(array('access site reports'));
$this->assertFalse($file->access('view', $account), 'Private file is not viewable to authenticated user');
$this->assertFalse($file->access('download', $account), 'Private file is not downloadable to authenticated user');
// Create anonymous user to check file access.
$account = $this->createUser()->getAnonymousUser();
$this->assertFalse($file->access('view', $account), 'Private file is not viewable to anonymous user');
$this->assertFalse($file->access('download', $account), 'Private file is not downloadable to anonymous user');
}
}