Merge branch 'MDL-58718-master' of git://github.com/andrewnicols/moodle

This commit is contained in:
David Monllao 2017-04-27 11:14:04 +08:00
commit f539dc3aa5
8 changed files with 31 additions and 31 deletions

View File

@ -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())
);
}

View File

@ -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())
);
}

View File

@ -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,

View File

@ -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())
]
]

View File

@ -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.

View File

@ -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);
}

View File

@ -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',

View File

@ -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.