Commit db370f95 authored by Derek Wright's avatar Derek Wright
Browse files

Issue #2692641 by dww: Cleanup test assertions for exception handling:

- The test code from #2692641 was fragile and prone to fail with misleading messages.
- With the assertEqual() inside the try {}, if it failed, we thought we got an exception.
- If we can't parse the URL, we can't assume before/after are the same.
parent 2fa52b10
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -246,17 +246,11 @@ class PathologicTest extends BrowserTestBase {
    // Test really broken URLs.
    // @see https://www.drupal.org/node/2602312
    $original = '<a href="/Epic:failure">foo</a>';
    $message = t('Fails sensibly when \Drupal\Core\Url::fromUri() throws exception');
    try {
      $filtered = check_markup($original, $format_id);
      $this->assertEqual(
        $original,
        $filtered,
        $message
      );
    }
    catch (\Exception $e) {
      $this->fail($message);
      $this->fail('Fails miserably when \Drupal\Core\Url::fromUri() throws exception');
    }

  }