Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/273.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php “有什么用?”;应为“U文件()”;Codeception中的函数?_Php_Yii_Yii2_Phpunit_Codeception - Fatal编程技术网

Php “有什么用?”;应为“U文件()”;Codeception中的函数?

Php “有什么用?”;应为“U文件()”;Codeception中的函数?,php,yii,yii2,phpunit,codeception,Php,Yii,Yii2,Phpunit,Codeception,嗨,我是codeception单元测试的新手,我正在将它与Yii2一起使用。我知道函数expect\u not()和expect\u that()的用户,也对expect()函数知之甚少,并使用它检查错误数组中的键 但是我不知道expect\u file()的用法。我在网上搜索得很少,但没有找到任何好的帮助。有人能给我介绍一下这个函数的用法吗。expect\u file()用于验证特定于文件系统对象的断言。它有两个参数(一个是可选的) 如果使用单个参数调用此函数,它将用作测试文件名下的主题。如果

嗨,我是codeception单元测试的新手,我正在将它与Yii2一起使用。我知道函数
expect\u not()
expect\u that()
的用户,也对
expect()
函数知之甚少,并使用它检查错误数组中的键

但是我不知道expect\u file()的用法。我在网上搜索得很少,但没有找到任何好的帮助。有人能给我介绍一下这个函数的用法吗。

expect\u file()
用于验证特定于文件系统对象的断言。它有两个参数(一个是可选的)

如果使用单个参数调用此函数,它将用作测试文件名下的主题。如果使用两个参数调用它,则将用作说明,以显示断言是否失败,但如果使用0个或两个以上参数调用它,则会引发错误的方法调用异常

你可以这样使用它

expect_file('filename.txt')->exists();
expect_file('filename.txt')->notExists();
顺便说一句,
expect\u file()
verify\u file()
expect\u file()
用于验证特定于文件系统对象的断言。它有两个参数(一个是可选的)

如果使用单个参数调用此函数,它将用作测试文件名下的主题。如果使用两个参数调用它,则将用作说明,以显示断言是否失败,但如果使用0个或两个以上参数调用它,则会引发错误的方法调用异常

你可以这样使用它

expect_file('filename.txt')->exists();
expect_file('filename.txt')->notExists();

顺便说一句,expect\u file()是
verify\u file()
的另一个函数,expect\u not,expect\u和expect\u file函数不属于Codeception,您在哪里找到它们的?expect\u not,expect\u和expect\u file函数不属于Codeception,你在哪里找到的?它属于哪个图书馆?它属于哪个图书馆?