public function UtilityTest::testFormatBoostFactor in Search API 8
Tests formatting of boost factors.
@covers ::formatBoostFactor
File
- tests/
src/ Unit/ UtilityTest.php, line 42
Class
- UtilityTest
- Tests the Search API utility class.
Namespace
Drupal\Tests\search_api\UnitCode
public function testFormatBoostFactor() {
$this
->assertEquals('0.00', Utility::formatBoostFactor(0));
$this
->assertEquals('0.00', Utility::formatBoostFactor(0.0));
$this
->assertEquals('0.00', Utility::formatBoostFactor(0.0));
$this
->assertEquals('0.00', Utility::formatBoostFactor('0'));
$this
->assertEquals('0.00', Utility::formatBoostFactor('0.0'));
$this
->assertEquals('0.00', Utility::formatBoostFactor('0.00'));
$this
->assertEquals('0.00', Utility::formatBoostFactor(''));
$this
->assertEquals('1.00', Utility::formatBoostFactor(1));
$this
->assertEquals('1.00', Utility::formatBoostFactor(1.0));
$this
->assertEquals('1.00', Utility::formatBoostFactor(1.0));
$this
->assertEquals('1.10', Utility::formatBoostFactor(1.1));
$this
->assertEquals('1.01', Utility::formatBoostFactor(1.01));
$this
->assertEquals('1.00', Utility::formatBoostFactor('1'));
$this
->assertEquals('1.10', Utility::formatBoostFactor('1.1'));
$this
->assertEquals('1.01', Utility::formatBoostFactor('1.01'));
}