diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2021-12-28 12:13:38 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-28 12:13:38 +0300 |
commit | 66ca9baed292e30e2354df0aa4f65742f27c28ce (patch) | |
tree | 37857a32d96ad7034e4d59967750e6c22b65991c /apps/dav/tests | |
parent | 6e906dedc67dde6d88420fb3a5e891b8231a4bd8 (diff) | |
parent | 01be1447be254d0d1a6dd204ddc403bb18a1cadf (diff) |
Merge pull request #29948 from nextcloud/enh/webdav-creationdate
Diffstat (limited to 'apps/dav/tests')
-rw-r--r-- | apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php index 52fcab8a301..201b2b863ab 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php @@ -65,6 +65,7 @@ class FilesPluginTest extends TestCase { public const SIZE_PROPERTYNAME = FilesPlugin::SIZE_PROPERTYNAME; public const PERMISSIONS_PROPERTYNAME = FilesPlugin::PERMISSIONS_PROPERTYNAME; public const LASTMODIFIED_PROPERTYNAME = FilesPlugin::LASTMODIFIED_PROPERTYNAME; + public const CREATIONDATE_PROPERTYNAME = FilesPlugin::CREATIONDATE_PROPERTYNAME; public const DOWNLOADURL_PROPERTYNAME = FilesPlugin::DOWNLOADURL_PROPERTYNAME; public const OWNER_ID_PROPERTYNAME = FilesPlugin::OWNER_ID_PROPERTYNAME; public const OWNER_DISPLAY_NAME_PROPERTYNAME = FilesPlugin::OWNER_DISPLAY_NAME_PROPERTYNAME; @@ -168,6 +169,9 @@ class FilesPluginTest extends TestCase { $fileInfo->expects($this->any()) ->method('isReadable') ->willReturn(true); + $fileInfo->expects($this->any()) + ->method('getCreationTime') + ->willReturn(123456789); $node->expects($this->any()) ->method('getFileInfo') @@ -192,6 +196,7 @@ class FilesPluginTest extends TestCase { self::OWNER_ID_PROPERTYNAME, self::OWNER_DISPLAY_NAME_PROPERTYNAME, self::DATA_FINGERPRINT_PROPERTYNAME, + self::CREATIONDATE_PROPERTYNAME, ], 0 ); @@ -222,6 +227,7 @@ class FilesPluginTest extends TestCase { $this->assertEquals('"abc"', $propFind->get(self::GETETAG_PROPERTYNAME)); $this->assertEquals('00000123instanceid', $propFind->get(self::FILEID_PROPERTYNAME)); $this->assertEquals('123', $propFind->get(self::INTERNAL_FILEID_PROPERTYNAME)); + $this->assertEquals('1973-11-29T21:33:09+00:00', $propFind->get(self::CREATIONDATE_PROPERTYNAME)); $this->assertEquals(null, $propFind->get(self::SIZE_PROPERTYNAME)); $this->assertEquals('DWCKMSR', $propFind->get(self::PERMISSIONS_PROPERTYNAME)); $this->assertEquals('http://example.com/', $propFind->get(self::DOWNLOADURL_PROPERTYNAME)); @@ -396,6 +402,7 @@ class FilesPluginTest extends TestCase { $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File'); $testDate = 'Fri, 13 Feb 2015 00:01:02 GMT'; + $testCreationDate = '2007-08-31T16:47+00:00'; $node->expects($this->once()) ->method('touch') @@ -406,10 +413,15 @@ class FilesPluginTest extends TestCase { ->with('newetag') ->willReturn(true); + $node->expects($this->once()) + ->method('setCreationTime') + ->with('1188578820'); + // properties to set $propPatch = new PropPatch([ self::GETETAG_PROPERTYNAME => 'newetag', - self::LASTMODIFIED_PROPERTYNAME => $testDate + self::LASTMODIFIED_PROPERTYNAME => $testDate, + self::CREATIONDATE_PROPERTYNAME => $testCreationDate, ]); $this->plugin->handleUpdateProperties( @@ -424,6 +436,7 @@ class FilesPluginTest extends TestCase { $result = $propPatch->getResult(); $this->assertEquals(200, $result[self::LASTMODIFIED_PROPERTYNAME]); $this->assertEquals(200, $result[self::GETETAG_PROPERTYNAME]); + $this->assertEquals(200, $result[self::CREATIONDATE_PROPERTYNAME]); } public function testUpdatePropsForbidden() { |