Permalink
Browse files

MDL-33149 stored_file::repository should be private

  • Loading branch information...
1 parent 55711b0 commit 291a3d1fb60c53f7d603025a51fe57c11a1aad81 @dcai dcai committed May 22, 2012
Showing with 4 additions and 4 deletions.
  1. +1 −1 lib/filestorage/stored_file.php
  2. +1 −1 lib/filestorage/tests/file_storage_test.php
  3. +2 −2 lib/tests/filelib_test.php
@@ -47,7 +47,7 @@ class stored_file {
/** @var string location of content files */
private $filedir;
/** @var repository repository plugin instance */
- public $repository;
+ private $repository;
/**
* Constructor, this constructor should be called ONLY from the file_storage class!
@@ -183,7 +183,7 @@ public function test_create_file_from_reference() {
$ref = $fs->pack_reference($filerecord);
$newstoredfile = $fs->create_file_from_reference($newfilerecord, $userrepository->id, $ref);
$this->assertInstanceOf('stored_file', $newstoredfile);
- $this->assertEquals($userrepository->id, $newstoredfile->repository->id);
+ $this->assertEquals($userrepository->id, $newstoredfile->get_repository_id());
$this->assertEquals($originalfile->get_contenthash(), $newstoredfile->get_contenthash());
$this->assertEquals($originalfile->get_filesize(), $newstoredfile->get_filesize());
$this->assertRegExp('#' . $filename. '$#', $newstoredfile->get_reference_details());
@@ -151,7 +151,7 @@ public function test_prepare_draft_area() {
// create a file reference
$fileref = $fs->create_file_from_reference($filerefrecord, $userrepository->id, $userfileref);
$this->assertInstanceOf('stored_file', $fileref);
- $this->assertEquals($userrepository->id, $fileref->repository->id);
+ $this->assertEquals($userrepository->id, $fileref->get_repository_id());
$this->assertEquals($userfile->get_contenthash(), $fileref->get_contenthash());
$this->assertEquals($userfile->get_filesize(), $fileref->get_filesize());
$this->assertRegExp('#' . $userfile->get_filename(). '$#', $fileref->get_reference_details());
@@ -249,7 +249,7 @@ public function test_delete_original_file_from_draft() {
// create a file reference
$fileref = $fs->create_file_from_reference($filerecord, $userrepository->id, $userfileref);
$this->assertInstanceOf('stored_file', $fileref);
- $this->assertEquals($userrepository->id, $fileref->repository->id);
+ $this->assertEquals($userrepository->id, $fileref->get_repository_id());
$this->assertEquals($userfile->get_contenthash(), $fileref->get_contenthash());
$this->assertEquals($userfile->get_filesize(), $fileref->get_filesize());
$this->assertRegExp('#' . $userfile->get_filename(). '$#', $fileref->get_reference_details());

0 comments on commit 291a3d1

Please sign in to comment.