Unverified Commit 50a60755 authored by alexpott's avatar alexpott
Browse files

Issue #3126563 by mondrake, daffie, alexpott: Replace usage of...

Issue #3126563 by mondrake, daffie, alexpott: Replace usage of assertAttributeEquals() that is deprecated

(cherry picked from commit a6e402fc)
parent 7dcb6fa2
......@@ -10,6 +10,11 @@
*/
class EmptyBlockForm extends PluginFormBase {
/**
* {@inheritdoc}
*/
public $plugin;
/**
* {@inheritdoc}
*/
......
......@@ -93,7 +93,9 @@ public function testConstructor() {
$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 @@ public function testConstructor() {
]
);
// 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 @@ public function testSetMessage() {
$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 @@ public function __construct(Connection $database, array $configuration, $plugin_
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $event_dispatcher);
}
/**
* {@inheritdoc}
*/
public $message;
/**
* {@inheritdoc}
*/
......
......@@ -93,7 +93,9 @@ public function testConstructor() {
$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 @@ public function testConstructor() {
$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 @@ public function testMultipleForms() {
// 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 @@ public function testDestroy() {
$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 @@ public function testGetFormObject() {
$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 @@
*/
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.',
];
/**
......
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