assertNan()
2018-02-24 15:42 更新
assertNan()
assertNan(mixed $variable[, string $message = ''])
当 $variable
不是 NAN
时报告错误,错误讯息由 $message
指定。
Example A.31. assertNan() 的用法
<?php
class NanTest extends PHPUnit_Framework_TestCase
{
public function testFailure()
{
$this->assertNan(1);
}
}
?>
phpunit NanTest
PHPUnit 5.0.0 by Sebastian Bergmann and contributors.
F
Time: 0 seconds, Memory: 5.00Mb
There was 1 failure:
1) NanTest::testFailure
Failed asserting that 1 is nan.
/home/sb/NanTest.php:6
FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
以上内容是否对您有帮助:
更多建议: