Hi i am new to codeception unit testing and i am using it with Yii2. I know the user of functions expect_not()
and expect_that()
and also know little about expect()
function and uses it to check key in error array.
However I don't know the use of expect_file()
. I searched little in internet but found not any good help. can anyone please give me little description about the use of this function.
expect_file()
is used to verify with assertions specific to file system objects. It has two parameters (one is optional).
If you call this function with a single parameter, it will be used as the Subject Under Test file name. if it is called with two parameters, will be used as a description to display if the assertion fails but if you if you call it with 0 or more than two arguments it will throw a bad method call exceptions.
You can use it like this
expect_file('filename.txt')->exists();
expect_file('filename.txt')->notExists();
BTW expect_file()
is an alternate function for verify_file()
.