Skip to content

Commit 50dd347

Browse files
author
costdev
committed
Add tests for ::atime().
1 parent 82041f3 commit 50dd347

File tree

1 file changed

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

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
/**
3+
* Tests for the WP_Filesystem_Direct::atime() 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::atime
16+
*/
17+
class Tests_Filesystem_WpFilesystemDirect_Atime extends WP_Filesystem_Direct_UnitTestCase {
18+
19+
/**
20+
* Tests that `WP_Filesystem_Direct::atime()`
21+
* returns an integer for a path that exists.
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_accessed_time( $path ) {
30+
$path = self::$file_structure['test_dir']['path'] . $path;
31+
32+
$this->assertIsInt( self::$filesystem->atime( $path ) );
33+
}
34+
35+
/**
36+
* Tests that `WP_Filesystem_Direct::atime()`
37+
* returns false for a path that does not exist.
38+
*
39+
* @ticket 57774
40+
*
41+
* @dataProvider data_paths_that_do_not_exist
42+
*
43+
* @param string $path The path.
44+
*/
45+
public function test_should_return_false_for_a_path_that_does_not_exist( $path ) {
46+
$path = self::$file_structure['test_dir']['path'] . $path;
47+
48+
$this->assertFalse( self::$filesystem->atime( $path ) );
49+
}
50+
51+
}

0 commit comments

Comments
 (0)