diff --git a/calendar/tests/action_event_test.php b/calendar/tests/action_event_test.php index c655f84e01e..70bbf906c28 100644 --- a/calendar/tests/action_event_test.php +++ b/calendar/tests/action_event_test.php @@ -130,9 +130,9 @@ class core_calendar_action_event_test_event implements event_interface { public function get_times() { return new event_times( - (new \DateTimeImmutable())->setTimestamp('-2461276800'), - (new \DateTimeImmutable())->setTimestamp('115776000'), - (new \DateTimeImmutable())->setTimestamp('115776000'), + (new \DateTimeImmutable())->setTimestamp(-386380800), + (new \DateTimeImmutable())->setTimestamp(115776000), + (new \DateTimeImmutable())->setTimestamp(115776000), (new \DateTimeImmutable())->setTimestamp(time()) ); } diff --git a/calendar/tests/event_mapper_test.php b/calendar/tests/event_mapper_test.php index 67738f4f190..8d99c57a09d 100644 --- a/calendar/tests/event_mapper_test.php +++ b/calendar/tests/event_mapper_test.php @@ -334,9 +334,9 @@ class event_mapper_test_event implements event_interface { public function get_times() { return new event_times( - (new \DateTimeImmutable())->setTimestamp('-2461276800'), - (new \DateTimeImmutable())->setTimestamp('115776000'), - (new \DateTimeImmutable())->setTimestamp('115776000'), + (new \DateTimeImmutable())->setTimestamp(-386380800), + (new \DateTimeImmutable())->setTimestamp(115776000), + (new \DateTimeImmutable())->setTimestamp(115776000), (new \DateTimeImmutable())->setTimestamp(time()) ); } diff --git a/calendar/tests/event_test.php b/calendar/tests/event_test.php index c1ddaf96f27..b2e5d9b0c82 100644 --- a/calendar/tests/event_test.php +++ b/calendar/tests/event_test.php @@ -89,9 +89,9 @@ class core_calendar_event_testcase extends advanced_testcase { 'course_module' => new std_proxy(1, $lamecallable), 'type' => 'dunno what this actually is meant to be', 'times' => new event_times( - (new \DateTimeImmutable())->setTimestamp('-2461276800'), - (new \DateTimeImmutable())->setTimestamp('115776000'), - (new \DateTimeImmutable())->setTimestamp('115776000'), + (new \DateTimeImmutable())->setTimestamp(-386380800), + (new \DateTimeImmutable())->setTimestamp(115776000), + (new \DateTimeImmutable())->setTimestamp(115776000), (new \DateTimeImmutable())->setTimestamp(time()) ), 'visible' => true, diff --git a/calendar/tests/event_times_test.php b/calendar/tests/event_times_test.php index 9a6c55cf4b3..607c8693263 100644 --- a/calendar/tests/event_times_test.php +++ b/calendar/tests/event_times_test.php @@ -61,17 +61,17 @@ class core_calendar_event_times_testcase extends advanced_testcase { return [ 'Dataset 1' => [ 'constructorparams' => [ - 'start_time' => (new \DateTimeImmutable())->setTimestamp('-2461276800'), - 'end_time' => (new \DateTimeImmutable())->setTimestamp('115776000'), - 'sort_time' => (new \DateTimeImmutable())->setTimestamp('115776000'), + 'start_time' => (new \DateTimeImmutable())->setTimestamp(-386380800), + 'end_time' => (new \DateTimeImmutable())->setTimestamp(115776000), + 'sort_time' => (new \DateTimeImmutable())->setTimestamp(115776000), 'modified_time' => (new \DateTimeImmutable())->setTimestamp(time()) ] ], 'Dataset 2' => [ 'constructorparams' => [ - 'start_time' => (new \DateTimeImmutable())->setTimestamp('123456'), - 'end_time' => (new \DateTimeImmutable())->setTimestamp('12345678'), - 'sort_time' => (new \DateTimeImmutable())->setTimestamp('1111'), + 'start_time' => (new \DateTimeImmutable())->setTimestamp(123456), + 'end_time' => (new \DateTimeImmutable())->setTimestamp(12345678), + 'sort_time' => (new \DateTimeImmutable())->setTimestamp(1111), 'modified_time' => (new \DateTimeImmutable())->setTimestamp(time()) ] ] diff --git a/lib/filestorage/file_system_filedir.php b/lib/filestorage/file_system_filedir.php index 82f6b5cc87f..816f7d698b4 100644 --- a/lib/filestorage/file_system_filedir.php +++ b/lib/filestorage/file_system_filedir.php @@ -109,7 +109,7 @@ class file_system_filedir extends file_system { * @return string The full path to the content file */ protected function get_local_path_from_hash($contenthash, $fetchifnotfound = false) { - return $this->get_fulldir_from_hash($contenthash) . DIRECTORY_SEPARATOR . $contenthash; + return $this->get_fulldir_from_hash($contenthash) . '/' .$contenthash; } /** @@ -171,7 +171,7 @@ class file_system_filedir extends file_system { * @return string The full path to the content directory */ protected function get_fulldir_from_hash($contenthash) { - return $this->filedir . DIRECTORY_SEPARATOR . $this->get_contentdir_from_hash($contenthash); + return $this->filedir . '/' . $this->get_contentdir_from_hash($contenthash); } /** @@ -198,7 +198,7 @@ class file_system_filedir extends file_system { * @return string The filepath within filedir */ protected function get_contentpath_from_hash($contenthash) { - return $this->get_contentdir_from_hash($contenthash) . "/$contenthash"; + return $this->get_contentdir_from_hash($contenthash) . '/' . $contenthash; } /** @@ -209,7 +209,7 @@ class file_system_filedir extends file_system { * @return string The full path to the trash directory */ protected function get_trash_fulldir_from_hash($contenthash) { - return $this->trashdir . DIRECTORY_SEPARATOR . $this->get_contentdir_from_hash($contenthash); + return $this->trashdir . '/' . $this->get_contentdir_from_hash($contenthash); } /** @@ -219,7 +219,7 @@ class file_system_filedir extends file_system { * @return string The full path to the trash file */ protected function get_trash_fullpath_from_hash($contenthash) { - return $this->trashdir . DIRECTORY_SEPARATOR . $this->get_contentpath_from_hash($contenthash); + return $this->trashdir . '/' . $this->get_contentpath_from_hash($contenthash); } /** @@ -251,7 +251,7 @@ class file_system_filedir extends file_system { $contenthash = $file->get_contenthash(); $contentdir = $this->get_fulldir_from_storedfile($file); $trashfile = $this->get_trash_fullpath_from_hash($contenthash); - $alttrashfile = $this->trashdir . DIRECTORY_SEPARATOR . $contenthash; + $alttrashfile = "{$this->trashdir}/{$contenthash}"; if (!is_readable($trashfile)) { // The trash file was not found. Check the alternative trash file too just in case. diff --git a/lib/filestorage/tests/file_storage_test.php b/lib/filestorage/tests/file_storage_test.php index 08febf3b9f9..fdbece52b43 100644 --- a/lib/filestorage/tests/file_storage_test.php +++ b/lib/filestorage/tests/file_storage_test.php @@ -1867,7 +1867,7 @@ class core_files_file_storage_testcase extends advanced_testcase { * errors and behaves as expected. */ public function test_mimetype_known() { - $filepath = __DIR__ . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'testimage.jpg'; + $filepath = __DIR__ . '/fixtures/testimage.jpg'; $mimetype = file_storage::mimetype_from_file($filepath); $this->assertEquals('image/jpeg', $mimetype); } @@ -1890,7 +1890,7 @@ class core_files_file_storage_testcase extends advanced_testcase { * errors and behaves as expected. */ public function test_mimetype_from_file_known() { - $filepath = __DIR__ . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'testimage.jpg'; + $filepath = __DIR__ . '/fixtures/testimage.jpg'; $mimetype = file_storage::mimetype_from_file($filepath); $this->assertEquals('image/jpeg', $mimetype); } diff --git a/lib/filestorage/tests/file_system_test.php b/lib/filestorage/tests/file_system_test.php index 89162f4c5ac..adf539f5f5d 100644 --- a/lib/filestorage/tests/file_system_test.php +++ b/lib/filestorage/tests/file_system_test.php @@ -847,7 +847,7 @@ class core_files_file_system_testcase extends advanced_testcase { * for an image. */ public function test_get_imageinfo_from_path() { - $filepath = __DIR__ . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'testimage.jpg'; + $filepath = __DIR__ . "/fixtures/testimage.jpg"; // Get the filesystem mock. $fs = $this->get_testable_mock(); @@ -906,7 +906,7 @@ class core_files_file_system_testcase extends advanced_testcase { $fs = $this->get_testable_mock(['get_remote_path_from_storedfile']); $fs->method('get_remote_path_from_storedfile') - ->willReturn(__DIR__ . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'test.tgz'); + ->willReturn(__DIR__ . "/fixtures/test.tgz"); // Note: We are unable to determine the mode in which the $fh was opened. $fh = $fs->get_content_file_handle($file, stored_file::FILE_HANDLE_GZOPEN); @@ -956,7 +956,7 @@ class core_files_file_system_testcase extends advanced_testcase { $contenthash = file_storage::hash_from_string($filecontent); $filename = 'example'; - $filepath = __DIR__ . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'testimage.jpg'; + $filepath = __DIR__ . "/fixtures/testimage.jpg"; $fs = $this->get_testable_mock(['get_remote_path_from_hash']); $fs->method('get_remote_path_from_hash')->willReturn($filepath); @@ -974,7 +974,7 @@ class core_files_file_system_testcase extends advanced_testcase { $contenthash = file_storage::hash_from_string($filecontent); $filename = 'example'; - $filepath = __DIR__ . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'testimage.jpg'; + $filepath = __DIR__ . "/fixtures/testimage.jpg"; $fs = $this->get_testable_mock([ 'get_remote_path_from_hash', @@ -1022,7 +1022,7 @@ class core_files_file_system_testcase extends advanced_testcase { * a locally available file whose filename does not suggest mimetype. */ public function test_mimetype_from_storedfile_using_file_content() { - $filepath = __DIR__ . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'testimage.jpg'; + $filepath = __DIR__ . "/fixtures/testimage.jpg"; $fs = $this->get_testable_mock(['get_remote_path_from_storedfile']); $fs->method('get_remote_path_from_storedfile')->willReturn($filepath); @@ -1037,7 +1037,7 @@ class core_files_file_system_testcase extends advanced_testcase { * a remotely available file whose filename does not suggest mimetype. */ public function test_mimetype_from_storedfile_using_file_content_remote() { - $filepath = __DIR__ . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'testimage.jpg'; + $filepath = __DIR__ . "/fixtures/testimage.jpg"; $fs = $this->get_testable_mock([ 'get_remote_path_from_storedfile', diff --git a/lib/filestorage/tests/tgz_packer_test.php b/lib/filestorage/tests/tgz_packer_test.php index 3d66b7565b0..f12668e38c1 100644 --- a/lib/filestorage/tests/tgz_packer_test.php +++ b/lib/filestorage/tests/tgz_packer_test.php @@ -255,7 +255,7 @@ class core_files_tgz_packer_testcase extends advanced_testcase implements file_p // Prepare files. $files = $this->prepare_file_list(); - $archivefile = make_request_directory() . DIRECTORY_SEPARATOR . 'test.tgz'; + $archivefile = make_request_directory() . '/test.tgz'; $packer->archive_to_pathname($files, $archivefile); // Extract same files. @@ -272,7 +272,7 @@ class core_files_tgz_packer_testcase extends advanced_testcase implements file_p $packer = get_file_packer('application/x-gzip'); // Create sample files. - $archivefile = make_request_directory() . DIRECTORY_SEPARATOR . 'test.tgz'; + $archivefile = make_request_directory() . '/test.tgz'; file_put_contents($archivefile, ''); // Extract same files.