function BytesTest::testToInt

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Component/Utility/BytesTest.php \Drupal\Tests\Component\Utility\BytesTest::testToInt()

Tests \Drupal\Component\Utility\Bytes::toInt().

@dataProvider providerTestToNumber @covers ::toInt

@group legacy

Parameters

int $size: The value for the size argument for \Drupal\Component\Utility\Bytes::toInt().

int $expected_int: The expected return value from \Drupal\Component\Utility\Bytes::toInt().

File

core/tests/Drupal/Tests/Component/Utility/BytesTest.php, line 35

Class

BytesTest
Tests bytes size parsing helper methods.

Namespace

Drupal\Tests\Component\Utility

Code

public function testToInt($size, $expected_int) {
    $this->expectDeprecation('\\Drupal\\Component\\Utility\\Bytes::toInt() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Use \\Drupal\\Component\\Utility\\Bytes::toNumber() instead. See https://www.drupal.org/node/3162663');
    $this->assertEquals($expected_int, Bytes::toInt($size));
}

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