MDL-51832 tests: Fix failing code manager unit tests on Windows
authorDavid Mudrák <david@moodle.com>
Mon, 19 Oct 2015 15:43:12 +0000 (17:43 +0200)
committerDavid Mudrák <david@moodle.com>
Mon, 19 Oct 2015 16:08:59 +0000 (18:08 +0200)
lib/classes/update/code_manager.php
lib/tests/update_code_manager_test.php

index e18715f..3af994d 100644 (file)
@@ -325,7 +325,7 @@ class code_manager {
             if ($fileinfo->isDir() and substr($key, -1) !== '/') {
                 $key .= '/';
             }
-            $files[$key] = $fileinfo->getRealPath();
+            $files[str_replace(DIRECTORY_SEPARATOR, '/', $key)] = str_replace(DIRECTORY_SEPARATOR, '/', $fileinfo->getRealPath());
         }
         return $files;
     }
index a2ef45c..6166152 100644 (file)
@@ -126,6 +126,7 @@ class core_update_code_manager_testcase extends advanced_testcase {
         $files = $codeman->list_plugin_folder_files($fixtures.'/foobar');
         $this->assertInternalType('array', $files);
         $this->assertEquals(6, count($files));
+        $fixtures = str_replace(DIRECTORY_SEPARATOR, '/', $fixtures);
         $this->assertEquals($files['foobar/'], $fixtures.'/foobar');
         $this->assertEquals($files['foobar/lang/en/local_foobar.php'], $fixtures.'/foobar/lang/en/local_foobar.php');
     }