PHPUnit assertIsFloat() Function Last Updated : 07 Aug, 2020 Comments Improve Suggest changes Like Article Like Report The assertIsFloat() function is a builtin function in PHPUnit and is used to assert whether the actually obtained value is float or not. This assertion will return true in the case if the actual value is Float else returns false. In case of true the asserted test case got passed else test case got failed. Syntax: assertIsFloat($actual[, $message = '']) Parameters: This function accepts two parameters as mentioned above and described below: $actual: This parameter is of any type of integer which represents the actual data.$message: This parameter takes a string value. When the test case got failed this string message got displayed as an error message. Below examples illustrate the assertIsFloat() function in PHPUnit: Examples 1: PHP <?php use PHPUnit\Framework\TestCase; class GeeksPhpunitTestCase extends TestCase { public function testNegativeForassertIsFloat() { $actualvalue = (420); // Assert function to test whether actual // value is float or not $this->assertIsFloat( $actualvalue, "actual value is float or not" ); } } ?> Output: PHPUnit 8.5.8 by Sebastian Bergmann and contributors. F 1 / 1 (100%) Time: 86 ms, Memory: 10.00 MB There was 1 failure: 1) GeeksPhpunitTestCase::testNegativeForassertIsFloat actual value is float or not Failed asserting that 420 is of type "float". /home/lovely/Documents/php/test.php:13 FAILURES! Tests: 1, Assertions: 1, Failures: 1. Example 2: PHP <?php use PHPUnit\Framework\TestCase; class GeeksPhpunitTestCase extends TestCase { public function testPositiveForassertIsFloat() { $actualvalue = (4.20); // Assert function to test whether actual // value is float or not $this->assertIsFloat( $actualvalue, "actual value is float or not" ); } } ?> Output: PHPUnit 8.5.8 by Sebastian Bergmann and contributors. . 1 / 1 (100%) Time: 89 ms, Memory: 10.00 MB OK (1 test, 1 assertion) Reference: https://phpunit.readthedocs.io/en/9.2/assertions.html#assertisfloat Comment More infoAdvertise with us Next Article PHPUnit assertIsFloat() Function S shubham_singh Follow Improve Article Tags : Web Technologies PHP PHP-PHPUnit Similar Reads PHPUnit assertIsNotFloat() Function The assertIsNotFloat() function is a builtin function in PHPUnit and is used to assert whether the actually obtained value is not a float. This assertion will return true in the case if the actual value is doesn't Float else returns false. In case of true the asserted test case got passed else test 2 min read PHPUnit assertIsInt() Function The assertIsInt() function is a builtin function in PHPUnit and is used to assert whether the given actual variable is an integer or not. This assertion will return true in the case if the actual variable is an integer else returns false. In case of true the asserted test case got passed else test c 2 min read PHPUnit assertIsNotInt() Function The assertIsNotInt() function is a builtin function in PHPUnit and is used to assert whether the given actual variable is not an integer. This assertion will return true in the case if the actual variable is doesn't integer else returns false. In case of true the asserted test case got passed else t 2 min read PHPUnit assertIsScalar() Function The assertIsScalar() function is a builtin function in PHPUnit and is used to assert Scalar variables are those containing an integer, float, string, or boolean. This function does not consider null to be scalar. This assertion will return true in the case if the actual value is scalar else returns 2 min read PHPUnit assertIsObject() Function The assertIsObject() function is a builtin function in PHPUnit and is used to assert whether the actual given content is an object or not. This assertion will return true in the case if the actual given content is object else returns false. In case of true the asserted test case got passed, else tes 2 min read PHPUnit assertIsBool() Function The assertIsBool() function is a builtin function in PHPUnit and is used to assert whether the actually obtained value is Bool or not. This assertion will return true in the case if the actual value is the Bool else returns false. In case of true the asserted test case got passed else test case got 2 min read PHPUnit assertSame() Function The assertSame() function is a builtin function in PHPUnit and is used to assert whether the actually obtained value is the same as the expected value or not. This assertion will return true in the case if the expected value is the same as the actual value else returns false. In case of true the ass 2 min read PHPUnit assertIsNotBool() Function The assertIsNotBool() function is a builtin function in PHPUnit and is used to assert whether the actually obtained value is Not a Bool. This assertion will return true in the case if the actual value is the Not a Bool else returns false. In case of true the asserted test case got passed else test c 2 min read PHPUnit assertIsArray() Function The assertIsArray() function is a builtin function in PHPUnit and is used to assert whether the given variable is an array or not. This assertion will return true in the case if the given variable is array else returns false. In case of true the asserted test case got passed else test case got faile 2 min read PHPUnit assertFalse() Function The assertFalse() function is a builtin function in PHPUnit and is used to assert the conditional value is true or false. This assertion will return true in the case if the conditional value is true else return false. In case of true the asserted test case got passed else test case got failed. Synta 2 min read Like