mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
add public method Filesystem#size
This commit is contained in:
parent
51eca2cdfc
commit
69f2230a4c
2 changed files with 52 additions and 0 deletions
|
@ -107,5 +107,25 @@ class FilesystemTest extends TestCase
|
|||
$this->assertTrue($fs->removeDirectoryPhp($tmp . "/composer_testdir"));
|
||||
$this->assertFalse(file_exists($tmp . "/composer_testdir/level1/level2/hello.txt"));
|
||||
}
|
||||
|
||||
public function testFileSize()
|
||||
{
|
||||
$tmp = sys_get_temp_dir();
|
||||
file_put_contents("$tmp/composer_test_file", 'Hello');
|
||||
|
||||
$fs = new Filesystem;
|
||||
$this->assertGreaterThanOrEqual(5, $fs->size("$tmp/composer_test_file"));
|
||||
}
|
||||
|
||||
public function testDirectorySize()
|
||||
{
|
||||
$tmp = sys_get_temp_dir();
|
||||
@mkdir("$tmp/composer_testdir", 0777, true);
|
||||
file_put_contents("$tmp/composer_testdir/file1.txt", 'Hello');
|
||||
file_put_contents("$tmp/composer_testdir/file2.txt", 'World');
|
||||
|
||||
$fs = new Filesystem;
|
||||
$this->assertGreaterThanOrEqual(10, $fs->size("$tmp/composer_testdir"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue