diff --git a/core/tests/Drupal/Tests/Core/StringTranslation/TranslationWrapperTest.php b/core/tests/Drupal/Tests/Core/StringTranslation/TranslationWrapperTest.php index 3a5ce97..8f99198 100644 --- a/core/tests/Drupal/Tests/Core/StringTranslation/TranslationWrapperTest.php +++ b/core/tests/Drupal/Tests/Core/StringTranslation/TranslationWrapperTest.php @@ -1,10 +1,10 @@ getMock('Drupal\Core\StringTranslation\TranslationInterface'); $translation->expects($this->any()) ->method('translate') - ->willReturnCallback(function ($string, array $args = [], array $options = []) { + ->willReturnCallback(function () { throw new \Exception('Yes you may.'); }); $text->setStringTranslation($translation); set_error_handler(array($this, "errorHandler")); // We want this to trigger an error. - (string) $text; + $result = (string) $text; restore_error_handler(); $this->assertEquals(E_USER_NOTICE, $this->lastErrorNumber); $this->assertRegExp('/An exception was thrown while calling __toString on a .*\TranslationWrapper object in .* on line [0-9]+: Yes you may./', $this->lastErrorMessage); + $this->assertSame('', $result); } }