2016-02-03 23:55:04 +03:00
|
|
|
<?php
|
|
|
|
/**
|
2016-07-21 17:49:16 +03:00
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
|
|
|
*
|
2020-03-31 11:49:10 +03:00
|
|
|
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
|
2016-07-21 17:49:16 +03:00
|
|
|
* @author Joas Schilling <coding@schilljs.com>
|
2017-11-06 17:56:42 +03:00
|
|
|
* @author Morris Jobke <hey@morrisjobke.de>
|
|
|
|
* @author Robin Appelman <robin@icewind.nl>
|
2016-07-21 17:49:16 +03:00
|
|
|
* @author Roeland Jago Douma <roeland@famdouma.nl>
|
2016-02-03 23:55:04 +03:00
|
|
|
* @author Vincent Petry <pvince81@owncloud.com>
|
|
|
|
*
|
|
|
|
* @license AGPL-3.0
|
|
|
|
*
|
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
2019-12-03 21:57:53 +03:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
2016-02-03 23:55:04 +03:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-05-25 17:04:15 +03:00
|
|
|
namespace OCA\DAV\Tests\unit\Connector\Sabre;
|
2016-02-03 23:55:04 +03:00
|
|
|
|
2019-11-22 22:52:10 +03:00
|
|
|
use OC\Files\View;
|
2017-10-24 16:26:53 +03:00
|
|
|
use OCA\DAV\Connector\Sabre\Directory;
|
2016-02-03 23:55:04 +03:00
|
|
|
use OCA\DAV\Connector\Sabre\FilesReportPlugin as FilesReportPluginImplementation;
|
2019-03-13 02:42:39 +03:00
|
|
|
use OCP\App\IAppManager;
|
2017-10-24 16:26:53 +03:00
|
|
|
use OCP\Files\File;
|
2019-11-22 22:52:10 +03:00
|
|
|
use OCP\Files\FileInfo;
|
|
|
|
use OCP\Files\Folder;
|
2017-10-24 16:26:53 +03:00
|
|
|
use OCP\IConfig;
|
2019-11-22 22:52:10 +03:00
|
|
|
use OCP\IGroupManager;
|
2016-07-26 14:15:12 +03:00
|
|
|
use OCP\IPreview;
|
2017-10-24 16:26:53 +03:00
|
|
|
use OCP\IRequest;
|
2016-09-12 18:09:46 +03:00
|
|
|
use OCP\ITagManager;
|
2019-11-22 22:52:10 +03:00
|
|
|
use OCP\ITags;
|
2017-10-24 16:26:53 +03:00
|
|
|
use OCP\IUser;
|
2016-09-12 18:09:46 +03:00
|
|
|
use OCP\IUserSession;
|
2017-10-25 01:03:28 +03:00
|
|
|
use OCP\SystemTag\ISystemTag;
|
2016-02-03 23:55:04 +03:00
|
|
|
use OCP\SystemTag\ISystemTagManager;
|
2019-11-22 22:52:10 +03:00
|
|
|
use OCP\SystemTag\ISystemTagObjectMapper;
|
2017-10-24 16:26:53 +03:00
|
|
|
use Sabre\DAV\INode;
|
|
|
|
use Sabre\DAV\Tree;
|
|
|
|
use Sabre\HTTP\ResponseInterface;
|
2016-02-03 23:55:04 +03:00
|
|
|
|
2016-05-25 17:04:15 +03:00
|
|
|
class FilesReportPluginTest extends \Test\TestCase {
|
2016-02-09 13:47:33 +03:00
|
|
|
/** @var \Sabre\DAV\Server|\PHPUnit_Framework_MockObject_MockObject */
|
2016-02-03 23:55:04 +03:00
|
|
|
private $server;
|
|
|
|
|
2016-02-09 13:47:33 +03:00
|
|
|
/** @var \Sabre\DAV\Tree|\PHPUnit_Framework_MockObject_MockObject */
|
2016-02-03 23:55:04 +03:00
|
|
|
private $tree;
|
|
|
|
|
2016-02-09 13:47:33 +03:00
|
|
|
/** @var ISystemTagObjectMapper|\PHPUnit_Framework_MockObject_MockObject */
|
2016-02-03 23:55:04 +03:00
|
|
|
private $tagMapper;
|
|
|
|
|
2016-02-09 13:47:33 +03:00
|
|
|
/** @var ISystemTagManager|\PHPUnit_Framework_MockObject_MockObject */
|
2016-02-03 23:55:04 +03:00
|
|
|
private $tagManager;
|
|
|
|
|
2016-09-12 18:09:46 +03:00
|
|
|
/** @var ITags|\PHPUnit_Framework_MockObject_MockObject */
|
|
|
|
private $privateTags;
|
|
|
|
|
2016-02-03 23:55:04 +03:00
|
|
|
/** @var \OCP\IUserSession */
|
|
|
|
private $userSession;
|
|
|
|
|
|
|
|
/** @var FilesReportPluginImplementation */
|
|
|
|
private $plugin;
|
|
|
|
|
2016-02-09 13:47:33 +03:00
|
|
|
/** @var View|\PHPUnit_Framework_MockObject_MockObject **/
|
2016-02-03 23:55:04 +03:00
|
|
|
private $view;
|
|
|
|
|
2016-02-09 13:47:33 +03:00
|
|
|
/** @var IGroupManager|\PHPUnit_Framework_MockObject_MockObject **/
|
2016-02-03 23:55:04 +03:00
|
|
|
private $groupManager;
|
|
|
|
|
2016-02-09 13:47:33 +03:00
|
|
|
/** @var Folder|\PHPUnit_Framework_MockObject_MockObject **/
|
2016-02-03 23:55:04 +03:00
|
|
|
private $userFolder;
|
|
|
|
|
2016-07-26 14:15:12 +03:00
|
|
|
/** @var IPreview|\PHPUnit_Framework_MockObject_MockObject * */
|
|
|
|
private $previewManager;
|
|
|
|
|
2019-03-13 02:42:39 +03:00
|
|
|
/** @var IAppManager|\PHPUnit_Framework_MockObject_MockObject * */
|
|
|
|
private $appManager;
|
|
|
|
|
2019-11-27 17:27:18 +03:00
|
|
|
protected function setUp(): void {
|
2016-02-03 23:55:04 +03:00
|
|
|
parent::setUp();
|
2017-10-24 16:26:53 +03:00
|
|
|
$this->tree = $this->getMockBuilder(Tree::class)
|
2016-02-03 23:55:04 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
|
|
|
|
2017-10-24 16:26:53 +03:00
|
|
|
$this->view = $this->getMockBuilder(View::class)
|
2016-02-03 23:55:04 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
|
|
|
|
|
|
|
$this->server = $this->getMockBuilder('\Sabre\DAV\Server')
|
|
|
|
->setConstructorArgs([$this->tree])
|
2016-10-04 17:08:22 +03:00
|
|
|
->setMethods(['getRequestUri', 'getBaseUri'])
|
2016-02-03 23:55:04 +03:00
|
|
|
->getMock();
|
|
|
|
|
2016-10-04 17:08:22 +03:00
|
|
|
$this->server->expects($this->any())
|
|
|
|
->method('getBaseUri')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn('http://example.com/owncloud/remote.php/dav');
|
2016-10-04 17:08:22 +03:00
|
|
|
|
2017-10-24 16:26:53 +03:00
|
|
|
$this->groupManager = $this->getMockBuilder(IGroupManager::class)
|
2016-02-03 23:55:04 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
|
|
|
|
2017-10-24 16:26:53 +03:00
|
|
|
$this->userFolder = $this->getMockBuilder(Folder::class)
|
2016-02-03 23:55:04 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
|
|
|
|
2017-10-24 16:26:53 +03:00
|
|
|
$this->previewManager = $this->getMockBuilder(IPreview::class)
|
2016-07-26 14:15:12 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
|
|
|
|
2019-03-13 02:42:39 +03:00
|
|
|
$this->appManager = $this->getMockBuilder(IAppManager::class)
|
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
|
|
|
|
2016-09-12 18:09:46 +03:00
|
|
|
$this->tagManager = $this->createMock(ISystemTagManager::class);
|
|
|
|
$this->tagMapper = $this->createMock(ISystemTagObjectMapper::class);
|
|
|
|
$this->userSession = $this->createMock(IUserSession::class);
|
|
|
|
$this->privateTags = $this->createMock(ITags::class);
|
|
|
|
$privateTagManager = $this->createMock(ITagManager::class);
|
|
|
|
$privateTagManager->expects($this->any())
|
|
|
|
->method('load')
|
|
|
|
->with('files')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn($this->privateTags);
|
2016-09-12 18:09:46 +03:00
|
|
|
|
2017-10-24 16:26:53 +03:00
|
|
|
$user = $this->getMockBuilder(IUser::class)
|
2016-07-15 10:52:46 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
2016-02-03 23:55:04 +03:00
|
|
|
$user->expects($this->any())
|
|
|
|
->method('getUID')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn('testuser');
|
2016-02-03 23:55:04 +03:00
|
|
|
$this->userSession->expects($this->any())
|
|
|
|
->method('getUser')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn($user);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
|
|
|
$this->plugin = new FilesReportPluginImplementation(
|
|
|
|
$this->tree,
|
|
|
|
$this->view,
|
|
|
|
$this->tagManager,
|
|
|
|
$this->tagMapper,
|
2016-09-12 18:09:46 +03:00
|
|
|
$privateTagManager,
|
2016-02-03 23:55:04 +03:00
|
|
|
$this->userSession,
|
|
|
|
$this->groupManager,
|
2019-03-13 02:42:39 +03:00
|
|
|
$this->userFolder,
|
|
|
|
$this->appManager
|
2016-02-03 23:55:04 +03:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testOnReportInvalidNode() {
|
|
|
|
$path = 'totally/unrelated/13';
|
|
|
|
|
|
|
|
$this->tree->expects($this->any())
|
|
|
|
->method('getNodeForPath')
|
|
|
|
->with('/' . $path)
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(
|
2017-10-24 16:26:53 +03:00
|
|
|
$this->getMockBuilder(INode::class)
|
2016-07-15 10:52:46 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock()
|
2020-03-26 00:21:27 +03:00
|
|
|
);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
|
|
|
$this->server->expects($this->any())
|
|
|
|
->method('getRequestUri')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn($path);
|
2016-02-03 23:55:04 +03:00
|
|
|
$this->plugin->initialize($this->server);
|
|
|
|
|
2016-10-04 17:08:22 +03:00
|
|
|
$this->assertNull($this->plugin->onReport(FilesReportPluginImplementation::REPORT_NAME, [], '/' . $path));
|
2016-02-03 23:55:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testOnReportInvalidReportName() {
|
|
|
|
$path = 'test';
|
|
|
|
|
|
|
|
$this->tree->expects($this->any())
|
|
|
|
->method('getNodeForPath')
|
|
|
|
->with('/' . $path)
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(
|
2017-10-24 16:26:53 +03:00
|
|
|
$this->getMockBuilder(INode::class)
|
2016-07-15 10:52:46 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock()
|
2020-03-26 00:21:27 +03:00
|
|
|
);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
|
|
|
$this->server->expects($this->any())
|
|
|
|
->method('getRequestUri')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn($path);
|
2016-02-03 23:55:04 +03:00
|
|
|
$this->plugin->initialize($this->server);
|
|
|
|
|
2016-10-04 17:08:22 +03:00
|
|
|
$this->assertNull($this->plugin->onReport('{whoever}whatever', [], '/' . $path));
|
2016-02-03 23:55:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testOnReport() {
|
|
|
|
$path = 'test';
|
|
|
|
|
|
|
|
$parameters = [
|
|
|
|
[
|
|
|
|
'name' => '{DAV:}prop',
|
|
|
|
'value' => [
|
|
|
|
['name' => '{DAV:}getcontentlength', 'value' => ''],
|
|
|
|
['name' => '{http://owncloud.org/ns}size', 'value' => ''],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => '{http://owncloud.org/ns}filter-rules',
|
|
|
|
'value' => [
|
|
|
|
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '123'],
|
|
|
|
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '456'],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
];
|
|
|
|
|
|
|
|
$this->groupManager->expects($this->any())
|
|
|
|
->method('isAdmin')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(true);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
|
|
|
$this->tagMapper->expects($this->at(0))
|
|
|
|
->method('getObjectIdsForTags')
|
|
|
|
->with('123', 'files')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(['111', '222']);
|
2016-02-03 23:55:04 +03:00
|
|
|
$this->tagMapper->expects($this->at(1))
|
|
|
|
->method('getObjectIdsForTags')
|
|
|
|
->with('456', 'files')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(['111', '222', '333']);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
2017-10-24 16:26:53 +03:00
|
|
|
$reportTargetNode = $this->getMockBuilder(Directory::class)
|
2016-02-03 23:55:04 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
|
|
|
|
2017-10-24 16:26:53 +03:00
|
|
|
$response = $this->getMockBuilder(ResponseInterface::class)
|
2016-02-03 23:55:04 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
|
|
|
|
|
|
|
$response->expects($this->once())
|
|
|
|
->method('setHeader')
|
|
|
|
->with('Content-Type', 'application/xml; charset=utf-8');
|
|
|
|
|
|
|
|
$response->expects($this->once())
|
|
|
|
->method('setStatus')
|
|
|
|
->with(207);
|
|
|
|
|
|
|
|
$response->expects($this->once())
|
|
|
|
->method('setBody');
|
|
|
|
|
|
|
|
$this->tree->expects($this->any())
|
|
|
|
->method('getNodeForPath')
|
|
|
|
->with('/' . $path)
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn($reportTargetNode);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
2017-10-24 16:26:53 +03:00
|
|
|
$filesNode1 = $this->getMockBuilder(Folder::class)
|
2016-02-03 23:55:04 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
2017-10-24 16:26:53 +03:00
|
|
|
$filesNode2 = $this->getMockBuilder(File::class)
|
2016-02-03 23:55:04 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
|
|
|
|
|
|
|
$this->userFolder->expects($this->at(0))
|
|
|
|
->method('getById')
|
|
|
|
->with('111')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn([$filesNode1]);
|
2016-02-03 23:55:04 +03:00
|
|
|
$this->userFolder->expects($this->at(1))
|
|
|
|
->method('getById')
|
|
|
|
->with('222')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn([$filesNode2]);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
|
|
|
$this->server->expects($this->any())
|
|
|
|
->method('getRequestUri')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn($path);
|
2016-02-03 23:55:04 +03:00
|
|
|
$this->server->httpResponse = $response;
|
|
|
|
$this->plugin->initialize($this->server);
|
|
|
|
|
2016-10-04 17:08:22 +03:00
|
|
|
$this->assertFalse($this->plugin->onReport(FilesReportPluginImplementation::REPORT_NAME, $parameters, '/' . $path));
|
2016-02-03 23:55:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testFindNodesByFileIdsRoot() {
|
2017-10-24 16:26:53 +03:00
|
|
|
$filesNode1 = $this->getMockBuilder(Folder::class)
|
2016-02-03 23:55:04 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
|
|
|
$filesNode1->expects($this->once())
|
|
|
|
->method('getName')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn('first node');
|
2016-02-03 23:55:04 +03:00
|
|
|
|
2017-10-24 16:26:53 +03:00
|
|
|
$filesNode2 = $this->getMockBuilder(File::class)
|
2016-02-03 23:55:04 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
|
|
|
$filesNode2->expects($this->once())
|
|
|
|
->method('getName')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn('second node');
|
2016-02-03 23:55:04 +03:00
|
|
|
|
2017-10-24 16:26:53 +03:00
|
|
|
$reportTargetNode = $this->getMockBuilder(Directory::class)
|
2016-02-03 23:55:04 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
|
|
|
$reportTargetNode->expects($this->any())
|
|
|
|
->method('getPath')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn('/');
|
2016-02-03 23:55:04 +03:00
|
|
|
|
|
|
|
$this->userFolder->expects($this->at(0))
|
|
|
|
->method('getById')
|
|
|
|
->with('111')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn([$filesNode1]);
|
2016-02-03 23:55:04 +03:00
|
|
|
$this->userFolder->expects($this->at(1))
|
|
|
|
->method('getById')
|
|
|
|
->with('222')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn([$filesNode2]);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
2016-02-09 13:47:33 +03:00
|
|
|
/** @var \OCA\DAV\Connector\Sabre\Directory|\PHPUnit_Framework_MockObject_MockObject $reportTargetNode */
|
2016-02-03 23:55:04 +03:00
|
|
|
$result = $this->plugin->findNodesByFileIds($reportTargetNode, ['111', '222']);
|
|
|
|
|
|
|
|
$this->assertCount(2, $result);
|
|
|
|
$this->assertInstanceOf('\OCA\DAV\Connector\Sabre\Directory', $result[0]);
|
|
|
|
$this->assertEquals('first node', $result[0]->getName());
|
|
|
|
$this->assertInstanceOf('\OCA\DAV\Connector\Sabre\File', $result[1]);
|
|
|
|
$this->assertEquals('second node', $result[1]->getName());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testFindNodesByFileIdsSubDir() {
|
2017-10-24 16:26:53 +03:00
|
|
|
$filesNode1 = $this->getMockBuilder(Folder::class)
|
2016-02-03 23:55:04 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
|
|
|
$filesNode1->expects($this->once())
|
|
|
|
->method('getName')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn('first node');
|
2016-02-03 23:55:04 +03:00
|
|
|
|
2017-10-24 16:26:53 +03:00
|
|
|
$filesNode2 = $this->getMockBuilder(File::class)
|
2016-02-03 23:55:04 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
|
|
|
$filesNode2->expects($this->once())
|
|
|
|
->method('getName')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn('second node');
|
2016-02-03 23:55:04 +03:00
|
|
|
|
2017-10-24 16:26:53 +03:00
|
|
|
$reportTargetNode = $this->getMockBuilder(Directory::class)
|
2016-02-03 23:55:04 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
|
|
|
$reportTargetNode->expects($this->any())
|
|
|
|
->method('getPath')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn('/sub1/sub2');
|
2016-02-03 23:55:04 +03:00
|
|
|
|
|
|
|
|
2017-10-24 16:26:53 +03:00
|
|
|
$subNode = $this->getMockBuilder(Folder::class)
|
2016-02-03 23:55:04 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
|
|
|
|
|
|
|
$this->userFolder->expects($this->at(0))
|
|
|
|
->method('get')
|
|
|
|
->with('/sub1/sub2')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn($subNode);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
|
|
|
$subNode->expects($this->at(0))
|
|
|
|
->method('getById')
|
|
|
|
->with('111')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn([$filesNode1]);
|
2016-02-03 23:55:04 +03:00
|
|
|
$subNode->expects($this->at(1))
|
|
|
|
->method('getById')
|
|
|
|
->with('222')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn([$filesNode2]);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
2016-02-09 13:47:33 +03:00
|
|
|
/** @var \OCA\DAV\Connector\Sabre\Directory|\PHPUnit_Framework_MockObject_MockObject $reportTargetNode */
|
2016-02-03 23:55:04 +03:00
|
|
|
$result = $this->plugin->findNodesByFileIds($reportTargetNode, ['111', '222']);
|
|
|
|
|
|
|
|
$this->assertCount(2, $result);
|
|
|
|
$this->assertInstanceOf('\OCA\DAV\Connector\Sabre\Directory', $result[0]);
|
|
|
|
$this->assertEquals('first node', $result[0]->getName());
|
|
|
|
$this->assertInstanceOf('\OCA\DAV\Connector\Sabre\File', $result[1]);
|
|
|
|
$this->assertEquals('second node', $result[1]->getName());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testPrepareResponses() {
|
|
|
|
$requestedProps = ['{DAV:}getcontentlength', '{http://owncloud.org/ns}fileid', '{DAV:}resourcetype'];
|
|
|
|
|
2017-02-24 13:56:29 +03:00
|
|
|
$fileInfo = $this->createMock(FileInfo::class);
|
|
|
|
$fileInfo->method('isReadable')->willReturn(true);
|
|
|
|
|
2017-10-24 16:26:53 +03:00
|
|
|
$node1 = $this->getMockBuilder(Directory::class)
|
2016-02-03 23:55:04 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
2017-10-24 16:26:53 +03:00
|
|
|
$node2 = $this->getMockBuilder(\OCA\DAV\Connector\Sabre\File::class)
|
2016-02-03 23:55:04 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
|
|
|
|
|
|
|
$node1->expects($this->once())
|
|
|
|
->method('getInternalFileId')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn('111');
|
2016-10-04 17:08:22 +03:00
|
|
|
$node1->expects($this->any())
|
|
|
|
->method('getPath')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn('/node1');
|
2017-02-24 13:56:29 +03:00
|
|
|
$node1->method('getFileInfo')->willReturn($fileInfo);
|
2016-02-03 23:55:04 +03:00
|
|
|
$node2->expects($this->once())
|
|
|
|
->method('getInternalFileId')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn('222');
|
2016-02-03 23:55:04 +03:00
|
|
|
$node2->expects($this->once())
|
|
|
|
->method('getSize')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(1024);
|
2016-10-04 17:08:22 +03:00
|
|
|
$node2->expects($this->any())
|
|
|
|
->method('getPath')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn('/sub/node2');
|
2017-02-24 13:56:29 +03:00
|
|
|
$node2->method('getFileInfo')->willReturn($fileInfo);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
2017-10-24 16:26:53 +03:00
|
|
|
$config = $this->getMockBuilder(IConfig::class)
|
2016-07-15 10:52:46 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
2016-04-18 12:18:50 +03:00
|
|
|
|
|
|
|
$this->server->addPlugin(
|
|
|
|
new \OCA\DAV\Connector\Sabre\FilesPlugin(
|
|
|
|
$this->tree,
|
2016-06-09 12:29:20 +03:00
|
|
|
$config,
|
2017-10-24 16:26:53 +03:00
|
|
|
$this->getMockBuilder(IRequest::class)
|
2016-07-15 10:52:46 +03:00
|
|
|
->disableOriginalConstructor()
|
2016-07-26 14:15:12 +03:00
|
|
|
->getMock(),
|
|
|
|
$this->previewManager
|
2016-04-18 12:18:50 +03:00
|
|
|
)
|
|
|
|
);
|
2016-02-03 23:55:04 +03:00
|
|
|
$this->plugin->initialize($this->server);
|
2016-10-04 17:08:22 +03:00
|
|
|
$responses = $this->plugin->prepareResponses('/files/username', $requestedProps, [$node1, $node2]);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
|
|
|
$this->assertCount(2, $responses);
|
|
|
|
|
|
|
|
$this->assertEquals(200, $responses[0]->getHttpStatus());
|
|
|
|
$this->assertEquals(200, $responses[1]->getHttpStatus());
|
|
|
|
|
2016-10-04 17:08:22 +03:00
|
|
|
$this->assertEquals('http://example.com/owncloud/remote.php/dav/files/username/node1', $responses[0]->getHref());
|
|
|
|
$this->assertEquals('http://example.com/owncloud/remote.php/dav/files/username/sub/node2', $responses[1]->getHref());
|
|
|
|
|
2016-02-03 23:55:04 +03:00
|
|
|
$props1 = $responses[0]->getResponseProperties();
|
|
|
|
$this->assertEquals('111', $props1[200]['{http://owncloud.org/ns}fileid']);
|
|
|
|
$this->assertNull($props1[404]['{DAV:}getcontentlength']);
|
|
|
|
$this->assertInstanceOf('\Sabre\DAV\Xml\Property\ResourceType', $props1[200]['{DAV:}resourcetype']);
|
|
|
|
$resourceType1 = $props1[200]['{DAV:}resourcetype']->getValue();
|
|
|
|
$this->assertEquals('{DAV:}collection', $resourceType1[0]);
|
|
|
|
|
|
|
|
$props2 = $responses[1]->getResponseProperties();
|
|
|
|
$this->assertEquals('1024', $props2[200]['{DAV:}getcontentlength']);
|
|
|
|
$this->assertEquals('222', $props2[200]['{http://owncloud.org/ns}fileid']);
|
|
|
|
$this->assertInstanceOf('\Sabre\DAV\Xml\Property\ResourceType', $props2[200]['{DAV:}resourcetype']);
|
|
|
|
$this->assertCount(0, $props2[200]['{DAV:}resourcetype']->getValue());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testProcessFilterRulesSingle() {
|
|
|
|
$this->groupManager->expects($this->any())
|
|
|
|
->method('isAdmin')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(true);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
2016-02-09 13:47:33 +03:00
|
|
|
$this->tagMapper->expects($this->exactly(1))
|
2016-02-03 23:55:04 +03:00
|
|
|
->method('getObjectIdsForTags')
|
2016-02-09 13:47:33 +03:00
|
|
|
->withConsecutive(
|
|
|
|
['123', 'files']
|
|
|
|
)
|
|
|
|
->willReturnMap([
|
2016-02-22 17:47:23 +03:00
|
|
|
['123', 'files', 0, '', ['111', '222']],
|
2016-02-09 13:47:33 +03:00
|
|
|
]);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
|
|
|
$rules = [
|
|
|
|
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '123'],
|
|
|
|
];
|
|
|
|
|
2016-02-22 17:26:59 +03:00
|
|
|
$this->assertEquals(['111', '222'], $this->invokePrivate($this->plugin, 'processFilterRules', [$rules]));
|
2016-02-03 23:55:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testProcessFilterRulesAndCondition() {
|
|
|
|
$this->groupManager->expects($this->any())
|
|
|
|
->method('isAdmin')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(true);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
2016-02-09 13:47:33 +03:00
|
|
|
$this->tagMapper->expects($this->exactly(2))
|
2016-02-03 23:55:04 +03:00
|
|
|
->method('getObjectIdsForTags')
|
2016-02-09 13:47:33 +03:00
|
|
|
->withConsecutive(
|
|
|
|
['123', 'files'],
|
|
|
|
['456', 'files']
|
|
|
|
)
|
|
|
|
->willReturnMap([
|
2016-02-22 17:47:23 +03:00
|
|
|
['123', 'files', 0, '', ['111', '222']],
|
|
|
|
['456', 'files', 0, '', ['222', '333']],
|
2016-02-09 13:47:33 +03:00
|
|
|
]);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
|
|
|
$rules = [
|
|
|
|
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '123'],
|
|
|
|
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '456'],
|
|
|
|
];
|
|
|
|
|
2016-02-22 17:26:59 +03:00
|
|
|
$this->assertEquals(['222'], array_values($this->invokePrivate($this->plugin, 'processFilterRules', [$rules])));
|
2016-02-03 23:55:04 +03:00
|
|
|
}
|
|
|
|
|
2016-02-09 13:39:22 +03:00
|
|
|
public function testProcessFilterRulesAndConditionWithOneEmptyResult() {
|
|
|
|
$this->groupManager->expects($this->any())
|
|
|
|
->method('isAdmin')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(true);
|
2016-02-09 13:39:22 +03:00
|
|
|
|
2016-02-09 13:47:33 +03:00
|
|
|
$this->tagMapper->expects($this->exactly(2))
|
2016-02-09 13:39:22 +03:00
|
|
|
->method('getObjectIdsForTags')
|
2016-02-09 13:47:33 +03:00
|
|
|
->withConsecutive(
|
|
|
|
['123', 'files'],
|
|
|
|
['456', 'files']
|
|
|
|
)
|
|
|
|
->willReturnMap([
|
2016-02-22 17:47:23 +03:00
|
|
|
['123', 'files', 0, '', ['111', '222']],
|
|
|
|
['456', 'files', 0, '', []],
|
2016-02-09 13:47:33 +03:00
|
|
|
]);
|
|
|
|
|
|
|
|
$rules = [
|
|
|
|
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '123'],
|
|
|
|
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '456'],
|
|
|
|
];
|
|
|
|
|
2016-02-22 17:26:59 +03:00
|
|
|
$this->assertEquals([], array_values($this->invokePrivate($this->plugin, 'processFilterRules', [$rules])));
|
2016-02-09 13:47:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testProcessFilterRulesAndConditionWithFirstEmptyResult() {
|
|
|
|
$this->groupManager->expects($this->any())
|
|
|
|
->method('isAdmin')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(true);
|
2016-02-09 13:47:33 +03:00
|
|
|
|
|
|
|
$this->tagMapper->expects($this->exactly(1))
|
|
|
|
->method('getObjectIdsForTags')
|
|
|
|
->withConsecutive(
|
|
|
|
['123', 'files'],
|
|
|
|
['456', 'files']
|
|
|
|
)
|
|
|
|
->willReturnMap([
|
2016-02-22 17:47:23 +03:00
|
|
|
['123', 'files', 0, '', []],
|
|
|
|
['456', 'files', 0, '', ['111', '222']],
|
2016-02-09 13:47:33 +03:00
|
|
|
]);
|
|
|
|
|
|
|
|
$rules = [
|
|
|
|
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '123'],
|
|
|
|
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '456'],
|
|
|
|
];
|
|
|
|
|
2016-02-22 17:26:59 +03:00
|
|
|
$this->assertEquals([], array_values($this->invokePrivate($this->plugin, 'processFilterRules', [$rules])));
|
2016-02-09 13:47:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testProcessFilterRulesAndConditionWithEmptyMidResult() {
|
|
|
|
$this->groupManager->expects($this->any())
|
|
|
|
->method('isAdmin')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(true);
|
2016-02-09 13:47:33 +03:00
|
|
|
|
|
|
|
$this->tagMapper->expects($this->exactly(2))
|
2016-02-09 13:39:22 +03:00
|
|
|
->method('getObjectIdsForTags')
|
2016-02-09 13:47:33 +03:00
|
|
|
->withConsecutive(
|
|
|
|
['123', 'files'],
|
|
|
|
['456', 'files'],
|
|
|
|
['789', 'files']
|
|
|
|
)
|
|
|
|
->willReturnMap([
|
2016-02-22 17:47:23 +03:00
|
|
|
['123', 'files', 0, '', ['111', '222']],
|
|
|
|
['456', 'files', 0, '', ['333']],
|
|
|
|
['789', 'files', 0, '', ['111', '222']],
|
2016-02-09 13:47:33 +03:00
|
|
|
]);
|
2016-02-09 13:39:22 +03:00
|
|
|
|
|
|
|
$rules = [
|
|
|
|
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '123'],
|
|
|
|
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '456'],
|
2016-02-09 13:47:33 +03:00
|
|
|
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '789'],
|
2016-02-09 13:39:22 +03:00
|
|
|
];
|
|
|
|
|
2016-02-22 17:26:59 +03:00
|
|
|
$this->assertEquals([], array_values($this->invokePrivate($this->plugin, 'processFilterRules', [$rules])));
|
2016-02-09 13:39:22 +03:00
|
|
|
}
|
|
|
|
|
2016-02-03 23:55:04 +03:00
|
|
|
public function testProcessFilterRulesInvisibleTagAsAdmin() {
|
|
|
|
$this->groupManager->expects($this->any())
|
|
|
|
->method('isAdmin')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(true);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
2017-10-25 01:03:28 +03:00
|
|
|
$tag1 = $this->getMockBuilder(ISystemTag::class)
|
2016-07-15 10:52:46 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
2016-02-03 23:55:04 +03:00
|
|
|
$tag1->expects($this->any())
|
|
|
|
->method('getId')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn('123');
|
2016-02-03 23:55:04 +03:00
|
|
|
$tag1->expects($this->any())
|
|
|
|
->method('isUserVisible')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(true);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
2017-10-25 01:03:28 +03:00
|
|
|
$tag2 = $this->getMockBuilder(ISystemTag::class)
|
2016-07-15 10:52:46 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
2016-02-03 23:55:04 +03:00
|
|
|
$tag2->expects($this->any())
|
|
|
|
->method('getId')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn('123');
|
2016-02-03 23:55:04 +03:00
|
|
|
$tag2->expects($this->any())
|
|
|
|
->method('isUserVisible')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(false);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
|
|
|
// no need to fetch tags to check permissions
|
|
|
|
$this->tagManager->expects($this->never())
|
|
|
|
->method('getTagsByIds');
|
|
|
|
|
|
|
|
$this->tagMapper->expects($this->at(0))
|
|
|
|
->method('getObjectIdsForTags')
|
|
|
|
->with('123')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(['111', '222']);
|
2016-02-03 23:55:04 +03:00
|
|
|
$this->tagMapper->expects($this->at(1))
|
|
|
|
->method('getObjectIdsForTags')
|
|
|
|
->with('456')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(['222', '333']);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
|
|
|
$rules = [
|
|
|
|
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '123'],
|
|
|
|
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '456'],
|
|
|
|
];
|
|
|
|
|
2016-02-22 17:26:59 +03:00
|
|
|
$this->assertEquals(['222'], array_values($this->invokePrivate($this->plugin, 'processFilterRules', [$rules])));
|
2016-02-03 23:55:04 +03:00
|
|
|
}
|
|
|
|
|
2019-11-27 17:27:18 +03:00
|
|
|
|
2016-02-03 23:55:04 +03:00
|
|
|
public function testProcessFilterRulesInvisibleTagAsUser() {
|
2019-11-27 17:27:18 +03:00
|
|
|
$this->expectException(\OCP\SystemTag\TagNotFoundException::class);
|
|
|
|
|
2016-02-03 23:55:04 +03:00
|
|
|
$this->groupManager->expects($this->any())
|
|
|
|
->method('isAdmin')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(false);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
2017-10-25 01:03:28 +03:00
|
|
|
$tag1 = $this->getMockBuilder(ISystemTag::class)
|
2016-07-15 10:52:46 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
2016-02-03 23:55:04 +03:00
|
|
|
$tag1->expects($this->any())
|
|
|
|
->method('getId')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn('123');
|
2016-02-03 23:55:04 +03:00
|
|
|
$tag1->expects($this->any())
|
|
|
|
->method('isUserVisible')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(true);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
2017-10-25 01:03:28 +03:00
|
|
|
$tag2 = $this->getMockBuilder(ISystemTag::class)
|
2016-07-15 10:52:46 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
2016-02-03 23:55:04 +03:00
|
|
|
$tag2->expects($this->any())
|
|
|
|
->method('getId')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn('123');
|
2016-02-03 23:55:04 +03:00
|
|
|
$tag2->expects($this->any())
|
|
|
|
->method('isUserVisible')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(false); // invisible
|
2016-02-03 23:55:04 +03:00
|
|
|
|
|
|
|
$this->tagManager->expects($this->once())
|
|
|
|
->method('getTagsByIds')
|
|
|
|
->with(['123', '456'])
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn([$tag1, $tag2]);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
|
|
|
$rules = [
|
|
|
|
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '123'],
|
|
|
|
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '456'],
|
|
|
|
];
|
|
|
|
|
2016-02-22 17:26:59 +03:00
|
|
|
$this->invokePrivate($this->plugin, 'processFilterRules', [$rules]);
|
2016-02-03 23:55:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testProcessFilterRulesVisibleTagAsUser() {
|
|
|
|
$this->groupManager->expects($this->any())
|
|
|
|
->method('isAdmin')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(false);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
2017-10-25 01:03:28 +03:00
|
|
|
$tag1 = $this->getMockBuilder(ISystemTag::class)
|
2016-07-15 10:52:46 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
2016-02-03 23:55:04 +03:00
|
|
|
$tag1->expects($this->any())
|
|
|
|
->method('getId')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn('123');
|
2016-02-03 23:55:04 +03:00
|
|
|
$tag1->expects($this->any())
|
|
|
|
->method('isUserVisible')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(true);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
2017-10-25 01:03:28 +03:00
|
|
|
$tag2 = $this->getMockBuilder(ISystemTag::class)
|
2016-07-15 10:52:46 +03:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
2016-02-03 23:55:04 +03:00
|
|
|
$tag2->expects($this->any())
|
|
|
|
->method('getId')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn('123');
|
2016-02-03 23:55:04 +03:00
|
|
|
$tag2->expects($this->any())
|
|
|
|
->method('isUserVisible')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(true);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
|
|
|
$this->tagManager->expects($this->once())
|
|
|
|
->method('getTagsByIds')
|
|
|
|
->with(['123', '456'])
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn([$tag1, $tag2]);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
|
|
|
$this->tagMapper->expects($this->at(0))
|
|
|
|
->method('getObjectIdsForTags')
|
|
|
|
->with('123')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(['111', '222']);
|
2016-02-03 23:55:04 +03:00
|
|
|
$this->tagMapper->expects($this->at(1))
|
|
|
|
->method('getObjectIdsForTags')
|
|
|
|
->with('456')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(['222', '333']);
|
2016-02-03 23:55:04 +03:00
|
|
|
|
|
|
|
$rules = [
|
|
|
|
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '123'],
|
|
|
|
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '456'],
|
|
|
|
];
|
|
|
|
|
2016-02-22 17:26:59 +03:00
|
|
|
$this->assertEquals(['222'], array_values($this->invokePrivate($this->plugin, 'processFilterRules', [$rules])));
|
2016-02-03 23:55:04 +03:00
|
|
|
}
|
2016-09-12 18:09:46 +03:00
|
|
|
|
|
|
|
public function testProcessFavoriteFilter() {
|
|
|
|
$rules = [
|
|
|
|
['name' => '{http://owncloud.org/ns}favorite', 'value' => '1'],
|
|
|
|
];
|
|
|
|
|
|
|
|
$this->privateTags->expects($this->once())
|
|
|
|
->method('getFavorites')
|
2020-03-26 00:21:27 +03:00
|
|
|
->willReturn(['456', '789']);
|
2016-09-12 18:09:46 +03:00
|
|
|
|
|
|
|
$this->assertEquals(['456', '789'], array_values($this->invokePrivate($this->plugin, 'processFilterRules', [$rules])));
|
|
|
|
}
|
2016-10-04 17:08:22 +03:00
|
|
|
|
|
|
|
public function filesBaseUriProvider() {
|
|
|
|
return [
|
|
|
|
['', '', ''],
|
|
|
|
['files/username', '', '/files/username'],
|
|
|
|
['files/username/test', '/test', '/files/username'],
|
|
|
|
['files/username/test/sub', '/test/sub', '/files/username'],
|
|
|
|
['test', '/test', ''],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider filesBaseUriProvider
|
|
|
|
*/
|
|
|
|
public function testFilesBaseUri($uri, $reportPath, $expectedUri) {
|
|
|
|
$this->assertEquals($expectedUri, $this->invokePrivate($this->plugin, 'getFilesBaseUri', [$uri, $reportPath]));
|
|
|
|
}
|
2016-02-03 23:55:04 +03:00
|
|
|
}
|