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.
Follow-up #2822837: Replace @expectedException @expectedExceptionMessage with $this->setExpectedException:
@klausi #77:
+++ b/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php
@@ -58,7 +59,6 @@ public function providerDoGetDefinitionException() {
@@ -69,6 +69,7 @@ public function testDoGetDefinitionException($expected, $definitions, $plugin_id
@@ -69,6 +69,7 @@ public function testDoGetDefinitionException($expected, $definitions, $plugin_id
$method_ref = new \ReflectionMethod($trait, 'doGetDefinition');
$method_ref->setAccessible(TRUE);
// Call doGetDefinition, with $exception_on_invalid always TRUE.
+ $this->setExpectedException(PluginNotFoundException::class);
$this->assertSame(
$expected,
$method_ref->invoke($trait, $definitions, $plugin_id, TRUE)
It doesn't really make sense to use assertSame() here. The @dataProvider on that method also does not make sense because it has only one test set.
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedvaplas created an issue. See original summary.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedLooks like we can fix it in the #2822837: Replace @expectedException @expectedExceptionMessage with $this->setExpectedException