|
|
|
|
@ -34,6 +34,7 @@ use OC\Files\Storage\Wrapper\Quota;
|
|
|
|
|
use OCA\DAV\Connector\Sabre\Directory;
|
|
|
|
|
use OCP\Files\ForbiddenException;
|
|
|
|
|
use OCP\Files\Mount\IMountPoint;
|
|
|
|
|
use Test\Traits\UserTrait;
|
|
|
|
|
|
|
|
|
|
class TestViewDirectory extends \OC\Files\View {
|
|
|
|
|
private $updatables;
|
|
|
|
|
@ -73,6 +74,8 @@ class TestViewDirectory extends \OC\Files\View {
|
|
|
|
|
*/
|
|
|
|
|
class DirectoryTest extends \Test\TestCase {
|
|
|
|
|
|
|
|
|
|
use UserTrait;
|
|
|
|
|
|
|
|
|
|
/** @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject */
|
|
|
|
|
private $view;
|
|
|
|
|
/** @var \OC\Files\FileInfo | \PHPUnit\Framework\MockObject\MockObject */
|
|
|
|
|
@ -274,6 +277,8 @@ class DirectoryTest extends \Test\TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetQuotaInfoUnlimited() {
|
|
|
|
|
self::createUser('user', 'password');
|
|
|
|
|
self::loginAsUser('user');
|
|
|
|
|
$mountPoint = $this->createMock(IMountPoint::class);
|
|
|
|
|
$storage = $this->getMockBuilder(Quota::class)
|
|
|
|
|
->disableOriginalConstructor()
|
|
|
|
|
@ -288,6 +293,10 @@ class DirectoryTest extends \Test\TestCase {
|
|
|
|
|
'\OC\Files\Storage\Wrapper\Quota' => false,
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
$storage->expects($this->once())
|
|
|
|
|
->method('getOwner')
|
|
|
|
|
->willReturn('user');
|
|
|
|
|
|
|
|
|
|
$storage->expects($this->never())
|
|
|
|
|
->method('getQuota');
|
|
|
|
|
|
|
|
|
|
@ -311,6 +320,8 @@ class DirectoryTest extends \Test\TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetQuotaInfoSpecific() {
|
|
|
|
|
self::createUser('user', 'password');
|
|
|
|
|
self::loginAsUser('user');
|
|
|
|
|
$mountPoint = $this->createMock(IMountPoint::class);
|
|
|
|
|
$storage = $this->getMockBuilder(Quota::class)
|
|
|
|
|
->disableOriginalConstructor()
|
|
|
|
|
@ -325,6 +336,10 @@ class DirectoryTest extends \Test\TestCase {
|
|
|
|
|
['\OC\Files\Storage\Wrapper\Quota', true],
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
$storage->expects($this->once())
|
|
|
|
|
->method('getOwner')
|
|
|
|
|
->willReturn('user');
|
|
|
|
|
|
|
|
|
|
$storage->expects($this->once())
|
|
|
|
|
->method('getQuota')
|
|
|
|
|
->willReturn(1000);
|
|
|
|
|
|