Changeset 47122 for trunk/tests/phpunit/tests/file.php
- Timestamp:
- 01/29/2020 12:43:23 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/file.php
r46586 r47122 72 72 73 73 $fp = fopen( $fullpath, 'x' ); 74 // file already exists?74 // File already exists? 75 75 if ( ! $fp ) { 76 76 return false; 77 77 } 78 78 79 // write some random contents79 // Write some random contents. 80 80 $c = rand_str(); 81 81 fwrite( $fp, $c ); … … 92 92 93 93 function test_unique_filename_is_valid() { 94 // make sure it produces a valid, writable, unique filename94 // Make sure it produces a valid, writable, unique filename. 95 95 $filename = wp_unique_filename( $this->dir, __FUNCTION__ . '.txt' ); 96 96 … … 101 101 102 102 function test_unique_filename_is_unique() { 103 // make sure it produces two unique filenames103 // Make sure it produces two unique filenames. 104 104 $name = __FUNCTION__; 105 105 … … 109 109 $this->assertTrue( $this->is_unique_writable_file( $this->dir, $filename2 ) ); 110 110 111 // the two should be different111 // The two should be different. 112 112 $this->assertNotEquals( $filename1, $filename2 ); 113 113 … … 120 120 $filename = wp_unique_filename( $this->dir, $name . $this->badchars . '.txt' ); 121 121 122 // make sure the bad characters were all stripped out122 // Make sure the bad characters were all stripped out. 123 123 $this->assertEquals( $name . '.txt', $filename ); 124 124 … … 133 133 $filename = wp_unique_filename( $this->dir, $name . '/' . $name . '.txt' ); 134 134 135 // the slash should be removed, i.e. "foofoo.txt"135 // The slash should be removed, i.e. "foofoo.txt". 136 136 $this->assertEquals( $name . $name . '.txt', $filename ); 137 137 … … 145 145 $filename = wp_unique_filename( $this->dir, $name . '.php.txt' ); 146 146 147 // "foo.php.txt" becomes "foo.php_.txt" 147 // "foo.php.txt" becomes "foo.php_.txt". 148 148 $this->assertEquals( $name . '.php_.txt', $filename ); 149 149
Note: See TracChangeset
for help on using the changeset viewer.