Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(filestore): adds API to reliably set file modification time
Updates PHPUnit bootstrap to allow working with file entity objects. Modifies and adds new file related tests. Adds two new methods ElggFile::setModifiedTime and ElggFile::getModifiedTime, which invalidate stat cache to ensure we always have latest modified time information Refs #9571
- Loading branch information
1 parent
50721e5
commit 476b6d2
Showing
7 changed files
with
111 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
class ElggFileTest extends \PHPUnit_Framework_TestCase { | ||
|
||
/** | ||
* @var \ElggFile | ||
*/ | ||
protected $file; | ||
|
||
protected function setUp() { | ||
|
||
$session = \ElggSession::getMock(); | ||
_elgg_services()->setValue('session', $session); | ||
_elgg_services()->session->start(); | ||
|
||
$file = new \ElggFile(); | ||
$file->owner_guid = 1; | ||
$file->setFilename("foobar.txt"); | ||
|
||
$this->file = $file; | ||
} | ||
|
||
/** | ||
* @group FileService | ||
*/ | ||
public function testCanSetModifiedTime() { | ||
$time = $this->file->getModifiedTime(); | ||
$this->file->setModifiedTime(); | ||
$this->assertNotEquals($time, $this->file->getModifiedTime()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello world! |
1 change: 0 additions & 1 deletion
1
engine/tests/phpunit/test_files/dataroot/file_service/foobar.txt
This file was deleted.
Oops, something went wrong.