AssertFieldByNameRector
Fixes deprecated AssertLegacyTrait::assertFieldByName() calls
-$this->assertFieldByName('field_name', 'expected_value');
-$this->assertFieldByName("field_name[0][value][date]", '', 'Date element found.');
-$this->assertFieldByName("field_name[0][value][time]", null, 'Time element found.');
+$this->assertSession()->fieldValueEquals('field_name', 'expected_value');
+$this->assertSession()->fieldValueEquals("field_name[0][value][date]", '');
+$this->assertSession()->fieldExists("field_name[0][value][time]");
Configure your rector.php:
<?php
use DrupalRector\Drupal9\Rector\Deprecation\AssertFieldByNameRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
AssertFieldByNameRector::class,
]);