fix tests

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2020-02-03 13:41:55 +01:00 committed by Roeland Jago Douma
parent 15a21ee19a
commit 861c897e93
No known key found for this signature in database
GPG Key ID: F941078878347C0C
1 changed files with 2 additions and 57 deletions

View File

@ -144,16 +144,6 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
* Test that propFind on a missing file soft fails * Test that propFind on a missing file soft fails
*/ */
public function testPropFindMissingFileSoftFail() { public function testPropFindMissingFileSoftFail() {
$this->tree->expects($this->at(0))
->method('getNodeForPath')
->with('/dummypath')
->will($this->throwException(new \Sabre\DAV\Exception\NotFound()));
$this->tree->expects($this->at(1))
->method('getNodeForPath')
->with('/dummypath')
->will($this->throwException(new \Sabre\DAV\Exception\ServiceUnavailable()));
$propFind = new \Sabre\DAV\PropFind( $propFind = new \Sabre\DAV\PropFind(
'/dummypath', '/dummypath',
array( array(
@ -174,20 +164,14 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
$propFind $propFind
); );
// no exception, soft fail // assert that the above didn't throw exceptions
$this->addToAssertionCount(1); $this->assertTrue(true);
} }
/** /**
* Test setting/getting properties * Test setting/getting properties
*/ */
public function testSetGetPropertiesForFile() { public function testSetGetPropertiesForFile() {
$node = $this->createTestNode(File::class);
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/dummypath')
->will($this->returnValue($node));
$this->applyDefaultProps(); $this->applyDefaultProps();
$propFind = new \Sabre\DAV\PropFind( $propFind = new \Sabre\DAV\PropFind(
@ -214,39 +198,6 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
* Test getting properties from directory * Test getting properties from directory
*/ */
public function testGetPropertiesForDirectory() { public function testGetPropertiesForDirectory() {
$rootNode = $this->createTestNode(Directory::class);
$nodeSub = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$nodeSub->expects($this->any())
->method('getId')
->will($this->returnValue(456));
$nodeSub->expects($this->any())
->method('getPath')
->will($this->returnValue('/dummypath/test.txt'));
$this->tree->expects($this->at(0))
->method('getNodeForPath')
->with('/dummypath')
->will($this->returnValue($rootNode));
$this->tree->expects($this->at(1))
->method('getNodeForPath')
->with('/dummypath/test.txt')
->will($this->returnValue($nodeSub));
$this->tree->expects($this->at(2))
->method('getNodeForPath')
->with('/dummypath')
->will($this->returnValue($rootNode));
$this->tree->expects($this->at(3))
->method('getNodeForPath')
->with('/dummypath/test.txt')
->will($this->returnValue($nodeSub));
$this->applyDefaultProps('/dummypath'); $this->applyDefaultProps('/dummypath');
$this->applyDefaultProps('/dummypath/test.txt'); $this->applyDefaultProps('/dummypath/test.txt');
@ -294,12 +245,6 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
* Test delete property * Test delete property
*/ */
public function testDeleteProperty() { public function testDeleteProperty() {
$node = $this->createTestNode(File::class);
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/dummypath')
->will($this->returnValue($node));
$this->applyDefaultProps(); $this->applyDefaultProps();
$propPatch = new \Sabre\DAV\PropPatch(array( $propPatch = new \Sabre\DAV\PropPatch(array(