function PercentagesTest::testPercentages
Same name and namespace in other branches
- 8.9.x core/tests/Drupal/Tests/Core/Batch/PercentagesTest.php \Drupal\Tests\Core\Batch\PercentagesTest::testPercentages()
- 10 core/tests/Drupal/Tests/Core/Batch/PercentagesTest.php \Drupal\Tests\Core\Batch\PercentagesTest::testPercentages()
- 11.x core/tests/Drupal/Tests/Core/Batch/PercentagesTest.php \Drupal\Tests\Core\Batch\PercentagesTest::testPercentages()
@dataProvider providerTestPercentages
@covers ::format
File
-
core/
tests/ Drupal/ Tests/ Core/ Batch/ PercentagesTest.php, line 22
Class
- PercentagesTest
- @coversDefaultClass \Drupal\Core\Batch\Percentage[[api-linebreak]] @group Batch
Namespace
Drupal\Tests\Core\BatchCode
public function testPercentages($total, $current, $expected_result) {
$actual_result = Percentage::format($total, $current);
$this->assertEquals($actual_result, $expected_result, sprintf('The expected the batch api percentage at the state %s/%s is %s%% and got %s%%.', $current, $total, $expected_result, $actual_result));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.