Skip to content

Commit 3140bc5

Browse files
author
costdev
committed
Add tests for ::getchmod().
1 parent ea3cbcd commit 3140bc5

File tree

1 file changed

+48
-0
lines changed
  • tests/phpunit/tests/filesystem/wpFilesystemDirect

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
/**
3+
* Tests for the WP_Filesystem_Direct::getchmod() 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::getchmod
16+
*/
17+
class Tests_Filesystem_WpFilesystemDirect_Getchmod extends WP_Filesystem_Direct_UnitTestCase {
18+
19+
/**
20+
* Tests that `WP_Filesystem_Direct::getchmod()` returns
21+
* the permissions for a path that exists.
22+
*
23+
* @dataProvider data_paths_that_exist
24+
*
25+
* @ticket 57774
26+
*
27+
* @param string $path The path.
28+
*/
29+
public function test_should_get_chmod_for_a_path_that_exists( $path ) {
30+
$actual = self::$filesystem->getchmod( self::$file_structure['test_dir']['path'] . $path );
31+
$this->assertNotSame( '', $actual );
32+
}
33+
34+
/**
35+
* Tests that `WP_Filesystem_Direct::getchmod()` returns
36+
* the permissions for a path that does not exist.
37+
*
38+
* @dataProvider data_paths_that_do_not_exist
39+
*
40+
* @ticket 57774
41+
*
42+
* @param string $path The path.
43+
*/
44+
public function test_should_get_chmod_for_a_path_that_does_not_exist( $path ) {
45+
$actual = self::$filesystem->getchmod( self::$file_structure['test_dir']['path'] . $path );
46+
$this->assertNotSame( '', $actual );
47+
}
48+
}

0 commit comments

Comments
 (0)