mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 06:07:32 +02:00
Use canonical file system paths in e_fileTest::testUnzipGithubArchive()
Should fix the tests on Windows Fixes: #4052
This commit is contained in:
@@ -341,11 +341,18 @@ class e_fileTest extends \Codeception\Test\Unit
|
|||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
$destination = e_TEMP."fake-git-remote-destination/";
|
$destination = e_TEMP."fake-git-remote-destination/";
|
||||||
mkdir($destination);
|
$e_file->removeDir($destination);
|
||||||
|
$e_file->mkDir($destination);
|
||||||
$results = $e_file->unzipGithubArchive('core', $destination);
|
$results = $e_file->unzipGithubArchive('core', $destination);
|
||||||
|
|
||||||
$this->assertEmpty($results['error'], "Errors not expected from Git remote update");
|
$this->assertEmpty($results['error'], "Errors not expected from Git remote update");
|
||||||
$extraction_mapping = array_flip(e107::getInstance()->e107_dirs);
|
$results['success'] = array_map(function($path)
|
||||||
|
{
|
||||||
|
$realpath = realpath($path);
|
||||||
|
$this->assertNotFalse($realpath,
|
||||||
|
"File {$path} reported as successfully extracted but does not exist");
|
||||||
|
return $realpath;
|
||||||
|
}, $results['success']);
|
||||||
foreach($fake_e107_files['desired'] as $desired_filename)
|
foreach($fake_e107_files['desired'] as $desired_filename)
|
||||||
{
|
{
|
||||||
foreach ($src_dest_map as $src => $dest)
|
foreach ($src_dest_map as $src => $dest)
|
||||||
@@ -353,11 +360,12 @@ class e_fileTest extends \Codeception\Test\Unit
|
|||||||
$desired_filename = preg_replace("/^".preg_quote($src, '/')."/", $dest, $desired_filename);
|
$desired_filename = preg_replace("/^".preg_quote($src, '/')."/", $dest, $desired_filename);
|
||||||
}
|
}
|
||||||
$this->assertContains(realpath($destination.$desired_filename), $results['success'],
|
$this->assertContains(realpath($destination.$desired_filename), $results['success'],
|
||||||
"Desired file did not appear in file system");
|
"Desired file {$desired_filename} did not appear in file system");
|
||||||
}
|
}
|
||||||
foreach($fake_e107_files['undesired'] as $undesired_filename)
|
foreach($fake_e107_files['undesired'] as $undesired_filename)
|
||||||
{
|
{
|
||||||
$this->assertContains($prefix.$undesired_filename, $results['skipped']);
|
$this->assertContains($prefix.$undesired_filename, $results['skipped'],
|
||||||
|
"{$undesired_filename} was not skipped but should have been");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user