PHPUnit测试在写入文件时失败
我的单元测试在Travis CI上失败,但在本地没有 错误消息:PHPUnit测试在写入文件时失败,phpunit,travis-ci,Phpunit,Travis Ci,我的单元测试在Travis CI上失败,但在本地没有 错误消息: 1) testBackupPathTestCase::testMergeExistingPath RuntimeException: Error writing to file. (/tmp/wordpress/wp-content/backupwordpress- a74dcf0e84-backups/.schedule-test-merge-existing-path-running) 测试结果如下: 该异常由以下函
1) testBackupPathTestCase::testMergeExistingPath
RuntimeException: Error writing to file. (/tmp/wordpress/wp-content/backupwordpress- a74dcf0e84-backups/.schedule-test-merge-existing-path-running)
测试结果如下:
该异常由以下函数引发:
/**
* Set the status of the running backup
*
* @access public
*
* @param string $message
*
* @return void
*/
public function set_status( $message ) {
$status = json_encode( (object) array(
'filename' => $this->get_archive_filename(),
'started' => $this->get_schedule_running_start_time(),
'status' => $message,
) );
if ( false === @file_put_contents( $this->get_schedule_running_path(), $status ) ) {
throw new RuntimeException( sprintf( __( 'Error writing to file. (%s)', 'backpwordpress' ), $this->get_schedule_running_path() ) );
}
}
请参见此处的完整课程:
我如何确定这是由CI环境引起的错误,还是代码中的错误?看起来您已经解决了它?如果你能自我回答,那就太好了。它自己修复了,不知道有多抱歉