namespace OCA\Files_Sharing\Tests\API;
use OCP\AppFramework\Http\DataResponse;
-use OCP\AppFramework\OCS\OCSNotFoundException;
use OCP\IL10N;
use OCA\Files_Sharing\API\Share20OCS;
use OCP\Files\NotFoundException;
use OCP\IUser;
use OCP\Files\IRootFolder;
use OCP\Lock\LockedException;
-use Punic\Data;
/**
* Class Share20OCSTest
['group', $group],
]));
- $this->assertEquals($result, $ocs->getShare($share->getId())->getData()['data'][0]);
+ $this->assertEquals($result, $ocs->getShare($share->getId())->getData()[0]);
}
/**
$share = $this->newShare();
$this->shareManager->method('newShare')->willReturn($share);
+ /** @var \OCA\Files_Sharing\API\Share20OCS $ocs */
$ocs = $this->getMockBuilder('OCA\Files_Sharing\API\Share20OCS')
->setConstructorArgs([
$this->appName,
}))
->will($this->returnArgument(0));
- $expected = new DataResponse(['data' => null]);
+ $expected = new DataResponse(null);
$result = $ocs->createShare();
$this->assertInstanceOf(get_class($expected), $result);
}))
->will($this->returnArgument(0));
- $expected = new DataResponse(['data' => null]);
+ $expected = new DataResponse(null);
$result = $ocs->createShare();
$this->assertInstanceOf(get_class($expected), $result);
})
)->will($this->returnArgument(0));
- $expected = new DataResponse(['data' => null]);
+ $expected = new DataResponse(null);
$result = $ocs->createShare();
$this->assertInstanceOf(get_class($expected), $result);
})
)->will($this->returnArgument(0));
- $expected = new DataResponse(['data' => null]);
+ $expected = new DataResponse(null);
$result = $ocs->createShare();
$this->assertInstanceOf(get_class($expected), $result);
})
)->will($this->returnArgument(0));
- $expected = new DataResponse(['data' => null]);
+ $expected = new DataResponse(null);
$result = $ocs->createShare();
$this->assertInstanceOf(get_class($expected), $result);
})
)->will($this->returnArgument(0));
- $expected = new DataResponse(['data' => null]);
+ $expected = new DataResponse(null);
$result = $ocs->updateShare(42);
$this->assertInstanceOf(get_class($expected), $result);
})
)->will($this->returnArgument(0));
- $expected = new DataResponse(['data' => null]);
+ $expected = new DataResponse(null);
$result = $ocs->updateShare(42);
$this->assertInstanceOf(get_class($expected), $result);
})
)->will($this->returnArgument(0));
- $expected = new DataResponse(['data' => null]);
+ $expected = new DataResponse(null);
$result = $ocs->updateShare(42);
$this->assertInstanceOf(get_class($expected), $result);
})
)->will($this->returnArgument(0));
- $expected = new DataResponse(['data' => null]);
+ $expected = new DataResponse(null);
$result = $ocs->updateShare(42);
$this->assertInstanceOf(get_class($expected), $result);
})
)->will($this->returnArgument(0));
- $expected = new DataResponse(['data' => null]);
+ $expected = new DataResponse(null);
$result = $ocs->updateShare(42);
$this->assertInstanceOf(get_class($expected), $result);
})
)->will($this->returnArgument(0));
- $expected = new DataResponse(['data' => null]);
+ $expected = new DataResponse(null);
$result = $ocs->updateShare(42);
$this->assertInstanceOf(get_class($expected), $result);
$this->shareManager->method('getSharedWith')->willReturn([]);
- $expected = new DataResponse(['data' => null]);
+ $expected = new DataResponse(null);
$result = $ocs->updateShare(42);
$this->assertInstanceOf(get_class($expected), $result);
$this->shareManager->method('getSharedWith')->willReturn([]);
- $expected = new DataResponse(['data' => null]);
+ $expected = new DataResponse(null);
$result = $ocs->updateShare(42);
$this->assertInstanceOf(get_class($expected), $result);
$result = $ocs->createShare();
$ocs->cleanup();
- $data = $result->getData()['data'];
+ $data = $result->getData();
$this->assertEquals(19, $data['permissions']);
$this->assertEmpty($data['expiration']);
$result = $ocs->createShare();
$ocs->cleanup();
- $data = $result->getData()['data'];
+ $data = $result->getData();
$this->assertEquals(31, $data['permissions']);
$this->assertEmpty($data['expiration']);
$result = $ocs->createShare();
$ocs->cleanup();
- $data = $result->getData()['data'];
+ $data = $result->getData();
$this->assertEquals(19, $data['permissions']);
$this->assertEmpty($data['expiration']);
$result = $ocs->createShare();
$ocs->cleanup();
- $data = $result->getData()['data'];
+ $data = $result->getData();
$this->assertEquals(31, $data['permissions']);
$this->assertEmpty($data['expiration']);
$result = $ocs->createShare();
$ocs->cleanup();
- $data = $result->getData()['data'];
+ $data = $result->getData();
$this->assertEquals(1, $data['permissions']);
$this->assertEmpty($data['expiration']);
$this->assertTrue(is_string($data['token']));
$result = $ocs->createShare();
$ocs->cleanup();
- $data = $result->getData()['data'];
+ $data = $result->getData();
$this->assertEquals(
\OCP\Constants::PERMISSION_READ |
\OCP\Constants::PERMISSION_CREATE |
$result = $ocs->createShare();
$ocs->cleanup();
- $data = $result->getData()['data'];
+ $data = $result->getData();
// setting new password should succeed
$data2 = [
$result = $ocs->createShare();
$ocs->cleanup();
- $data = $result->getData()['data'];
+ $data = $result->getData();
$this->shareManager->getShareById('ocinternal:'.$data['id']);
$result = $ocs->createShare();
$ocs->cleanup();
- $data = $result->getData()['data'];
+ $data = $result->getData();
$this->shareManager->getShareById('ocinternal:' . $data['id']);
$result = $ocs->getShares();
$ocs->cleanup();
- $this->assertTrue(count($result->getData()['data']) === 1);
+ $this->assertTrue(count($result->getData()) === 1);
$this->shareManager->deleteShare($share);
}
$result = $ocs->getShares();
$ocs->cleanup();
- $this->assertTrue(count($result->getData()['data']) === 2);
+ $this->assertTrue(count($result->getData()) === 2);
$this->shareManager->deleteShare($share1);
$this->shareManager->deleteShare($share2);
$result = $ocs->createShare();
$ocs->cleanup();
- $data = $result->getData()['data'];
+ $data = $result->getData();
// check if we have a token
$this->assertTrue(is_string($data['token']));
$result = $ocs->getShares();
$ocs->cleanup();
- $data = $result->getData()['data'];
+ $data = $result->getData();
$this->assertEquals($url, current($data)['url']);
// check for path
$result = $ocs->getShares();
$ocs->cleanup();
- $data = $result->getData()['data'];
+ $data = $result->getData();
$this->assertEquals($url, current($data)['url']);
// check in share id
$result = $ocs->getShare($id);
$ocs->cleanup();
- $data = $result->getData()['data'];
+ $data = $result->getData();
$this->assertEquals($url, current($data)['url']);
$request = $this->createRequest([]);
$ocs->cleanup();
// test should return one share created from testCreateShare()
- $this->assertTrue(count($result->getData()['data']) === 2);
+ $this->assertTrue(count($result->getData()) === 2);
$this->shareManager->deleteShare($share1);
$this->shareManager->deleteShare($share2);
$ocs->cleanup();
// test should return one share
- $this->assertTrue(count($result->getData()['data']) === 1);
+ $this->assertTrue(count($result->getData()) === 1);
// now also ask for the reshares
$request = $this->createRequest(['path' => $this->filename, 'reshares' => 'true']);
$ocs->cleanup();
// now we should get two shares, the initial share and the reshare
- $this->assertCount(2, $result->getData()['data']);
+ $this->assertCount(2, $result->getData());
$this->shareManager->deleteShare($share1);
$this->shareManager->deleteShare($share2);
$ocs->cleanup();
// test should return one share created from testCreateShare()
- $this->assertEquals(1, count($result->getData()['data']));
+ $this->assertEquals(1, count($result->getData()));
$this->shareManager->deleteShare($share1);
}
$ocs->cleanup();
// test should return one share within $this->folder
- $this->assertTrue(count($result->getData()['data']) === 1);
+ $this->assertTrue(count($result->getData()) === 1);
$this->shareManager->deleteShare($share1);
$this->shareManager->deleteShare($share2);
$ocs->cleanup();
// test should return one share within $this->folder
- $data = $result->getData()['data'];
+ $data = $result->getData();
$this->assertEquals($value['expectedResult'], $data[0]['path']);
}
$ocs->cleanup();
// test should return one share within $this->folder
- $data = $result->getData()['data'];
+ $data = $result->getData();
// we should get exactly one result
$this->assertCount(1, $data);
$ocs->cleanup();
// test should return one share within $this->folder
- $data = $result->getData()['data'];
+ $data = $result->getData();
// we should get exactly one result
$this->assertCount(1, $data);
$ocs->cleanup();
// test should return one share within $this->folder
- $data = $result->getData()['data'];
+ $data = $result->getData();
// we should get exactly one result
$this->assertCount(1, $data);
$ocs->cleanup();
// test should return one share within $this->folder
- $data = $result->getData()['data'];
+ $data = $result->getData();
// we should get exactly one result
$this->assertCount(1, $data);
$ocs->cleanup();
// test should return one share within $this->folder
- $data1 = $result1->getData()['data'];
+ $data1 = $result1->getData();
$this->assertCount(1, $data1);
$s1 = reset($data1);
$ocs->cleanup();
// test should return one share within $this->folder
- $data2 = $result2->getData()['data'];
+ $data2 = $result2->getData();
$this->assertCount(1, $data2);
$s2 = reset($data2);
$ocs->cleanup();
// test should return one share within $this->folder
- $data = $result->getData()['data'];
+ $data = $result->getData();
// we should get exactly one result
$this->assertCount(1, $data);
}
$ocs->cleanup();
- $data = $result->getData()['data'];
+ $data = $result->getData();
$this->assertTrue(is_string($data['token']));
$this->assertEquals($date, substr($data['expiration'], 0, 10));
$result = $ocs->createShare();
$ocs->cleanup();
- $data = $result->getData()['data'];
+ $data = $result->getData();
$this->assertTrue(is_string($data['token']));
$this->assertEquals($date->format('Y-m-d') . ' 00:00:00', $data['expiration']);
$ocs = $this->createOCS($request, self::TEST_FILES_SHARING_API_USER1);
$result = $ocs->createShare();
$ocs->cleanup();
- $data = $result->getData()['data'];
+ $data = $result->getData();
$topId = $data['id'];
$result = $ocs->getShares();
$ocs->cleanup();
- $this->assertEmpty($result->getData()['data']);
+ $this->assertEmpty($result->getData());
}
/**
$ocs = $this->createOCS($request, self::TEST_FILES_SHARING_API_USER1);
$result = $ocs->createShare();
$ocs->cleanup();
- $data = $result->getData()['data'];
+ $data = $result->getData();
$topId = $data['id'];
$result = $ocs->getShares();
$ocs->cleanup();
- $this->assertEmpty($result->getData()['data']);
+ $this->assertEmpty($result->getData());
}
}