Skip to content
Snippets Groups Projects
Commit ddce1392 authored by Elliot Ward's avatar Elliot Ward
Browse files

Issue #3377065 by Eli-T: Convert to GitlabCI

parent 9d8f970f
No related branches found
No related tags found
1 merge request!11👷‍♂️ a default gitlab CI template from Drupal Association.
Pipeline #15919 passed
################
# DrupalCI GitLabCI template
#
# Gitlab-ci.yml to replicate DrupalCI testing for Contrib
#
# With thanks to:
# * The GitLab Acceleration Initiative participants
# * DrupalSpoons
################
################
# Guidelines
#
# This template is designed to give any Contrib maintainer everything they need to test, without requiring modification. It is also designed to keep up to date with Core Development automatically through the use of include files that can be centrally maintained.
#
# However, you can modify this template if you have additional needs for your project.
################
################
# Includes
#
# Additional configuration can be provided through includes.
# One advantage of include files is that if they are updated upstream, the changes affect all pipelines using that include.
#
# Includes can be overridden by re-declaring anything provided in an include, here in gitlab-ci.yml
# https://docs.gitlab.com/ee/ci/yaml/includes.html#override-included-configuration-values
################
include:
################
# DrupalCI includes:
# As long as you include this, any future includes added by the Drupal Association will be accessible to your pipelines automatically.
# View these include files at https://git.drupalcode.org/project/gitlab_templates/
################
- project: $_GITLAB_TEMPLATES_REPO
ref: $_GITLAB_TEMPLATES_REF
file:
- '/includes/include.drupalci.main.yml'
- '/includes/include.drupalci.variables.yml'
- '/includes/include.drupalci.workflows.yml'
################
# Pipeline configuration variables
#
# These are the variables provided to the Run Pipeline form that a user may want to override.
#
# Docs at https://git.drupalcode.org/project/gitlab_templates/-/blob/1.0.x/includes/include.drupalci.variables.yml
################
# variables:
# SKIP_ESLINT: '1'
variables:
_TARGET_CORE: "9.5.10"
SKIP_ESLINT: '1'
###################################################################################
#
# *
# /(
# ((((,
# /(((((((
# ((((((((((*
# ,(((((((((((((((
# ,(((((((((((((((((((
# ((((((((((((((((((((((((*
# *(((((((((((((((((((((((((((((
# ((((((((((((((((((((((((((((((((((*
# *(((((((((((((((((( .((((((((((((((((((
# ((((((((((((((((((. /(((((((((((((((((*
# /((((((((((((((((( .(((((((((((((((((,
# ,(((((((((((((((((( ((((((((((((((((((
# .(((((((((((((((((((( .(((((((((((((((((
# ((((((((((((((((((((((( ((((((((((((((((/
# (((((((((((((((((((((((((((/ ,(((((((((((((((*
# .((((((((((((((/ /(((((((((((((. ,(((((((((((((((
# *(((((((((((((( ,(((((((((((((/ *((((((((((((((.
# ((((((((((((((, /(((((((((((((. ((((((((((((((,
# (((((((((((((/ ,(((((((((((((* ,(((((((((((((,
# *((((((((((((( .((((((((((((((( ,(((((((((((((
# ((((((((((((/ /((((((((((((((((((. ,((((((((((((/
# ((((((((((((( *(((((((((((((((((((((((* *((((((((((((
# ((((((((((((( ,(((((((((((((..((((((((((((( *((((((((((((
# ((((((((((((, /((((((((((((* /((((((((((((/ ((((((((((((
# ((((((((((((( /((((((((((((/ (((((((((((((* ((((((((((((
# (((((((((((((/ /(((((((((((( ,((((((((((((, *((((((((((((
# (((((((((((((( *(((((((((((/ *((((((((((((. ((((((((((((/
# *((((((((((((((((((((((((((, /(((((((((((((((((((((((((
# ((((((((((((((((((((((((( ((((((((((((((((((((((((,
# .(((((((((((((((((((((((/ ,(((((((((((((((((((((((
# ((((((((((((((((((((((/ ,(((((((((((((((((((((/
# *((((((((((((((((((((( (((((((((((((((((((((,
# ,(((((((((((((((((((((, ((((((((((((((((((((/
# ,(((((((((((((((((((((* /((((((((((((((((((((
# ((((((((((((((((((((((, ,/((((((((((((((((((((,
# ,(((((((((((((((((((((((((((((((((((((((((((((((((((
# .(((((((((((((((((((((((((((((((((((((((((((((
# .((((((((((((((((((((((((((((((((((((,.
# .,(((((((((((((((((((((((((.
#
###################################################################################
{
"name": "drupal/flysystem_s3",
"description": "Provides an Amazon S3 plugin for Flysystem.",
"type": "drupal-module",
"license": "GPL-2.0-or-later",
"homepage": "https://drupal.org/project/flysystem_s3",
"support": {
"issues": "https://drupal.org/project/issues/flysystem_s3",
"source": "https://git.drupalcode.org/project/flysystem_s3"
},
"require": {
"drupal/flysystem": "^2.0",
"league/flysystem": "^1.0.20",
......
name: Flysystem Amazon S3
description: 'Provides an Amazon S3 plugin for Flysystem.'
description: "Provides an Amazon S3 plugin for Flysystem."
type: module
core_version_requirement: ^9
version: 8.0-dev
package: Flysystem
dependencies:
- flysystem:flysystem
- flysystem:flysystem
......@@ -3,17 +3,13 @@
* Provides JavaScript additions to the S3 CORS upload managed file field type.
*/
(function ($, Drupal) {
'use strict';
(function($, Drupal) {
/**
* S3 File upload utility functions.
*
* @namespace
*/
Drupal.flysystemS3 = Drupal.flysystemS3 || {
/**
* Submit file via CORS.
*
......@@ -22,10 +18,10 @@
* @param {jQuery.Event} event
* The event triggered, most likely a `change` event.
*/
submitCorsUpload: function (event) {
var $fileElement = $(event.target);
submitCorsUpload(event) {
const $fileElement = $(event.target);
if (typeof $fileElement[0].files === 'undefined') {
if (typeof $fileElement[0].files === "undefined") {
return;
}
......@@ -39,81 +35,115 @@
}
// Get the filelist and the number of files to be uploaded.
var filelist = $fileElement[0].files;
const filelist = $fileElement[0].files;
// Store uploaded files fid values.
var uploadedFileFid = [];
Object.keys(filelist).forEach(function (file) {
var file_obj = filelist[file];
var $progressBar = Drupal.flysystemS3.addProgressBar($fileElement, file_obj);
Drupal.flysystemS3.requestSignature($fileElement, file_obj)
.fail(function () {
Drupal.flysystemS3.setCorsUploadProgress($progressBar, 1, Drupal.t('Signing request failed. Trying secondary upload method...'));
// Trigger the submit button to let normal AJAX process the upload.
Drupal.file.triggerUploadButton(event);
})
.done(function (signedFormData) {
Drupal.flysystemS3.setCorsUploadProgress($progressBar, 1, Drupal.t('Uploading @file', {'@file': file_obj.name}));
Drupal.flysystemS3.uploadToAws(file_obj, signedFormData, $progressBar)
.fail(function () {
Drupal.flysystemS3.setCorsUploadProgress($progressBar, 1, Drupal.t('Upload failed. Trying secondary upload method...'));
// Trigger the submit button to let normal AJAX process the upload.
Drupal.file.triggerUploadButton(event);
})
.done(function () {
// Set progress bar to 100% in case the upload was so fast.
Drupal.flysystemS3.setCorsUploadProgress($progressBar, 100, Drupal.t('Processing upload'));
Drupal.flysystemS3.saveFile(signedFormData.url, file_obj)
const uploadedFileFid = [];
Object.keys(filelist).forEach(function(file) {
const file_obj = filelist[file];
const $progressBar = Drupal.flysystemS3.addProgressBar(
$fileElement,
file_obj
);
Drupal.flysystemS3
.requestSignature($fileElement, file_obj)
.fail(function() {
Drupal.flysystemS3.setCorsUploadProgress(
$progressBar,
1,
Drupal.t(
"Signing request failed. Trying secondary upload method..."
)
);
// Trigger the submit button to let normal AJAX process the upload.
Drupal.file.triggerUploadButton(event);
})
.done(function(signedFormData) {
Drupal.flysystemS3.setCorsUploadProgress(
$progressBar,
1,
Drupal.t("Uploading @file", { "@file": file_obj.name })
);
Drupal.flysystemS3
.uploadToAws(file_obj, signedFormData, $progressBar)
.fail(function() {
Drupal.flysystemS3.setCorsUploadProgress($progressBar, 1, Drupal.t('Signing request failed. Trying secondary upload method...'));
Drupal.flysystemS3.setCorsUploadProgress(
$progressBar,
1,
Drupal.t("Upload failed. Trying secondary upload method...")
);
// Trigger the submit button to let normal AJAX process the upload.
Drupal.file.triggerUploadButton(event);
})
.done(function(saveFileData) {
// Add the fid for this file to array.
uploadedFileFid.push(saveFileData.fid);
// Post the results to Drupal if all files have been processed.
var num_fids = uploadedFileFid.length;
if (num_fids == filelist.length) {
// Set the file upload to an empty value to prevent the file from being uploaded to Drupal.
$fileElement.val('');
// Set the fid element to our provided fid so that the AJAX response will render our file.
var $fidsElement = $fileElement.closest('.js-form-managed-file').find('input[type="hidden"][name$="[fids]"]');
// List all uploaded files fids to string.
var uploadedFileFidString = uploadedFileFid.join(" ");
$fidsElement.val(uploadedFileFidString);
// Trigger the submit button to let normal AJAX process the upload.
Drupal.file.triggerUploadButton(event);
}
})
});
});
.done(function() {
// Set progress bar to 100% in case the upload was so fast.
Drupal.flysystemS3.setCorsUploadProgress(
$progressBar,
100,
Drupal.t("Processing upload")
);
Drupal.flysystemS3
.saveFile(signedFormData.url, file_obj)
.fail(function() {
Drupal.flysystemS3.setCorsUploadProgress(
$progressBar,
1,
Drupal.t(
"Signing request failed. Trying secondary upload method..."
)
);
// Trigger the submit button to let normal AJAX process the upload.
Drupal.file.triggerUploadButton(event);
})
.done(function(saveFileData) {
// Add the fid for this file to array.
uploadedFileFid.push(saveFileData.fid);
// Post the results to Drupal if all files have been processed.
const num_fids = uploadedFileFid.length;
if (num_fids == filelist.length) {
// Set the file upload to an empty value to prevent the file from being uploaded to Drupal.
$fileElement.val("");
// Set the fid element to our provided fid so that the AJAX response will render our file.
const $fidsElement = $fileElement
.closest(".js-form-managed-file")
.find('input[type="hidden"][name$="[fids]"]');
// List all uploaded files fids to string.
const uploadedFileFidString = uploadedFileFid.join(" ");
$fidsElement.val(uploadedFileFidString);
// Trigger the submit button to let normal AJAX process the upload.
Drupal.file.triggerUploadButton(event);
}
});
});
});
});
},
/**
* Adds a progress bar.
*/
addProgressBar: function($fileElement, file_obj) {
addProgressBar($fileElement, file_obj) {
// Hide the upload field and the description.
$fileElement.hide();
$fileElement.siblings('.description').hide();
$fileElement.siblings(".description").hide();
var field_id = $fileElement.attr('id').replace(/\-upload/, '');
const field_id = $fileElement.attr("id").replace(/\-upload/, "");
var $progressBar = $(Drupal.theme.progressBar(field_id + '-progress'));
Drupal.flysystemS3.setCorsUploadProgress($progressBar, 0, Drupal.t('Signing @file for upload', {'@file': file_obj.name}));
const $progressBar = $(Drupal.theme.progressBar(`${field_id}-progress`));
Drupal.flysystemS3.setCorsUploadProgress(
$progressBar,
0,
Drupal.t("Signing @file for upload", { "@file": file_obj.name })
);
$fileElement.after($progressBar);
......@@ -130,10 +160,10 @@
* @param event
* And XMLHttpRequestProgressEvent object.
*/
processCorsUploadProgress: function($progressBar, event) {
processCorsUploadProgress($progressBar, event) {
if (event.lengthComputable) {
// This is copied mostly from Drupal.ProgressBar.setProgress.
var percentage = Math.floor((event.loaded / event.total) * 100);
const percentage = Math.floor((event.loaded / event.total) * 100);
if (percentage >= 0 && percentage <= 100) {
Drupal.flysystemS3.setCorsUploadProgress($progressBar, percentage);
}
......@@ -151,22 +181,22 @@
* @param file
* The file object to be uploaded.
*/
requestSignature: function($fileElement, file) {
requestSignature($fileElement, file) {
// Use the file object and ask Drupal to generate the appropriate signed
// request for us.
var signingPostData = {
'filename': file.name,
'Content-Type': file.type,
'acl': $fileElement.attr('data-s3-acl'),
'destination': $fileElement.attr('data-s3-destination')
const signingPostData = {
filename: file.name,
"Content-Type": file.type,
acl: $fileElement.attr("data-s3-acl"),
destination: $fileElement.attr("data-s3-destination")
};
// POST to Drupal which will return the required parameters for signing
// a CORS request.
return $.ajax({
url: drupalSettings.path.baseUrl + 'flysystem-s3/cors-upload-sign',
url: `${drupalSettings.path.baseUrl}flysystem-s3/cors-upload-sign`,
data: signingPostData,
type: 'POST'
type: "POST"
});
},
......@@ -178,19 +208,19 @@
* @param file
* The file object.
*/
saveFile: function(url, file) {
var postData = {
url: url,
saveFile(url, file) {
const postData = {
url,
filename: file.name,
filesize: file.size,
filemime: file.type,
filemime: file.type
};
// POST to Drupal which will save the uploaded file to Drupal.
return $.ajax({
url: drupalSettings.path.baseUrl + 'flysystem-s3/cors-upload-save',
url: `${drupalSettings.path.baseUrl}flysystem-s3/cors-upload-save`,
data: postData,
type: 'POST'
type: "POST"
});
},
......@@ -206,23 +236,23 @@
* @param {string} [label]
* An optional label
*/
setCorsUploadProgress: function($progressBar, percentage, label) {
$progressBar.find('div.progress__bar').css('width', percentage + '%');
$progressBar.find('div.progress__percentage').html(percentage + '%');
setCorsUploadProgress($progressBar, percentage, label) {
$progressBar.find("div.progress__bar").css("width", `${percentage}%`);
$progressBar.find("div.progress__percentage").html(`${percentage}%`);
if (label) {
$progressBar.find('div.progress__label').html(label);
$progressBar.find("div.progress__label").html(label);
}
},
uploadToAws: function(file, signedFormData, $progressBar) {
uploadToAws(file, signedFormData, $progressBar) {
// Take the signed data and construct a form out of it.
var uploadFormData = new FormData();
const uploadFormData = new FormData();
$.each(signedFormData.inputs, function(key, value) {
uploadFormData.append(key, value);
});
// Add the file to be uploaded.
uploadFormData.append('file', file);
uploadFormData.append("file", file);
return $.ajax({
url: signedFormData.attributes.action,
......@@ -235,12 +265,19 @@
cache: false,
contentType: false,
processData: false,
xhr: function () {
var myXhr = $.ajaxSettings.xhr();
xhr() {
const myXhr = $.ajaxSettings.xhr();
if (myXhr.upload) {
myXhr.upload.addEventListener('progress', (function (event) {
Drupal.flysystemS3.processCorsUploadProgress($progressBar, event);
}), false);
myXhr.upload.addEventListener(
"progress",
function(event) {
Drupal.flysystemS3.processCorsUploadProgress(
$progressBar,
event
);
},
false
);
}
return myXhr;
}
......@@ -250,28 +287,29 @@
/**
* Adds client side validation for the input[type=file].
*/
validateFileExtension: function($fileElement) {
validateFileExtension($fileElement) {
// @todo Figure out why Drupal.file.validateFileExtension is not getting triggered.
// @todo Figure out what additional validation should be run.
// @see https://www.drupal.org/node/2235977
if (!$fileElement.data('valid-extensions')) {
if (!$fileElement.data("valid-extensions")) {
return true;
}
$('.file-upload-js-error').remove();
var extensionPattern = $fileElement.data('valid-extensions')
$(".file-upload-js-error").remove();
const extensionPattern = $fileElement
.data("valid-extensions")
// Convert commas and spaces to pipes.
.replace(/,|\s+/g, '|')
.replace(/,|\s+/g, "|")
// Remove leading and trailing pipes.
.replace(/^\|+|\|+$/, '');
.replace(/^\|+|\|+$/, "");
if (extensionPattern.length === 0) {
return true;
}
var acceptableMatch = new RegExp('\\.(' + extensionPattern + ')$', 'i');
const acceptableMatch = new RegExp(`\\.(${extensionPattern})$`, "i");
var files = $.grep($fileElement[0].files, function (file) {
const files = $.grep($fileElement[0].files, function(file) {
return !acceptableMatch.test(file.name);
});
......@@ -279,20 +317,24 @@
return true;
}
$.each(files, function (key, file) {
var error = Drupal.t('The selected file %filename cannot be uploaded. Only files with the following extensions are allowed: %extensions.', {
'%filename': file.name,
'%extensions': extensionPattern.replace(/\|/g, ', ')
});
$.each(files, function(key, file) {
const error = Drupal.t(
"The selected file %filename cannot be uploaded. Only files with the following extensions are allowed: %extensions.",
{
"%filename": file.name,
"%extensions": extensionPattern.replace(/\|/g, ", ")
}
);
$fileElement
.closest('div.js-form-managed-file')
.prepend('<div class="messages messages--error file-upload-js-error" aria-live="polite">' + error + '</div>');
.closest("div.js-form-managed-file")
.prepend(
`<div class="messages messages--error file-upload-js-error" aria-live="polite">${error}</div>`
);
});
return false;
}
};
/**
......@@ -306,22 +348,29 @@
* Detaches auto file upload trigger.
*/
Drupal.behaviors.flySystemS3CorsUpload = {
attach: function (context) {
$(context).find('.js-form-managed-file input[type="file"][data-flysystem-s3-cors]')
attach(context) {
$(context)
.find(
'.js-form-managed-file input[type="file"][data-flysystem-s3-cors]'
)
// Add the CORS upload handler to the file input.
.once('auto-cors-upload')
.on('change.autoCorsFileUpload', Drupal.flysystemS3.submitCorsUpload)
.once("auto-cors-upload")
.on("change.autoCorsFileUpload", Drupal.flysystemS3.submitCorsUpload)
// Disable the upload button trigger so that the CORS upload handler can run first.
.off('change.autoFileUpload', Drupal.file.triggerUploadButton);
.off("change.autoFileUpload", Drupal.file.triggerUploadButton);
},
detach: function (context, setting, trigger) {
if (trigger === 'unload') {
$(context).find('.js-form-managed-file input[type="file"][data-flysystem-s3-cors]')
.removeOnce('auto-cors-upload')
.off('change.autoCorsFileUpload', Drupal.flysystemS3.submitCorsUpload);
detach(context, setting, trigger) {
if (trigger === "unload") {
$(context)
.find(
'.js-form-managed-file input[type="file"][data-flysystem-s3-cors]'
)
.removeOnce("auto-cors-upload")
.off(
"change.autoCorsFileUpload",
Drupal.flysystemS3.submitCorsUpload
);
}
}
};
})(jQuery, Drupal, drupalSettings);
use S3 CORS upload:
title: 'Upload files directly to S3 using CORS'
title: "Upload files directly to S3 using CORS"
flysystem_s3.cors_sign:
path: '/flysystem-s3/cors-upload-sign'
path: "/flysystem-s3/cors-upload-sign"
defaults:
_controller: 'Drupal\flysystem_s3\Controller\S3CorsUploadAjaxController::signRequest'
requirements:
_permission: 'use S3 CORS upload'
_method: 'POST'
_permission: "use S3 CORS upload"
_method: "POST"
flysystem_s3.cors_save:
path: '/flysystem-s3/cors-upload-save'
path: "/flysystem-s3/cors-upload-save"
defaults:
_controller: 'Drupal\flysystem_s3\Controller\S3CorsUploadAjaxController::saveFile'
requirements:
_permission: 'use S3 CORS upload'
_method: 'POST'
_permission: "use S3 CORS upload"
_method: "POST"
......@@ -3,4 +3,4 @@ services:
public: false
class: \Drupal\flysystem_s3\File\FlysystemS3FileSystem
decorates: file_system
arguments: ['@stream_wrapper_manager', '@settings', '@logger.channel.file']
arguments: ["@stream_wrapper_manager", "@settings", "@logger.channel.file"]
......@@ -11,7 +11,7 @@
</testsuite>
</testsuites>
<listeners>
<listener class="Drupal\Tests\Standards\DrupalStandardsListener">
<listener class="Drupal\Tests\Listeners\DrupalListener">
</listener>
</listeners>
<!-- Filter for coverage reports. -->
......
......@@ -2,15 +2,15 @@
namespace Drupal\flysystem_s3\Controller;
use Aws\S3\PostObjectV4;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\File\FileSystemInterface;
use Drupal\Core\StreamWrapper\StreamWrapperManager;
use Drupal\file\Entity\File;
use Drupal\flysystem\FlysystemFactory;
use Drupal\Core\File\FileSystemInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Aws\S3\PostObjectV4;
use Drupal\Core\StreamWrapper\StreamWrapperManager;
/**
* Defines a controller to respond to S3 CORS upload AJAX requests.
......@@ -120,7 +120,7 @@ class S3CorsUploadAjaxController extends ControllerBase {
'filesize' => $post['filesize'],
'filename' => $this->fileSystem->baseName($post['url']),
'filemime' => $post['filemime'],
'uid' => \Drupal::currentUser()->getAccount()->id(),
'uid' => $this->currentUser()->getAccount()->id(),
]);
$file->save();
......
......@@ -4,9 +4,6 @@ namespace Drupal\flysystem_s3\File;
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
use Drupal\Core\File\FileSystem;
use Drupal\Core\Site\Settings;
use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface;
use Psr\Log\LoggerInterface;
/**
* Decorates the Drupal FileSystem service to handle chmod() for S3.
......@@ -15,22 +12,6 @@ class FlysystemS3FileSystem extends FileSystem {
use DependencySerializationTrait;
/**
* FlysystemS3FileSystem constructor.
*
* @param \Drupal\Core\File\FileSystemInterface $file_system
* The file system being decorated.
* @param \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager
* The stream wrapper manager.
* @param \Drupal\Core\Site\Settings $settings
* The site settings.
* @param \Psr\Log\LoggerInterface $logger
* The file logger channel.
*/
public function __construct(StreamWrapperManagerInterface $stream_wrapper_manager, Settings $settings, LoggerInterface $logger) {
parent::__construct($stream_wrapper_manager, $settings, $logger);
}
/**
* {@inheritdoc}
*
......
......@@ -68,7 +68,7 @@ class S3Adapter extends AwsS3Adapter {
protected function upload($path, $body, Config $config) {
$key = $this->applyPathPrefix($path);
$options = $this->getOptionsFromConfig($config);
$acl = isset($options['ACL']) ? $options['ACL'] : 'private';
$acl = $options['ACL'] ?? 'private';
if (!isset($options['ContentType'])) {
if (is_string($body)) {
......
......@@ -3,8 +3,8 @@
namespace Drupal\flysystem_s3\Flysystem;
use Aws\Credentials\Credentials;
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
use Aws\S3\S3Client;
use Aws\S3\S3ClientInterface;
use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Logger\RfcLogLevel;
......@@ -215,7 +215,7 @@ class S3 implements FlysystemPluginInterface, ContainerFactoryPluginInterface {
\Drupal::logger('flysystem_s3')->error($message);
}
// @TODO: If the bucket exists, can we write to it? Find a way to test that.
// @todo If the bucket exists, can we write to it? Find a way to test that.
if (!$exists) {
return [[
'severity' => RfcLogLevel::ERROR,
......
......@@ -15,8 +15,14 @@ class S3CorsManagedFileHelper {
*/
public static function alterInfo(array &$types) {
if (isset($types['managed_file'])) {
array_unshift($types['managed_file']['#process'], [get_called_class(), 'preProcessCors']);
$types['managed_file']['#process'][] = [get_called_class(), 'postProcessCors'];
array_unshift($types['managed_file']['#process'], [
get_called_class(),
'preProcessCors',
]);
$types['managed_file']['#process'][] = [
get_called_class(),
'postProcessCors',
];
}
}
......
......@@ -2,8 +2,8 @@
namespace Drupal\Tests\flysystem_s3\Unit;
use Drupal\flysystem_s3\AwsCacheAdapter;
use Drupal\Core\Cache\MemoryBackend;
use Drupal\flysystem_s3\AwsCacheAdapter;
use PHPUnit\Framework\Testcase;
/**
......@@ -14,7 +14,7 @@ use PHPUnit\Framework\Testcase;
class AwsCacheAdapterTest extends Testcase {
/**
*
* Tests basic operations for the cache adaptor.
*/
public function testBasicGetSetDelete() {
$backend = new MemoryBackend('foo');
......@@ -34,7 +34,7 @@ class AwsCacheAdapterTest extends Testcase {
}
/**
*
* Tests Time To Live setting.
*/
public function testTtlIsSet() {
$backend = new MemoryBackend('foo');
......@@ -42,7 +42,7 @@ class AwsCacheAdapterTest extends Testcase {
$cache->set('key', 'value', 10);
// This should work unles the system running the test is extremely slow.
// This should work unless the system running the test is extremely slow.
$expires = time() + 10;
$this->assertSame('value', $cache->get('key'));
......
......@@ -5,11 +5,10 @@ namespace Drupal\Tests\flysystem_s3\Unit\Flysystem;
use Aws\Credentials\Credentials;
use Aws\S3\S3Client;
use Aws\S3\S3ClientInterface;
use Drupal\Core\Cache\MemoryBackend;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Logger\RfcLogLevel;
use Drupal\Tests\UnitTestCase;
use Drupal\flysystem_s3\Flysystem\S3;
use Drupal\Tests\UnitTestCase;
use League\Flysystem\AdapterInterface;
use League\Flysystem\Config;
use Prophecy\Argument;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment