File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
tests/phpunit/tests/filesystem/wpFilesystemDirect Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Tests for the WP_Filesystem_Direct::chdir() 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::chdir
16+ */
17+ class Tests_Filesystem_WpFilesystemDirect_Chdir extends WP_Filesystem_Direct_UnitTestCase {
18+
19+ /**
20+ * Tests that `WP_Filesystem_Direct::chdir()`
21+ * returns false for a path that does not exist.
22+ *
23+ * @ticket 57774
24+ *
25+ * @dataProvider data_paths_that_do_not_exist
26+ *
27+ * @param string $path The path.
28+ */
29+ public function test_should_fail_to_change_directory ( $ path ) {
30+ $ this ->assertFalse ( self ::$ filesystem ->chdir ( self ::$ file_structure ['test_dir ' ]['path ' ] . $ path ) );
31+ }
32+
33+ /**
34+ * Tests that `WP_Filesystem_Direct::chdir()` changes to
35+ * an existing directory.
36+ *
37+ * @ticket 57774
38+ */
39+ public function test_should_change_directory () {
40+ $ this ->assertTrue ( self ::$ filesystem ->chdir ( self ::$ file_structure ['test_dir ' ]['path ' ] ) );
41+ }
42+
43+ }
You can’t perform that action at this time.
0 commit comments