Skip to content

Commit 7c083c5

Browse files
author
costdev
committed
Add tests for ::exists().
1 parent 59c8b19 commit 7c083c5

File tree

1 file changed

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

1 file changed

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

0 commit comments

Comments
 (0)