Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/html/rocksensor1/web/core/tests/Drupal/FunctionalJavascriptTests/

Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
Upload File :
Current File : /var/www/html/rocksensor1/web/core/tests/Drupal/FunctionalJavascriptTests/JavascriptErrorsTest.php

<?php

declare(strict_types=1);

namespace Drupal\FunctionalJavascriptTests;

use PHPUnit\Framework\AssertionFailedError;

/**
 * Tests that Drupal.throwError will cause a test failure.
 *
 * @group javascript
 */
class JavascriptErrorsTest extends WebDriverTestBase {

  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';

  /**
   * {@inheritdoc}
   */
  protected static $modules = ['js_errors_test'];

  /**
   * Tests that JavaScript console errors will result in a test failure.
   */
  public function testJavascriptErrors(): void {
    // Visit page that will throw a JavaScript console error.
    $this->drupalGet('js_errors_test');
    // Ensure that errors from previous page loads will be
    // detected.
    $this->drupalGet('user');

    $this->expectException(AssertionFailedError::class);
    $this->expectExceptionMessageMatches('/^Error: A manually thrown error/');

    // Manually call the method under test, as it cannot be caught by PHPUnit
    // when triggered from assertPostConditions().
    $this->failOnJavaScriptErrors();
  }

  /**
   * Tests JavaScript console errors during asynchronous calls.
   */
  public function testJavascriptErrorsAsync(): void {
    // Visit page that will throw a JavaScript console error in async context.
    $this->drupalGet('js_errors_async_test');
    // Ensure that errors from previous page loads will be detected.
    $this->drupalGet('user');

    $this->expectException(AssertionFailedError::class);
    $this->expectExceptionMessageMatches('/^Error: An error thrown in async context./');

    // Manually call the method under test, as it cannot be caught by PHPUnit
    // when triggered from assertPostConditions().
    $this->failOnJavaScriptErrors();
  }

  /**
   * Clear the JavaScript error log to prevent this test failing for real.
   *
   * @postCondition
   */
  public function clearErrorLog() {
    $this->getSession()->executeScript("sessionStorage.removeItem('js_testing_log_test.errors')");
  }

}

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped) Email: contact@elmoujehidin.net