function TimeZoneAbbreviationRouteTest::testAbbreviationConversion

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Datetime/TimeZoneAbbreviationRouteTest.php \Drupal\Tests\system\Functional\Datetime\TimeZoneAbbreviationRouteTest::testAbbreviationConversion()
  2. 10 core/modules/system/tests/src/Functional/Datetime/TimeZoneAbbreviationRouteTest.php \Drupal\Tests\system\Functional\Datetime\TimeZoneAbbreviationRouteTest::testAbbreviationConversion()

Test the AJAX Timezone Callback with invalid inputs.

@dataProvider providerAbbreviationConversion

Parameters

string $path: Path to call.

string|null $expectedResponse: Expected response, or NULL if expecting error.

bool $expectInvalidRequest: Whether to expect the request is invalid.

File

core/modules/system/tests/src/Functional/Datetime/TimeZoneAbbreviationRouteTest.php, line 54

Class

TimeZoneAbbreviationRouteTest
Tests converting JavaScript time zone abbreviations to time zone identifiers.

Namespace

Drupal\Tests\system\Functional\Datetime

Code

public function testAbbreviationConversion($path, $expectedResponse = NULL, $expectInvalidRequest = FALSE) : void {
    $response = $this->drupalGet('system/timezone/' . $path);
    if (isset($expectedResponse)) {
        $this->assertEquals($response, $expectedResponse);
    }
    $this->assertSession()
        ->statusCodeEquals($expectInvalidRequest ? 404 : 200);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.