Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Preliminary top 13 results as of 2021 March 31 for current 5420 Drupal 9 compatible projects:
6981 uses (in 444 projects) Call to deprecated method drupalPostForm() of class Drupal\Tests\BrowserTestBase. Deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Use $this->submitForm() instead.- 3925 uses (in 189 projects) Call to deprecated method assertText() of class Drupal\Tests\BrowserTestBase. Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use - $this->assertSession()->responseContains() for non-HTML responses, like XML or Json. - $this->assertSession()->pageTextContains() for HTML responses. Unlike the deprecated assertText(), the passed text should be HTML decoded, exactly as a human sees it in the browser.
- 2142 uses (in 150 projects) Call to deprecated method assertEqual() of class Drupal\Tests\BrowserTestBase. Deprecated in drupal:8.0.0 and is removed from drupal:10.0.0. Use $this->assertEquals() instead.
- 1421 uses (in 31 projects) Call to deprecated method assertIdentical() of class Drupal\Tests\BrowserTestBase. Deprecated in drupal:8.0.0 and is removed from drupal:10.0.0. Use $this->assertSame() instead.
- 1183 uses (in 185 projects) Call to deprecated method assertResponse() of class Drupal\Tests\BrowserTestBase. Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->statusCodeEquals() instead.
- 1025 uses (in 84 projects) Call to deprecated method assertEqual() of class Drupal\KernelTests\KernelTestBase. Deprecated in drupal:8.0.0 and is removed from drupal:10.0.0. Use $this->assertEquals() instead.
- 849 uses (in 107 projects) Call to deprecated method assertRaw() of class Drupal\Tests\BrowserTestBase. Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseContains() instead.
- 737 uses (in 77 projects) Call to deprecated method assertFieldByName() of class Drupal\Tests\BrowserTestBase. Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->fieldExists() or $this->assertSession()->buttonExists() or $this->assertSession()->fieldValueEquals() instead.
- 574 uses (in 72 projects) Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase. Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use - $this->assertSession()->responseNotContains() for non-HTML responses, like XML or Json. - $this->assertSession()->pageTextNotContains() for HTML responses. Unlike the deprecated assertNoText(), the passed text should be HTML decoded, exactly as a human sees it in the browser.
- 413 uses (in 199 projects) Class [redacted] extends deprecated class Symfony\Component\EventDispatcher\Event: since Symfony 4.3, use "Symfony\Contracts\EventDispatcher\Event" instead
- 364 uses (in 81 projects) Call to deprecated method setMethods() of class PHPUnit\Framework\MockObject\MockBuilder: sebastianbergmann/phpunit#3687
- 336 uses (in 37 projects) Call to deprecated method assertFieldChecked() of class Drupal\Tests\BrowserTestBase. Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->checkboxChecked() instead.
- 244 uses (in 49 projects) Call to deprecated function drush_log().
I think 10 and 11 would be covered by other existing rectors. Not surprisingly almost all of these are about test methods that were mostly deprecated a long time ago and are already actionable to fix on Drupal 9 compatible projects within Drupal 9.
---
I will be breaking these into separate issues as time allows.
Comments
Comment #2
mglamanMarking this as postponed until #3219156: Add support for Drupal 9
Comment #3
mglamandrupalPostForm will be fixed in #3219156: Add support for Drupal 9
Comment #4
mglamanHere is the full list https://dev.acquia.com/drupal10/deprecation_status/errors
Making this issue a plan of attack
Comment #5
mglamanWe now have Drupal 9 support added in #3219156: Add support for Drupal 9 which adds a rule to fix drupalPostForm!
Comment #6
mglamanA bunch are related to https://www.drupal.org/node/3129738
Comment #7
mglamanThe following have rules in a PR for #3222671: AssertLegacyTrait rector rules
assertText
assertEqual
assertIdentical
assertResponse
assertRaw
assertFieldByName
Comment #8
Gábor HojtsyWoah, if the above top ones are resolved, 57% of the currently identified deprecated API uses will be covered by drupal-rector. That is quite an achievement. 20k of 35k instances found across all of contrib.