Move the Share20OCS code over to use the proper DataResponse
This commit is contained in:
parent
1f370c97ed
commit
4006763f5b
|
@ -203,7 +203,7 @@ class Share20OCS extends OCSController {
|
||||||
if ($this->canAccessShare($share)) {
|
if ($this->canAccessShare($share)) {
|
||||||
try {
|
try {
|
||||||
$share = $this->formatShare($share);
|
$share = $this->formatShare($share);
|
||||||
return new DataResponse(['data' => [$share]]);
|
return new DataResponse([$share]);
|
||||||
} catch (NotFoundException $e) {
|
} catch (NotFoundException $e) {
|
||||||
//Fall trough
|
//Fall trough
|
||||||
}
|
}
|
||||||
|
@ -339,7 +339,7 @@ class Share20OCS extends OCSController {
|
||||||
*/
|
*/
|
||||||
$existingShares = $this->shareManager->getSharesBy($this->currentUser->getUID(), \OCP\Share::SHARE_TYPE_LINK, $path, false, 1, 0);
|
$existingShares = $this->shareManager->getSharesBy($this->currentUser->getUID(), \OCP\Share::SHARE_TYPE_LINK, $path, false, 1, 0);
|
||||||
if (!empty($existingShares)) {
|
if (!empty($existingShares)) {
|
||||||
return new DataResponse(['data' => $this->formatShare($existingShares[0])]);
|
return new DataResponse($this->formatShare($existingShares[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
$publicUpload = $this->request->getParam('publicUpload', null);
|
$publicUpload = $this->request->getParam('publicUpload', null);
|
||||||
|
@ -408,7 +408,7 @@ class Share20OCS extends OCSController {
|
||||||
|
|
||||||
$output = $this->formatShare($share);
|
$output = $this->formatShare($share);
|
||||||
|
|
||||||
return new DataResponse(['data' => $output]);
|
return new DataResponse($output);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -432,7 +432,7 @@ class Share20OCS extends OCSController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new DataResponse(['data' => $formatted]);
|
return new DataResponse($formatted);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -466,7 +466,7 @@ class Share20OCS extends OCSController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new DataResponse(['data' => $formatted]);
|
return new DataResponse($formatted);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -537,7 +537,7 @@ class Share20OCS extends OCSController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new DataResponse(['data' => $formatted]);
|
return new DataResponse($formatted);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -671,7 +671,7 @@ class Share20OCS extends OCSController {
|
||||||
throw new OCSBadRequestException($e->getMessage());
|
throw new OCSBadRequestException($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return new DataResponse(['data' => $this->formatShare($share)]);
|
return new DataResponse($this->formatShare($share));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
namespace OCA\Files_Sharing\Tests\API;
|
namespace OCA\Files_Sharing\Tests\API;
|
||||||
|
|
||||||
use OCP\AppFramework\Http\DataResponse;
|
use OCP\AppFramework\Http\DataResponse;
|
||||||
use OCP\AppFramework\OCS\OCSNotFoundException;
|
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCA\Files_Sharing\API\Share20OCS;
|
use OCA\Files_Sharing\API\Share20OCS;
|
||||||
use OCP\Files\NotFoundException;
|
use OCP\Files\NotFoundException;
|
||||||
|
@ -35,7 +34,6 @@ use OCP\IURLGenerator;
|
||||||
use OCP\IUser;
|
use OCP\IUser;
|
||||||
use OCP\Files\IRootFolder;
|
use OCP\Files\IRootFolder;
|
||||||
use OCP\Lock\LockedException;
|
use OCP\Lock\LockedException;
|
||||||
use Punic\Data;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Share20OCSTest
|
* Class Share20OCSTest
|
||||||
|
@ -485,7 +483,7 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
['group', $group],
|
['group', $group],
|
||||||
]));
|
]));
|
||||||
|
|
||||||
$this->assertEquals($result, $ocs->getShare($share->getId())->getData()['data'][0]);
|
$this->assertEquals($result, $ocs->getShare($share->getId())->getData()[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -706,6 +704,7 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
$share = $this->newShare();
|
$share = $this->newShare();
|
||||||
$this->shareManager->method('newShare')->willReturn($share);
|
$this->shareManager->method('newShare')->willReturn($share);
|
||||||
|
|
||||||
|
/** @var \OCA\Files_Sharing\API\Share20OCS $ocs */
|
||||||
$ocs = $this->getMockBuilder('OCA\Files_Sharing\API\Share20OCS')
|
$ocs = $this->getMockBuilder('OCA\Files_Sharing\API\Share20OCS')
|
||||||
->setConstructorArgs([
|
->setConstructorArgs([
|
||||||
$this->appName,
|
$this->appName,
|
||||||
|
@ -766,7 +765,7 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
}))
|
}))
|
||||||
->will($this->returnArgument(0));
|
->will($this->returnArgument(0));
|
||||||
|
|
||||||
$expected = new DataResponse(['data' => null]);
|
$expected = new DataResponse(null);
|
||||||
$result = $ocs->createShare();
|
$result = $ocs->createShare();
|
||||||
|
|
||||||
$this->assertInstanceOf(get_class($expected), $result);
|
$this->assertInstanceOf(get_class($expected), $result);
|
||||||
|
@ -879,7 +878,7 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
}))
|
}))
|
||||||
->will($this->returnArgument(0));
|
->will($this->returnArgument(0));
|
||||||
|
|
||||||
$expected = new DataResponse(['data' => null]);
|
$expected = new DataResponse(null);
|
||||||
$result = $ocs->createShare();
|
$result = $ocs->createShare();
|
||||||
|
|
||||||
$this->assertInstanceOf(get_class($expected), $result);
|
$this->assertInstanceOf(get_class($expected), $result);
|
||||||
|
@ -1049,7 +1048,7 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
})
|
})
|
||||||
)->will($this->returnArgument(0));
|
)->will($this->returnArgument(0));
|
||||||
|
|
||||||
$expected = new DataResponse(['data' => null]);
|
$expected = new DataResponse(null);
|
||||||
$result = $ocs->createShare();
|
$result = $ocs->createShare();
|
||||||
|
|
||||||
$this->assertInstanceOf(get_class($expected), $result);
|
$this->assertInstanceOf(get_class($expected), $result);
|
||||||
|
@ -1093,7 +1092,7 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
})
|
})
|
||||||
)->will($this->returnArgument(0));
|
)->will($this->returnArgument(0));
|
||||||
|
|
||||||
$expected = new DataResponse(['data' => null]);
|
$expected = new DataResponse(null);
|
||||||
$result = $ocs->createShare();
|
$result = $ocs->createShare();
|
||||||
|
|
||||||
$this->assertInstanceOf(get_class($expected), $result);
|
$this->assertInstanceOf(get_class($expected), $result);
|
||||||
|
@ -1140,7 +1139,7 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
})
|
})
|
||||||
)->will($this->returnArgument(0));
|
)->will($this->returnArgument(0));
|
||||||
|
|
||||||
$expected = new DataResponse(['data' => null]);
|
$expected = new DataResponse(null);
|
||||||
$result = $ocs->createShare();
|
$result = $ocs->createShare();
|
||||||
|
|
||||||
$this->assertInstanceOf(get_class($expected), $result);
|
$this->assertInstanceOf(get_class($expected), $result);
|
||||||
|
@ -1337,7 +1336,7 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
})
|
})
|
||||||
)->will($this->returnArgument(0));
|
)->will($this->returnArgument(0));
|
||||||
|
|
||||||
$expected = new DataResponse(['data' => null]);
|
$expected = new DataResponse(null);
|
||||||
$result = $ocs->updateShare(42);
|
$result = $ocs->updateShare(42);
|
||||||
|
|
||||||
$this->assertInstanceOf(get_class($expected), $result);
|
$this->assertInstanceOf(get_class($expected), $result);
|
||||||
|
@ -1377,7 +1376,7 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
})
|
})
|
||||||
)->will($this->returnArgument(0));
|
)->will($this->returnArgument(0));
|
||||||
|
|
||||||
$expected = new DataResponse(['data' => null]);
|
$expected = new DataResponse(null);
|
||||||
$result = $ocs->updateShare(42);
|
$result = $ocs->updateShare(42);
|
||||||
|
|
||||||
$this->assertInstanceOf(get_class($expected), $result);
|
$this->assertInstanceOf(get_class($expected), $result);
|
||||||
|
@ -1415,7 +1414,7 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
})
|
})
|
||||||
)->will($this->returnArgument(0));
|
)->will($this->returnArgument(0));
|
||||||
|
|
||||||
$expected = new DataResponse(['data' => null]);
|
$expected = new DataResponse(null);
|
||||||
$result = $ocs->updateShare(42);
|
$result = $ocs->updateShare(42);
|
||||||
|
|
||||||
$this->assertInstanceOf(get_class($expected), $result);
|
$this->assertInstanceOf(get_class($expected), $result);
|
||||||
|
@ -1562,7 +1561,7 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
})
|
})
|
||||||
)->will($this->returnArgument(0));
|
)->will($this->returnArgument(0));
|
||||||
|
|
||||||
$expected = new DataResponse(['data' => null]);
|
$expected = new DataResponse(null);
|
||||||
$result = $ocs->updateShare(42);
|
$result = $ocs->updateShare(42);
|
||||||
|
|
||||||
$this->assertInstanceOf(get_class($expected), $result);
|
$this->assertInstanceOf(get_class($expected), $result);
|
||||||
|
@ -1605,7 +1604,7 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
})
|
})
|
||||||
)->will($this->returnArgument(0));
|
)->will($this->returnArgument(0));
|
||||||
|
|
||||||
$expected = new DataResponse(['data' => null]);
|
$expected = new DataResponse(null);
|
||||||
$result = $ocs->updateShare(42);
|
$result = $ocs->updateShare(42);
|
||||||
|
|
||||||
$this->assertInstanceOf(get_class($expected), $result);
|
$this->assertInstanceOf(get_class($expected), $result);
|
||||||
|
@ -1645,7 +1644,7 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
})
|
})
|
||||||
)->will($this->returnArgument(0));
|
)->will($this->returnArgument(0));
|
||||||
|
|
||||||
$expected = new DataResponse(['data' => null]);
|
$expected = new DataResponse(null);
|
||||||
$result = $ocs->updateShare(42);
|
$result = $ocs->updateShare(42);
|
||||||
|
|
||||||
$this->assertInstanceOf(get_class($expected), $result);
|
$this->assertInstanceOf(get_class($expected), $result);
|
||||||
|
@ -1687,7 +1686,7 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
|
|
||||||
$this->shareManager->method('getSharedWith')->willReturn([]);
|
$this->shareManager->method('getSharedWith')->willReturn([]);
|
||||||
|
|
||||||
$expected = new DataResponse(['data' => null]);
|
$expected = new DataResponse(null);
|
||||||
$result = $ocs->updateShare(42);
|
$result = $ocs->updateShare(42);
|
||||||
|
|
||||||
$this->assertInstanceOf(get_class($expected), $result);
|
$this->assertInstanceOf(get_class($expected), $result);
|
||||||
|
@ -1754,7 +1753,7 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
|
|
||||||
$this->shareManager->method('getSharedWith')->willReturn([]);
|
$this->shareManager->method('getSharedWith')->willReturn([]);
|
||||||
|
|
||||||
$expected = new DataResponse(['data' => null]);
|
$expected = new DataResponse(null);
|
||||||
$result = $ocs->updateShare(42);
|
$result = $ocs->updateShare(42);
|
||||||
|
|
||||||
$this->assertInstanceOf(get_class($expected), $result);
|
$this->assertInstanceOf(get_class($expected), $result);
|
||||||
|
|
|
@ -140,7 +140,7 @@ class ApiTest extends TestCase {
|
||||||
$result = $ocs->createShare();
|
$result = $ocs->createShare();
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
$data = $result->getData()['data'];
|
$data = $result->getData();
|
||||||
$this->assertEquals(19, $data['permissions']);
|
$this->assertEquals(19, $data['permissions']);
|
||||||
$this->assertEmpty($data['expiration']);
|
$this->assertEmpty($data['expiration']);
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ class ApiTest extends TestCase {
|
||||||
$result = $ocs->createShare();
|
$result = $ocs->createShare();
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
$data = $result->getData()['data'];
|
$data = $result->getData();
|
||||||
$this->assertEquals(31, $data['permissions']);
|
$this->assertEquals(31, $data['permissions']);
|
||||||
$this->assertEmpty($data['expiration']);
|
$this->assertEmpty($data['expiration']);
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ class ApiTest extends TestCase {
|
||||||
$result = $ocs->createShare();
|
$result = $ocs->createShare();
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
$data = $result->getData()['data'];
|
$data = $result->getData();
|
||||||
$this->assertEquals(19, $data['permissions']);
|
$this->assertEquals(19, $data['permissions']);
|
||||||
$this->assertEmpty($data['expiration']);
|
$this->assertEmpty($data['expiration']);
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ class ApiTest extends TestCase {
|
||||||
$result = $ocs->createShare();
|
$result = $ocs->createShare();
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
$data = $result->getData()['data'];
|
$data = $result->getData();
|
||||||
$this->assertEquals(31, $data['permissions']);
|
$this->assertEquals(31, $data['permissions']);
|
||||||
$this->assertEmpty($data['expiration']);
|
$this->assertEmpty($data['expiration']);
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ class ApiTest extends TestCase {
|
||||||
$result = $ocs->createShare();
|
$result = $ocs->createShare();
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
$data = $result->getData()['data'];
|
$data = $result->getData();
|
||||||
$this->assertEquals(1, $data['permissions']);
|
$this->assertEquals(1, $data['permissions']);
|
||||||
$this->assertEmpty($data['expiration']);
|
$this->assertEmpty($data['expiration']);
|
||||||
$this->assertTrue(is_string($data['token']));
|
$this->assertTrue(is_string($data['token']));
|
||||||
|
@ -263,7 +263,7 @@ class ApiTest extends TestCase {
|
||||||
$result = $ocs->createShare();
|
$result = $ocs->createShare();
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
$data = $result->getData()['data'];
|
$data = $result->getData();
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
\OCP\Constants::PERMISSION_READ |
|
\OCP\Constants::PERMISSION_READ |
|
||||||
\OCP\Constants::PERMISSION_CREATE |
|
\OCP\Constants::PERMISSION_CREATE |
|
||||||
|
@ -332,7 +332,7 @@ class ApiTest extends TestCase {
|
||||||
$result = $ocs->createShare();
|
$result = $ocs->createShare();
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
$data = $result->getData()['data'];
|
$data = $result->getData();
|
||||||
|
|
||||||
// setting new password should succeed
|
// setting new password should succeed
|
||||||
$data2 = [
|
$data2 = [
|
||||||
|
@ -382,7 +382,7 @@ class ApiTest extends TestCase {
|
||||||
$result = $ocs->createShare();
|
$result = $ocs->createShare();
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
$data = $result->getData()['data'];
|
$data = $result->getData();
|
||||||
|
|
||||||
$this->shareManager->getShareById('ocinternal:'.$data['id']);
|
$this->shareManager->getShareById('ocinternal:'.$data['id']);
|
||||||
|
|
||||||
|
@ -405,7 +405,7 @@ class ApiTest extends TestCase {
|
||||||
$result = $ocs->createShare();
|
$result = $ocs->createShare();
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
$data = $result->getData()['data'];
|
$data = $result->getData();
|
||||||
|
|
||||||
$this->shareManager->getShareById('ocinternal:' . $data['id']);
|
$this->shareManager->getShareById('ocinternal:' . $data['id']);
|
||||||
|
|
||||||
|
@ -453,7 +453,7 @@ class ApiTest extends TestCase {
|
||||||
$result = $ocs->getShares();
|
$result = $ocs->getShares();
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
$this->assertTrue(count($result->getData()['data']) === 1);
|
$this->assertTrue(count($result->getData()) === 1);
|
||||||
|
|
||||||
$this->shareManager->deleteShare($share);
|
$this->shareManager->deleteShare($share);
|
||||||
}
|
}
|
||||||
|
@ -482,7 +482,7 @@ class ApiTest extends TestCase {
|
||||||
$result = $ocs->getShares();
|
$result = $ocs->getShares();
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
$this->assertTrue(count($result->getData()['data']) === 2);
|
$this->assertTrue(count($result->getData()) === 2);
|
||||||
|
|
||||||
$this->shareManager->deleteShare($share1);
|
$this->shareManager->deleteShare($share1);
|
||||||
$this->shareManager->deleteShare($share2);
|
$this->shareManager->deleteShare($share2);
|
||||||
|
@ -501,7 +501,7 @@ class ApiTest extends TestCase {
|
||||||
$result = $ocs->createShare();
|
$result = $ocs->createShare();
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
$data = $result->getData()['data'];
|
$data = $result->getData();
|
||||||
|
|
||||||
// check if we have a token
|
// check if we have a token
|
||||||
$this->assertTrue(is_string($data['token']));
|
$this->assertTrue(is_string($data['token']));
|
||||||
|
@ -517,7 +517,7 @@ class ApiTest extends TestCase {
|
||||||
$result = $ocs->getShares();
|
$result = $ocs->getShares();
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
$data = $result->getData()['data'];
|
$data = $result->getData();
|
||||||
$this->assertEquals($url, current($data)['url']);
|
$this->assertEquals($url, current($data)['url']);
|
||||||
|
|
||||||
// check for path
|
// check for path
|
||||||
|
@ -526,7 +526,7 @@ class ApiTest extends TestCase {
|
||||||
$result = $ocs->getShares();
|
$result = $ocs->getShares();
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
$data = $result->getData()['data'];
|
$data = $result->getData();
|
||||||
$this->assertEquals($url, current($data)['url']);
|
$this->assertEquals($url, current($data)['url']);
|
||||||
|
|
||||||
// check in share id
|
// check in share id
|
||||||
|
@ -535,7 +535,7 @@ class ApiTest extends TestCase {
|
||||||
$result = $ocs->getShare($id);
|
$result = $ocs->getShare($id);
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
$data = $result->getData()['data'];
|
$data = $result->getData();
|
||||||
$this->assertEquals($url, current($data)['url']);
|
$this->assertEquals($url, current($data)['url']);
|
||||||
|
|
||||||
$request = $this->createRequest([]);
|
$request = $this->createRequest([]);
|
||||||
|
@ -572,7 +572,7 @@ class ApiTest extends TestCase {
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
// test should return one share created from testCreateShare()
|
// 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($share1);
|
||||||
$this->shareManager->deleteShare($share2);
|
$this->shareManager->deleteShare($share2);
|
||||||
|
@ -607,7 +607,7 @@ class ApiTest extends TestCase {
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
// test should return one share
|
// test should return one share
|
||||||
$this->assertTrue(count($result->getData()['data']) === 1);
|
$this->assertTrue(count($result->getData()) === 1);
|
||||||
|
|
||||||
// now also ask for the reshares
|
// now also ask for the reshares
|
||||||
$request = $this->createRequest(['path' => $this->filename, 'reshares' => 'true']);
|
$request = $this->createRequest(['path' => $this->filename, 'reshares' => 'true']);
|
||||||
|
@ -616,7 +616,7 @@ class ApiTest extends TestCase {
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
// now we should get two shares, the initial share and the reshare
|
// 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($share1);
|
||||||
$this->shareManager->deleteShare($share2);
|
$this->shareManager->deleteShare($share2);
|
||||||
|
@ -643,7 +643,7 @@ class ApiTest extends TestCase {
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
// test should return one share created from testCreateShare()
|
// 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);
|
$this->shareManager->deleteShare($share1);
|
||||||
}
|
}
|
||||||
|
@ -676,7 +676,7 @@ class ApiTest extends TestCase {
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
// test should return one share within $this->folder
|
// 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($share1);
|
||||||
$this->shareManager->deleteShare($share2);
|
$this->shareManager->deleteShare($share2);
|
||||||
|
@ -749,7 +749,7 @@ class ApiTest extends TestCase {
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
// test should return one share within $this->folder
|
// test should return one share within $this->folder
|
||||||
$data = $result->getData()['data'];
|
$data = $result->getData();
|
||||||
|
|
||||||
$this->assertEquals($value['expectedResult'], $data[0]['path']);
|
$this->assertEquals($value['expectedResult'], $data[0]['path']);
|
||||||
}
|
}
|
||||||
|
@ -788,7 +788,7 @@ class ApiTest extends TestCase {
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
// test should return one share within $this->folder
|
// test should return one share within $this->folder
|
||||||
$data = $result->getData()['data'];
|
$data = $result->getData();
|
||||||
|
|
||||||
// we should get exactly one result
|
// we should get exactly one result
|
||||||
$this->assertCount(1, $data);
|
$this->assertCount(1, $data);
|
||||||
|
@ -838,7 +838,7 @@ class ApiTest extends TestCase {
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
// test should return one share within $this->folder
|
// test should return one share within $this->folder
|
||||||
$data = $result->getData()['data'];
|
$data = $result->getData();
|
||||||
|
|
||||||
// we should get exactly one result
|
// we should get exactly one result
|
||||||
$this->assertCount(1, $data);
|
$this->assertCount(1, $data);
|
||||||
|
@ -853,7 +853,7 @@ class ApiTest extends TestCase {
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
// test should return one share within $this->folder
|
// test should return one share within $this->folder
|
||||||
$data = $result->getData()['data'];
|
$data = $result->getData();
|
||||||
|
|
||||||
// we should get exactly one result
|
// we should get exactly one result
|
||||||
$this->assertCount(1, $data);
|
$this->assertCount(1, $data);
|
||||||
|
@ -868,7 +868,7 @@ class ApiTest extends TestCase {
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
// test should return one share within $this->folder
|
// test should return one share within $this->folder
|
||||||
$data = $result->getData()['data'];
|
$data = $result->getData();
|
||||||
|
|
||||||
// we should get exactly one result
|
// we should get exactly one result
|
||||||
$this->assertCount(1, $data);
|
$this->assertCount(1, $data);
|
||||||
|
@ -915,7 +915,7 @@ class ApiTest extends TestCase {
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
// test should return one share within $this->folder
|
// test should return one share within $this->folder
|
||||||
$data1 = $result1->getData()['data'];
|
$data1 = $result1->getData();
|
||||||
$this->assertCount(1, $data1);
|
$this->assertCount(1, $data1);
|
||||||
$s1 = reset($data1);
|
$s1 = reset($data1);
|
||||||
|
|
||||||
|
@ -925,7 +925,7 @@ class ApiTest extends TestCase {
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
// test should return one share within $this->folder
|
// test should return one share within $this->folder
|
||||||
$data2 = $result2->getData()['data'];
|
$data2 = $result2->getData();
|
||||||
$this->assertCount(1, $data2);
|
$this->assertCount(1, $data2);
|
||||||
$s2 = reset($data2);
|
$s2 = reset($data2);
|
||||||
|
|
||||||
|
@ -976,7 +976,7 @@ class ApiTest extends TestCase {
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
// test should return one share within $this->folder
|
// test should return one share within $this->folder
|
||||||
$data = $result->getData()['data'];
|
$data = $result->getData();
|
||||||
|
|
||||||
// we should get exactly one result
|
// we should get exactly one result
|
||||||
$this->assertCount(1, $data);
|
$this->assertCount(1, $data);
|
||||||
|
@ -1491,7 +1491,7 @@ class ApiTest extends TestCase {
|
||||||
}
|
}
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
$data = $result->getData()['data'];
|
$data = $result->getData();
|
||||||
$this->assertTrue(is_string($data['token']));
|
$this->assertTrue(is_string($data['token']));
|
||||||
$this->assertEquals($date, substr($data['expiration'], 0, 10));
|
$this->assertEquals($date, substr($data['expiration'], 0, 10));
|
||||||
|
|
||||||
|
@ -1525,7 +1525,7 @@ class ApiTest extends TestCase {
|
||||||
$result = $ocs->createShare();
|
$result = $ocs->createShare();
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
$data = $result->getData()['data'];
|
$data = $result->getData();
|
||||||
$this->assertTrue(is_string($data['token']));
|
$this->assertTrue(is_string($data['token']));
|
||||||
$this->assertEquals($date->format('Y-m-d') . ' 00:00:00', $data['expiration']);
|
$this->assertEquals($date->format('Y-m-d') . ' 00:00:00', $data['expiration']);
|
||||||
|
|
||||||
|
@ -1613,7 +1613,7 @@ class ApiTest extends TestCase {
|
||||||
$ocs = $this->createOCS($request, self::TEST_FILES_SHARING_API_USER1);
|
$ocs = $this->createOCS($request, self::TEST_FILES_SHARING_API_USER1);
|
||||||
$result = $ocs->createShare();
|
$result = $ocs->createShare();
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
$data = $result->getData()['data'];
|
$data = $result->getData();
|
||||||
|
|
||||||
$topId = $data['id'];
|
$topId = $data['id'];
|
||||||
|
|
||||||
|
@ -1637,7 +1637,7 @@ class ApiTest extends TestCase {
|
||||||
$result = $ocs->getShares();
|
$result = $ocs->getShares();
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
$this->assertEmpty($result->getData()['data']);
|
$this->assertEmpty($result->getData());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1654,7 +1654,7 @@ class ApiTest extends TestCase {
|
||||||
$ocs = $this->createOCS($request, self::TEST_FILES_SHARING_API_USER1);
|
$ocs = $this->createOCS($request, self::TEST_FILES_SHARING_API_USER1);
|
||||||
$result = $ocs->createShare();
|
$result = $ocs->createShare();
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
$data = $result->getData()['data'];
|
$data = $result->getData();
|
||||||
|
|
||||||
$topId = $data['id'];
|
$topId = $data['id'];
|
||||||
|
|
||||||
|
@ -1678,6 +1678,6 @@ class ApiTest extends TestCase {
|
||||||
$result = $ocs->getShares();
|
$result = $ocs->getShares();
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
|
||||||
$this->assertEmpty($result->getData()['data']);
|
$this->assertEmpty($result->getData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue