Commit d824c87a authored by Berdir's avatar Berdir

Issue #3042592 by chr.fritsch, Sergiu Stici, andreyjan, Alex Bukach, Berdir:...

Issue #3042592 by chr.fritsch, Sergiu Stici, andreyjan, Alex Bukach, Berdir: Remove Drupal 8.7 and earlier deprecations
parent 7b5b9e7e
......@@ -2,7 +2,7 @@
namespace Drupal\Tests\paragraphs_library\Functional;
use Drupal\field_ui\Tests\FieldUiTestTrait;
use Drupal\Tests\field_ui\Traits\FieldUiTestTrait;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\paragraphs\Entity\ParagraphsType;
use Drupal\Tests\BrowserTestBase;
......
......@@ -35,7 +35,7 @@ class ParagraphsLibraryTest extends ParagraphsExperimentalTestBase {
*/
public function testLibraryItems() {
// Set default theme.
\Drupal::service('theme_handler')->install(['bartik']);
\Drupal::service('theme_installer')->install(['bartik']);
$this->config('system.theme')->set('default', 'bartik')->save();
$this->loginAsAdmin(['create paragraphed_test content', 'edit any paragraphed_test content', 'administer paragraphs library']);
......
......@@ -3,7 +3,7 @@
namespace Drupal\Tests\paragraphs_library\FunctionalJavascript;
use Behat\Mink\Element\Element;
use Drupal\field_ui\Tests\FieldUiTestTrait;
use Drupal\Tests\field_ui\Traits\FieldUiTestTrait;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\Tests\paragraphs\FunctionalJavascript\ParagraphsTestBaseTrait;
use Drupal\Tests\paragraphs\Traits\ParagraphsLastEntityQueryTrait;
......
......@@ -2,7 +2,6 @@
namespace Drupal\paragraphs_type_permissions;
use Drupal\Core\Routing\UrlGeneratorTrait;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\paragraphs\Entity\ParagraphsType;
......@@ -12,7 +11,6 @@ use Drupal\paragraphs\Entity\ParagraphsType;
class ParagraphsTypePermissions {
use StringTranslationTrait;
use UrlGeneratorTrait;
/**
* Returns an array of content permissions.
......
<?php
namespace Drupal\paragraphs_type_permissions\Tests;
namespace Drupal\Tests\paragraphs_type_permissions\Functional;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\Tests\BrowserTestBase;
......@@ -19,11 +19,9 @@ class ParagraphsTypePermissionsTest extends BrowserTestBase {
use FieldUiTestTrait, ParagraphsCoreVersionUiTestTrait, ParagraphsTestBaseTrait;
/**
* Modules to enable.
*
* @var array
* {@inheritdoc}
*/
public static $modules = array(
protected static $modules = array(
'content_translation',
'image',
'field',
......@@ -145,11 +143,11 @@ class ParagraphsTypePermissionsTest extends BrowserTestBase {
$this->drupalPostForm(NULL, NULL, t('Add images'));
$this->drupalPostForm(NULL, NULL, t('Add text'));
$image_text = $this->drupalGetTestFiles('image')[0];
$image_text = $this->getTestFiles('image')[0];
$this->drupalPostForm(NULL, [
'files[field_paragraphs_demo_0_subform_field_image_demo_0]' => $image_text->uri,
], t('Upload'));
$images = $this->drupalGetTestFiles('image')[1];
$images = $this->getTestFiles('image')[1];
$this->drupalPostForm(NULL, [
'files[field_paragraphs_demo_1_subform_field_images_demo_0][]' => $images->uri,
], t('Upload'));
......
......@@ -2,10 +2,11 @@
namespace Drupal\paragraphs;
use Drupal\Component\Plugin\ConfigurableInterface;
use Drupal\Component\Plugin\DependentPluginInterface;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\PluginFormInterface;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\paragraphs\Entity\Paragraph;
use Drupal\paragraphs\Entity\ParagraphsType;
......@@ -16,7 +17,7 @@ use Drupal\paragraphs\Entity\ParagraphsType;
* adding properties and attributes, it can also add extra classes to the render
* elements so extra styling can be applied.
*/
interface ParagraphsBehaviorInterface extends PluginFormInterface, ConfigurablePluginInterface {
interface ParagraphsBehaviorInterface extends PluginFormInterface, ConfigurableInterface, DependentPluginInterface {
/**
* Builds a behavior perspective for each paragraph based on its type.
......
......@@ -2,15 +2,10 @@
namespace Drupal\paragraphs\Plugin\EntityReferenceSelection;
use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Url;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Component\Utility\NestedArray;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Default plugin implementation of the Entity Reference Selection plugin.
......
......@@ -692,9 +692,10 @@ class InlineParagraphsWidget extends WidgetBase {
}
}
elseif ($item_mode == 'preview') {
$view_builder = $entity_type_manager->getViewBuilder($paragraphs_entity->getEntityTypeId());
$element['subform'] = array();
$element['behavior_plugins'] = [];
$element['preview'] = entity_view($paragraphs_entity, 'preview', $paragraphs_entity->language()->getId());
$element['preview'] = $view_builder->view($paragraphs_entity, 'preview', $paragraphs_entity->language()->getId());
$element['preview']['#access'] = $paragraphs_entity->access('view');
}
elseif ($item_mode == 'closed') {
......
......@@ -2,7 +2,7 @@
namespace Drupal\paragraphs\Plugin\migrate\process;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Component\Plugin\ConfigurableInterface;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
......@@ -12,7 +12,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Base class for Paragraphs process plugins.
*/
abstract class ProcessPluginBase extends MigrateProcessPluginBase implements ConfigurablePluginInterface, ContainerFactoryPluginInterface {
abstract class ProcessPluginBase extends MigrateProcessPluginBase implements ConfigurableInterface, ContainerFactoryPluginInterface {
/**
* The entity bundle info service.
......@@ -63,11 +63,4 @@ abstract class ProcessPluginBase extends MigrateProcessPluginBase implements Con
return [];
}
/**
* {@inheritdoc}
*/
public function calculateDependencies() {
return [];
}
}
......@@ -2,8 +2,8 @@
namespace Drupal\paragraphs\Plugin\migrate\source;
use Drupal\Component\Plugin\ConfigurableInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase as MigrateDrupalSqlBase;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\State\StateInterface;
......@@ -15,7 +15,7 @@ use Drupal\migrate\Plugin\MigrationInterface;
* Add and implement Configurable Plugin interface to
* Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase.
*/
abstract class DrupalSqlBase extends MigrateDrupalSqlBase implements ConfigurablePluginInterface {
abstract class DrupalSqlBase extends MigrateDrupalSqlBase implements ConfigurableInterface {
/**
* {@inheritdoc}
......
......@@ -2,8 +2,8 @@
namespace Drupal\paragraphs\Plugin\migrate\source\d7;
use Drupal\Component\Plugin\ConfigurableInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity as MigrateFieldableEntity;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\State\StateInterface;
......@@ -15,7 +15,7 @@ use Drupal\migrate\Plugin\MigrationInterface;
* Add and implement Configurable Plugin interface to
* Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity.
*/
abstract class FieldableEntity extends MigrateFieldableEntity implements ConfigurablePluginInterface {
abstract class FieldableEntity extends MigrateFieldableEntity implements ConfigurableInterface {
/**
* {@inheritdoc}
......
......@@ -3,7 +3,7 @@
namespace Drupal\paragraphs\Tests\Classic;
use Drupal\Core\Entity\Entity\EntityFormDisplay;
use Drupal\field_ui\Tests\FieldUiTestTrait;
use Drupal\Tests\field_ui\Traits\FieldUiTestTrait;
use Drupal\simpletest\WebTestBase;
use Drupal\Tests\paragraphs\FunctionalJavascript\ParagraphsTestBaseTrait;
......
......@@ -3,7 +3,7 @@
namespace Drupal\paragraphs\Tests\Experimental;
use Drupal\Core\Entity\Entity\EntityFormDisplay;
use Drupal\field_ui\Tests\FieldUiTestTrait;
use Drupal\Tests\field_ui\Traits\FieldUiTestTrait;
use Drupal\paragraphs\Tests\Classic\ParagraphsTestBase;
use Drupal\Tests\paragraphs\FunctionalJavascript\ParagraphsTestBaseTrait;
......
......@@ -118,13 +118,14 @@ class ParagraphsAccessTest extends ParagraphsTestBase {
$images = $this->getTestFiles('image');
$file_system = \Drupal::service('file_system');
// Create a file, upload it.
file_unmanaged_copy($images[0]->uri, 'temporary://privateImage.jpg');
$file_system->copy($images[0]->uri, 'temporary://privateImage.jpg');
$file_path = $this->container->get('file_system')
->realpath('temporary://privateImage.jpg');
// Create a file, upload it.
file_unmanaged_copy($images[1]->uri, 'temporary://privateImage2.jpg');
$file_system->copy($images[1]->uri, 'temporary://privateImage2.jpg');
$file_path_2 = $this->container->get('file_system')
->realpath('temporary://privateImage2.jpg');
......
......@@ -120,12 +120,13 @@ class ParagraphsExperimentalAccessTest extends ParagraphsExperimentalTestBase {
$images = $this->getTestFiles('image');
// Create a file, upload it.
file_unmanaged_copy($images[0]->uri, 'temporary://privateImage.jpg');
$file_system = \Drupal::service('file_system');
$file_system->copy($images[0]->uri, 'temporary://privateImage.jpg');
$file_path = $this->container->get('file_system')
->realpath('temporary://privateImage.jpg');
// Create a file, upload it.
file_unmanaged_copy($images[1]->uri, 'temporary://privateImage2.jpg');
$file_system->copy($images[1]->uri, 'temporary://privateImage2.jpg');
$file_path_2 = $this->container->get('file_system')
->realpath('temporary://privateImage2.jpg');
......
......@@ -126,7 +126,9 @@ trait ParagraphsTestBaseTrait {
// Create a copy of the image, so that multiple file entities don't
// reference the same file.
$copy_uri = file_unmanaged_copy($uri);
/** @var \Drupal\Core\File\FileSystemInterface $file_system */
$file_system = \Drupal::service('file_system');
$copy_uri = $file_system->copy($uri, 'public://' . $file_system->basename($uri));
// Create a new file entity.
$file_entity = File::create([
......
......@@ -62,11 +62,6 @@ class ParagraphsIsChangedTest extends KernelTestBase {
$paragraph->save();
$this->assertFalse($paragraph->isChanged(), 'Paragraph::isChanged() found no changes after the entity has been saved.');
// Update the revision author field, which should be skipped from checking
// for changes in Paragraph::isChanged().
$paragraph->setRevisionAuthorId(3);
$this->assertFalse($paragraph->isChanged(), 'Paragraph::isChanged() found no changes after updating revision_uid field.');
$paragraph->set('text', 'New text');
$this->assertTrue($paragraph->isChanged(), 'Paragraph::isChanged() found changes after updating text field.');
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment