Commit 6b393bb1 authored by alexpott's avatar alexpott
Browse files

Issue #2162729 by TravisCarden, Xano, InternetDevels: "Sub-class must...

Issue #2162729 by TravisCarden, Xano, InternetDevels: "Sub-class must implement the getInfo method" not a helpful exception message.
parent 6c3fbad8
...@@ -198,7 +198,9 @@ public static function getInfo() { ...@@ -198,7 +198,9 @@ public static function getInfo() {
// PHP does not allow us to declare this method as abstract public static, // PHP does not allow us to declare this method as abstract public static,
// so we simply throw an exception here if this has not been implemented by // so we simply throw an exception here if this has not been implemented by
// a child class. // a child class.
throw new \RuntimeException("Sub-class must implement the getInfo method!"); throw new \RuntimeException(String::format('@class must implement \Drupal\simpletest\TestBase::getInfo().', array(
'@class' => get_called_class(),
)));
} }
/** /**
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace Drupal\Tests; namespace Drupal\Tests;
use Drupal\Component\Utility\Random; use Drupal\Component\Utility\Random;
use Drupal\Component\Utility\String;
use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\DependencyInjection\ContainerBuilder;
/** /**
...@@ -38,7 +39,9 @@ public static function getInfo() { ...@@ -38,7 +39,9 @@ public static function getInfo() {
// PHP does not allow us to declare this method as abstract public static, // PHP does not allow us to declare this method as abstract public static,
// so we simply throw an exception here if this has not been implemented by // so we simply throw an exception here if this has not been implemented by
// a child class. // a child class.
throw new \RuntimeException("Sub-class must implement the getInfo method!"); throw new \RuntimeException(String::format('@class must implement \Drupal\Tests\UnitTestCase::getInfo().', array(
'@class' => get_called_class(),
)));
} }
/** /**
......
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