function NumberTest::testAlphadecimalToIntThrowsExceptionWithMalformedStrings

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Component/Utility/NumberTest.php \Drupal\Tests\Component\Utility\NumberTest::testAlphadecimalToIntThrowsExceptionWithMalformedStrings()

Tests the alphadecimal conversion function input parameter checking.

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

File

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

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.