Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix test
  • Loading branch information
icewind1991 committed Jul 22, 2016
commit a4ba3eadd0d1e04dc4ef5d11dae59c7dc98c4466
8 changes: 7 additions & 1 deletion apps/files/tests/Controller/ApiControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class ApiControllerTest extends TestCase {
private $shareManager;
/** @var \OCP\IConfig */
private $config;
/** @var \OC\Files\Node\Folder */
private $userFolder;

public function setUp() {
$this->request = $this->getMockBuilder('\OCP\IRequest')
Expand All @@ -82,6 +84,9 @@ public function setUp() {
->disableOriginalConstructor()
->getMock();
$this->config = $this->getMock('\OCP\IConfig');
$this->userFolder = $this->getMockBuilder('\OC\Files\Node\Folder')
->disableOriginalConstructor()
->getMock();

$this->apiController = new ApiController(
$this->appName,
Expand All @@ -90,7 +95,8 @@ public function setUp() {
$this->tagService,
$this->preview,
$this->shareManager,
$this->config
$this->config,
$this->userFolder
);
}

Expand Down
25 changes: 19 additions & 6 deletions apps/files/tests/Controller/ViewControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,16 @@ public function testIndexWithRegularBrowser() {
'appname' => 'files',
'script' => 'list.php',
'order' => 0,
'name' => new \OC_L10N_String(new \OC_L10N('files'), 'All files', []),
'name' => (string)new \OC_L10N_String(new \OC_L10N('files'), 'All files', []),
'active' => false,
'icon' => '',
],
[
'id' => 'recent',
'appname' => 'files',
'script' => 'list.php',
'order' => 2,
'name' => (string)new \OC_L10N_String(new \OC_L10N('files'), 'Recent', []),
'active' => false,
'icon' => '',
],
Expand All @@ -209,7 +218,7 @@ public function testIndexWithRegularBrowser() {
'appname' => 'files_sharing',
'script' => 'list.php',
'order' => 10,
'name' => new \OC_L10N_String(new \OC_L10N('files_sharing'), 'Shared with you', []),
'name' => (string)new \OC_L10N_String(new \OC_L10N('files_sharing'), 'Shared with you', []),
'active' => false,
'icon' => '',
],
Expand All @@ -218,7 +227,7 @@ public function testIndexWithRegularBrowser() {
'appname' => 'files_sharing',
'script' => 'list.php',
'order' => 15,
'name' => new \OC_L10N_String(new \OC_L10N('files_sharing'), 'Shared with others', []),
'name' => (string)new \OC_L10N_String(new \OC_L10N('files_sharing'), 'Shared with others', []),
'active' => false,
'icon' => '',
],
Expand All @@ -227,7 +236,7 @@ public function testIndexWithRegularBrowser() {
'appname' => 'files_sharing',
'script' => 'list.php',
'order' => 20,
'name' => new \OC_L10N_String(new \OC_L10N('files_sharing'), 'Shared by link', []),
'name' => (string)new \OC_L10N_String(new \OC_L10N('files_sharing'), 'Shared by link', []),
'active' => false,
'icon' => '',
],
Expand All @@ -236,7 +245,7 @@ public function testIndexWithRegularBrowser() {
'appname' => 'systemtags',
'script' => 'list.php',
'order' => 25,
'name' => new \OC_L10N_String(new \OC_L10N('systemtags'), 'Tags', []),
'name' => (string)new \OC_L10N_String(new \OC_L10N('systemtags'), 'Tags', []),
'active' => false,
'icon' => '',
],
Expand All @@ -245,7 +254,7 @@ public function testIndexWithRegularBrowser() {
'appname' => 'files_trashbin',
'script' => 'list.php',
'order' => 50,
'name' => new \OC_L10N_String(new \OC_L10N('files_trashbin'), 'Deleted files', []),
'name' => (string)new \OC_L10N_String(new \OC_L10N('files_trashbin'), 'Deleted files', []),
'active' => false,
'icon' => '',
],
Expand All @@ -272,6 +281,10 @@ public function testIndexWithRegularBrowser() {
'id' => 'files',
'content' => null,
],
[
'id' => 'recent',
'content' => null,
],
[
'id' => 'favorites',
'content' => null,
Expand Down
5 changes: 4 additions & 1 deletion tests/lib/Files/Node/FolderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ public function testRecentFolder() {
'parent' => $id1
]);
$id3 = $cache->put('bar/foo/folder/asd.txt', [
'storage_mtime' => $baseTime,
'storage_mtime' => $baseTime - 100,
'mtime' => $baseTime - 100,
'mimetype' => 'text/plain',
'size' => 3,
Expand All @@ -905,6 +905,9 @@ public function testRecentFolder() {
return (int)$node->getId();
}, $nodes);
$this->assertEquals([$id2, $id1, $id3], $ids);// sort folders before files with the same mtime, folders get the lowest child mtime
$this->assertEquals($baseTime, $nodes[0]->getMTime());
$this->assertEquals($baseTime - 100, $nodes[1]->getMTime());
$this->assertEquals($baseTime - 100, $nodes[2]->getMTime());
}

public function testRecentJail() {
Expand Down