]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - tests/include/connectors/ConnectorsTestUtility.php
Added unit tests.
[Github/sugarcrm.git] / tests / include / connectors / ConnectorsTestUtility.php
1 <?php
2 class ConnectorsTestUtility {
3
4         static function rmdirr($dirname) {
5             // Sanity check
6             if (!file_exists($dirname)) {
7                 return false;
8             }
9          
10             // Simple delete for a file
11             if (is_file($dirname) || is_link($dirname)) {
12                 return unlink($dirname);
13             }
14          
15             // Loop through the folder
16             $dir = dir($dirname);
17             while (false !== $entry = $dir->read()) {
18                 // Skip pointers
19                 if ($entry == '.' || $entry == '..') {
20                     continue;
21                 }
22          
23                 // Recurse
24                 self::rmdirr("$dirname/$entry");
25             }
26          
27             // Clean up
28             $dir->close();
29             return rmdir($dirname);
30         }
31         
32 }
33 ?>