PHPUnit | AssertDirectoryIsReadable() 함수

| | | | | | | | | | | | | |
구문:
assertDirectoryIsReadable (정수 $directory, string $message = ``) 
매개변수: 이 함수는 위 구문에서와 같이 두 개의 매개변수를 사용합니다. 매개변수는 아래에 설명되어 있습니다.
  • $directory: 이 매개변수는 디렉토리 경로를 나타내는 문자열입니다.
  • $message: 이 매개변수는 문자열 값. 테스트 케이스가 실패하면 이 문자열 메시지가 오류 메시지로 표시됩니다.
다음 프로그램은 PHPUnit의 assertDirectoryIsReadable() 함수를 보여줍니다. 프로그램 1: < tr> <코드> 사용 PHPUnitFrameworkTestCase; class GeeksPhpunitTestCase 확장 TestCase { 공개 함수 testNegativeTestcaseForAssertDirectoryIsReadable() { $directoryPath = " / home / shivam / Documents / phpunit / notreadable " ; // 주어진 경우 확인하는 함수를 지정 // 디렉토리 경로가 존재하고 읽을 수 있습니다. $this -> assertDirectoryIsReadable ( $directoryPath , " directoryPath가 존재하고 읽을 수 있습니다. " < 코드>); } }
?> 출력:
Sebastian Bergmann의 PHPUnit 8.2.5 및 기여자. F 1/1(100%) 시간: 89ms, 메모리: 10.00MB 1개의 오류가 발생했습니다. 1) GeeksPhpunitTestCase::testNegativeTestcaseForAssertDirectoryIsReadable directoryPath가 존재하고 읽을 수 있습니다. /home/shivam/Documents/engineer/phpunit/abc.php:13 실패! 테스트: 1, 주장: 1, 실패: 1. 
프로그램 2: 사용 PHPUnitFrameworkTestCase; class GeeksPhpunitTestCase 확장 TestCase { 공개 함수 testPositiveTestcaseForAssertDirectoryIsReadable() { $directoryPath = " / home / shivam / 문서/엔지니어 " ; // 다음 여부를 확인할 함수를 지정합니다. // 디렉토리 경로가 존재하고 읽을 수 있음 $this -> assertDirectoryIsReadable ( $directoryPath , "directoryPath가 존재하고 읽을 수 있음" ); } }
?>
< b>출력:
Sebastian Bergmann 및 기여자의 PHPUnit 8.2.5. ... 1/1(100%) 시간: 67ms, 메모리: 10.00MB OK(테스트 1개, 어설션 1개) 
참고: PHPUnit으로 테스트 케이스를 실행하려면 여기 . 또한 assertDirectoryIsReadable()은 phpunit 7 이상에서 지원됩니다.