|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Copyright (c) 2016 Robin Appelman <[email protected]> |
|
4
|
|
|
* This file is licensed under the Affero General Public License version 3 or |
|
5
|
|
|
* later. |
|
6
|
|
|
* See the COPYING-README file. |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace OCA\Files_Sharing\Tests\External; |
|
10
|
|
|
|
|
11
|
|
|
use OC\AppFramework\Http; |
|
12
|
|
|
use OC\Files\View; |
|
13
|
|
|
use Test\Connector\Sabre\RequestTest\RequestTest; |
|
14
|
|
|
|
|
15
|
|
|
class OwnerPropagation extends RequestTest { |
|
16
|
1 |
|
public function testBasicUpload() { |
|
17
|
1 |
|
$user = $this->getUniqueID(); |
|
18
|
1 |
|
$userView = $this->setupUser($user, 'pass'); |
|
19
|
|
|
|
|
20
|
1 |
|
$userView->mkdir('/a/b/share'); |
|
21
|
|
|
|
|
22
|
1 |
|
$subView = new View('/' . $user . '/files/a/b/share'); |
|
23
|
1 |
|
$this->assertTrue($subView->is_dir('')); |
|
24
|
|
|
|
|
25
|
|
|
$oldInfos = [ |
|
26
|
1 |
|
$userView->getFileInfo(''), |
|
27
|
1 |
|
$userView->getFileInfo('a'), |
|
28
|
1 |
|
$userView->getFileInfo('a/b'), |
|
29
|
1 |
|
$userView->getFileInfo('a/b/share'), |
|
30
|
1 |
|
]; |
|
31
|
|
|
|
|
32
|
1 |
|
$this->assertFalse($subView->file_exists('foo.txt')); |
|
33
|
1 |
|
$response = $this->request($subView, $user, 'pass', 'PUT', '/foo.txt', 'asd'); |
|
34
|
|
|
|
|
35
|
1 |
|
$this->assertEquals(Http::STATUS_CREATED, $response->getStatus()); |
|
36
|
1 |
|
$this->assertTrue($subView->file_exists('foo.txt')); |
|
37
|
1 |
|
$this->assertEquals('asd', $subView->file_get_contents('foo.txt')); |
|
38
|
|
|
|
|
39
|
|
|
$newInfos = [ |
|
40
|
1 |
|
$userView->getFileInfo(''), |
|
41
|
1 |
|
$userView->getFileInfo('a'), |
|
42
|
1 |
|
$userView->getFileInfo('a/b'), |
|
43
|
1 |
|
$userView->getFileInfo('a/b/share'), |
|
44
|
1 |
|
]; |
|
45
|
|
|
|
|
46
|
1 |
|
foreach($oldInfos as $i => $oldInfo) { |
|
47
|
1 |
|
$this->assertNotEquals($oldInfo->getEtag(), $newInfos[$i]->getEtag(), 'Etag for ' . $oldInfo->getPath()); |
|
48
|
1 |
|
} |
|
49
|
1 |
|
} |
|
50
|
|
|
} |
|
51
|
|
|
|