Better tests & message for symlink test

no longer checking invalid (nlink = 2) or undefined (stat['url') things to see if it worked
This commit is contained in:
nathan 2021-07-13 10:33:50 -06:00
parent 4819afd2d3
commit 73df101e8e

View File

@ -365,9 +365,14 @@ abstract class StreamWrapperBase extends LoggedInTest
$this->markTestIncomplete($scheme . " StreamWrapper ($class) does not support symlink"); $this->markTestIncomplete($scheme . " StreamWrapper ($class) does not support symlink");
} }
// Try to remove if it's there already
if(Vfs::is_dir($test_base_dir))
{
Vfs::rmdir($test_base_dir);
}
$this->assertTrue( $this->assertTrue(
Vfs::mkdir($test_base_dir), Vfs::mkdir($test_base_dir),
"Could not create base test directory '$test_base_dir'" "Could not create base test directory '$test_base_dir', delete it if it's there already."
); );
$this->assertTrue( $this->assertTrue(
Vfs::mkdir($source_dir), Vfs::mkdir($source_dir),
@ -404,9 +409,8 @@ abstract class StreamWrapperBase extends LoggedInTest
$this->assertTrue(Vfs::is_dir($link_dir), "Link directory was not a directory"); $this->assertTrue(Vfs::is_dir($link_dir), "Link directory was not a directory");
// Test - Folder is what we expect // Test - Folder is what we expect
$stat = Vfs::stat($link_dir); $readlink = Vfs::readlink($link_dir);
$this->assertEquals(2,$stat['nlink'], "Link target is not a folder"); $this->assertStringEndsWith("/link_target", $readlink, "Looks like link is wrong");
$this->assertStringEndsWith($source_dir,$stat['url'], "Looks like link is wrong");
// Test - File is where we expect // Test - File is where we expect
$files = Vfs::find($link_dir,['type'=>'F']); $files = Vfs::find($link_dir,['type'=>'F']);