work around previous test fails
authordemeritcowboy <demeritcowboy@hotmail.com>
Fri, 17 Dec 2021 20:37:57 +0000 (15:37 -0500)
committerdemeritcowboy <demeritcowboy@hotmail.com>
Fri, 17 Dec 2021 20:37:57 +0000 (15:37 -0500)
tests/phpunit/CRM/Utils/FileTest.php

index 1f7162876a0ccfbdbdd1cc2bb41804f3610347e9..5af809fda0b7a898d76299f7190fdc146805757a 100644 (file)
@@ -211,6 +211,9 @@ class CRM_Utils_FileTest extends CiviUnitTestCase {
    */
   public function testIsDirMkdir() {
     $a_dir = sys_get_temp_dir() . '/testIsDir';
+    // I think temp is global to the test node, so if any test failed on this
+    // in the past it doesn't get cleaned up and so already exists.
+    system('rm -rf ' . escapeshellarg($a_dir));
     mkdir($a_dir);
     $this->assertTrue(CRM_Utils_File::isDir($a_dir));
     mkdir($a_dir . '/aSubDir');
@@ -226,6 +229,9 @@ class CRM_Utils_FileTest extends CiviUnitTestCase {
    */
   public function testIsDirSlashVariations() {
     $a_dir = sys_get_temp_dir() . '/testIsDir';
+    // I think temp is global to the test node, so if any test failed on this
+    // in the past it doesn't get cleaned up and so already exists.
+    system('rm -rf ' . escapeshellarg($a_dir));
     mkdir($a_dir);
 
     $old_cwd = getcwd();
@@ -265,6 +271,9 @@ class CRM_Utils_FileTest extends CiviUnitTestCase {
     }
 
     $a_dir = sys_get_temp_dir() . '/testIsDir';
+    // I think temp is global to the test node, so if any test failed on this
+    // in the past it doesn't get cleaned up and so already exists.
+    system('rm -rf ' . escapeshellarg($a_dir));
     mkdir($a_dir);
     symlink($a_dir, $a_dir . '_symlink');
     $this->assertTrue(CRM_Utils_File::isDir($a_dir . '_symlink'));