Skip to content
Snippets Groups Projects
Commit 06a9fc0b authored by catch's avatar catch
Browse files

Issue #3005170 by mikelutz, quietone, maxocub, larowlan: Add @trigger_error...

Issue #3005170 by mikelutz, quietone, maxocub, larowlan: Add @trigger_error for deprecated (Drupal\migrate\Plugin\Migration::get()
parent 7ecfaf4c
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -327,6 +327,7 @@ public function label() {
* @see https://www.drupal.org/node/2873795
*/
public function get($property) {
@trigger_error('\Drupal\migrate\Plugin\Migration::get() is deprecated in Drupal 8.1.x, will be removed before Drupal 9.0.x. Use more specific getters instead. See https://www.drupal.org/node/2873795', E_USER_DEPRECATED);
return isset($this->$property) ? $this->$property : NULL;
}
......
......@@ -3,6 +3,7 @@
namespace Drupal\Tests\migrate_drupal\Kernel\dependencies;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\migrate\Exception\RequirementsException;
use Drupal\migrate\MigrateExecutable;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
......@@ -20,6 +21,9 @@ class MigrateDependenciesTest extends MigrateDrupal6TestBase {
/**
* Tests that the order is correct when loading several migrations.
*
* @group legacy
* @expectedDeprecation \Drupal\migrate\Plugin\Migration::get() is deprecated in Drupal 8.1.x, will be removed before Drupal 9.0.x. Use more specific getters instead. See https://www.drupal.org/node/2873795
*/
public function testMigrateDependenciesOrder() {
$migration_items = ['d6_comment', 'd6_filter_format', 'd6_node:page'];
......@@ -58,6 +62,35 @@ public function testMigrateDependenciesOrder() {
}
}
/**
* Tests that the order is correct when loading several migrations.
*
* Replacement test for testMigrateDependenciesOrder that doesn't use
* the deprecated MigrationInterface::get().
*/
public function testMigrationDependenciesOrder() {
$migration_items = ['d6_comment', 'd6_filter_format', 'd6_node:page'];
/** @var \Drupal\migrate\Plugin\RequirementsInterface[] $migrations */
$migrations = $this->container->get('plugin.manager.migration')->createInstances($migration_items);
$expected_order = ['d6_filter_format', 'd6_node:page', 'd6_comment'];
$this->assertSame(array_keys($migrations), $expected_order);
// Migration dependencies for comment include dependencies for node
// migration as well. checkRequirements does not include migrations with
// no rows in the exception, so node types with no content aren't included
// in the list.
try {
$migrations['d6_comment']->checkRequirements();
$this->fail("The requirements check failed to throw a RequirementsException");
}
catch (RequirementsException $e) {
$this->assertEquals('Missing migrations d6_comment_type, d6_user, d6_comment_entity_display, d6_node_type, d6_comment_entity_form_display, d6_node_settings, d6_filter_format, d6_node:company, d6_node:employee, d6_node:forum, d6_node:page, d6_node:story, d6_node:test_planet.', $e->getMessage());
}
catch (\Exception $e) {
$this->fail("The requirements check threw an exception, but it was not the expected RequirementsException");
}
}
/**
* Tests dependencies on the migration of aggregator feeds & items.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment