function NumberTest::testAlphadecimalToIntThrowsExceptionWithMalformedStrings

Tests the alphadecimal conversion function input parameter checking.

Number::alphadecimalToInt() must throw an exception when non-alphanumeric characters are passed as input.

@covers ::alphadecimalToInt

File

core/tests/Drupal/Tests/Component/Utility/NumberTest.php, line 171

Class

NumberTest
Tests number manipulation utilities.

Namespace

Drupal\Tests\Component\Utility

Code

public function testAlphadecimalToIntThrowsExceptionWithMalformedStrings() : void {
    $this->expectException(\InvalidArgumentException::class);
    $nonAlphanumericChar = '#';
    Number::alphadecimalToInt($nonAlphanumericChar);
}

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