Skip to content

Commit 82041f3

Browse files
author
costdev
committed
Add tests for ::is_writable().
1 parent c9ed23a commit 82041f3

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
/**
3+
* Tests for the WP_Filesystem_Direct::is_writable() method.
4+
*
5+
* @package WordPress
6+
*/
7+
8+
require_once __DIR__ . '/base.php';
9+
10+
/**
11+
* @group admin
12+
* @group filesystem
13+
* @group filesystem-direct
14+
*
15+
* @covers WP_Filesystem_Direct::is_writable
16+
*/
17+
class Tests_Filesystem_WpFilesystemDirect_IsWritable extends WP_Filesystem_Direct_UnitTestCase {
18+
19+
/**
20+
* Tests that `WP_Filesystem_Direct::is_writable()` determines that
21+
* a path is writable.
22+
*
23+
* @ticket 57774
24+
*
25+
* @dataProvider data_paths_that_exist
26+
*
27+
* @param string $path The path.
28+
*/
29+
public function test_should_determine_that_a_path_is_writable( $path ) {
30+
$this->assertTrue( self::$filesystem->is_writable( self::$file_structure['test_dir']['path'] . $path ) );
31+
}
32+
33+
/**
34+
* Tests that `WP_Filesystem_Direct::is_writable()` determines that
35+
* a path is not writable.
36+
*
37+
* @ticket 57774
38+
*
39+
* @dataProvider data_paths_that_do_not_exist
40+
*
41+
* @param string $path The path.
42+
*/
43+
public function test_should_determine_that_a_path_is_not_writable( $path ) {
44+
$this->assertFalse( self::$filesystem->is_writable( self::$file_structure['test_dir']['path'] . $path ) );
45+
}
46+
47+
}

0 commit comments

Comments
 (0)