Issue #3126563 by mondrake, daffie, alexpott: Replace usage of assertAttributeEquals() that is deprecated
parent
cc564e260e
commit
a6e402fc01
|
@ -10,6 +10,11 @@ use Drupal\Core\Plugin\PluginFormBase;
|
|||
*/
|
||||
class EmptyBlockForm extends PluginFormBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $plugin;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -93,7 +93,9 @@ class CommentBulkFormTest extends UnitTestCase {
|
|||
$comment_bulk_form = new CommentBulkForm([], 'comment_bulk_form', $definition, $entity_type_manager, $language_manager, $messenger, $entity_repository);
|
||||
$comment_bulk_form->init($executable, $display, $options);
|
||||
|
||||
$this->assertAttributeEquals(array_slice($actions, 0, -1, TRUE), 'actions', $comment_bulk_form);
|
||||
$reflected_actions = (new \ReflectionObject($comment_bulk_form))->getProperty('actions');
|
||||
$reflected_actions->setAccessible(TRUE);
|
||||
$this->assertEquals(array_slice($actions, 0, -1, TRUE), $reflected_actions->getValue($comment_bulk_form));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -57,18 +57,6 @@ class ForumBreadcrumbBuilderBaseTest extends UnitTestCase {
|
|||
]
|
||||
);
|
||||
|
||||
// Reflect upon our properties, except for config which is a special case.
|
||||
$property_names = [
|
||||
'entityTypeManager' => $entity_type_manager,
|
||||
'forumManager' => $forum_manager,
|
||||
'stringTranslation' => $translation_manager,
|
||||
];
|
||||
foreach ($property_names as $property_name => $property_value) {
|
||||
$this->assertAttributeEquals(
|
||||
$property_value, $property_name, $builder
|
||||
);
|
||||
}
|
||||
|
||||
// Test that the constructor made a config object with our info in it.
|
||||
$reflector = new \ReflectionClass($builder);
|
||||
$ref_property = $reflector->getProperty('config');
|
||||
|
|
|
@ -194,7 +194,7 @@ class MigrateSqlIdMapTest extends MigrateTestCase {
|
|||
$message = $this->createMock('Drupal\migrate\MigrateMessageInterface');
|
||||
$id_map = $this->getIdMap();
|
||||
$id_map->setMessage($message);
|
||||
$this->assertAttributeEquals($message, 'message', $id_map);
|
||||
$this->assertEquals($message, $id_map->message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,6 +34,11 @@ class TestSqlIdMap extends Sql implements \Iterator {
|
|||
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $event_dispatcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -93,7 +93,9 @@ class NodeBulkFormTest extends UnitTestCase {
|
|||
$node_bulk_form = new NodeBulkForm([], 'node_bulk_form', $definition, $entity_type_manager, $language_manager, $messenger, $entity_repository);
|
||||
$node_bulk_form->init($executable, $display, $options);
|
||||
|
||||
$this->assertAttributeEquals(array_slice($actions, 0, -1, TRUE), 'actions', $node_bulk_form);
|
||||
$reflected_actions = (new \ReflectionObject($node_bulk_form))->getProperty('actions');
|
||||
$reflected_actions->setAccessible(TRUE);
|
||||
$this->assertEquals(array_slice($actions, 0, -1, TRUE), $reflected_actions->getValue($node_bulk_form));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -93,7 +93,9 @@ class UserBulkFormTest extends UnitTestCase {
|
|||
$user_bulk_form = new UserBulkForm([], 'user_bulk_form', $definition, $entity_type_manager, $language_manager, $messenger, $entity_repository);
|
||||
$user_bulk_form->init($executable, $display, $options);
|
||||
|
||||
$this->assertAttributeEquals(array_slice($actions, 0, -1, TRUE), 'actions', $user_bulk_form);
|
||||
$reflected_actions = (new \ReflectionObject($user_bulk_form))->getProperty('actions');
|
||||
$reflected_actions->setAccessible(TRUE);
|
||||
$this->assertEquals(array_slice($actions, 0, -1, TRUE), $reflected_actions->getValue($user_bulk_form));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class MultipleBlockFormTest extends KernelTestBase {
|
|||
|
||||
// Ensure that EmptyBlockForm is used and the plugin is set.
|
||||
$this->assertInstanceOf(EmptyBlockForm::class, $form_object2);
|
||||
$this->assertAttributeEquals($block, 'plugin', $form_object2);
|
||||
$this->assertEquals($block, $form_object2->plugin);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -198,7 +198,10 @@ class ConnectionTest extends UnitTestCase {
|
|||
$connection->schema()
|
||||
);
|
||||
$connection->destroy();
|
||||
$this->assertAttributeEquals(NULL, 'schema', $connection);
|
||||
|
||||
$reflected_schema = (new \ReflectionObject($connection))->getProperty('schema');
|
||||
$reflected_schema->setAccessible(TRUE);
|
||||
$this->assertNull($reflected_schema->getValue($connection));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -248,8 +248,7 @@ class EntityTypeManagerTest extends UnitTestCase {
|
|||
|
||||
$banana_form = $this->entityTypeManager->getFormObject('banana', 'default');
|
||||
$this->assertInstanceOf(TestEntityFormInjected::class, $banana_form);
|
||||
$this->assertAttributeEquals('yellow', 'color', $banana_form);
|
||||
|
||||
$this->assertEquals('yellow', $banana_form->color);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -500,7 +499,7 @@ class TestEntityFormInjected extends TestEntityForm implements ContainerInjectio
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $color;
|
||||
public $color;
|
||||
|
||||
/**
|
||||
* Constructs a new TestEntityFormInjected.
|
||||
|
|
|
@ -11,18 +11,6 @@ use Drupal\Tests\UnitTestCase;
|
|||
*/
|
||||
class StaticMenuLinkOverridesTest extends UnitTestCase {
|
||||
|
||||
/**
|
||||
* Tests the constructor.
|
||||
*
|
||||
* @covers ::__construct
|
||||
*/
|
||||
public function testConstruct() {
|
||||
$config_factory = $this->getConfigFactoryStub(['core.menu.static_menu_link_overrides' => []]);
|
||||
$static_override = new StaticMenuLinkOverrides($config_factory);
|
||||
|
||||
$this->assertAttributeEquals($config_factory, 'configFactory', $static_override);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the reload method.
|
||||
*
|
||||
|
|
|
@ -25,7 +25,6 @@ trait PHPUnit8Warnings {
|
|||
private static $ignoredWarnings = [
|
||||
'readAttribute() is deprecated and will be removed in PHPUnit 9.',
|
||||
'getObjectAttribute() is deprecated and will be removed in PHPUnit 9.',
|
||||
'assertAttributeEquals() is deprecated and will be removed in PHPUnit 9.',
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue