fix plugin test

This commit is contained in:
Thomas Citharel 2016-07-20 14:26:24 +02:00 committed by Lukas Reschke
parent 77216e7ca9
commit de5e212694
No known key found for this signature in database
GPG Key ID: B9F6980CF6E759B1
1 changed files with 15 additions and 3 deletions

View File

@ -6,6 +6,8 @@ use OCA\DAV\CalDAV\Calendar;
use OCA\DAV\CalDAV\Publishing\PublishPlugin; use OCA\DAV\CalDAV\Publishing\PublishPlugin;
use OCA\DAV\Connector\Sabre\Auth; use OCA\DAV\Connector\Sabre\Auth;
use OCP\IRequest; use OCP\IRequest;
use OCP\IURLGenerator;
use OCP\IConfig;
use Sabre\DAV\Server; use Sabre\DAV\Server;
use Sabre\DAV\SimpleCollection; use Sabre\DAV\SimpleCollection;
use Sabre\HTTP\Request; use Sabre\HTTP\Request;
@ -14,12 +16,16 @@ use Test\TestCase;
class PluginTest extends TestCase { class PluginTest extends TestCase {
/** @var Plugin */ /** @var PublishPlugin */
private $plugin; private $plugin;
/** @var Server */ /** @var Server */
private $server; private $server;
/** @var Calendar | \PHPUnit_Framework_MockObject_MockObject */ /** @var Calendar | \PHPUnit_Framework_MockObject_MockObject */
private $book; private $book;
/** @var IConfig | \PHPUnit_Framework_MockObject_MockObject */
private $config;
/** @var IURLGenerator | \PHPUnit_Framework_MockObject_MockObject */
private $urlGenerator;
public function setUp() { public function setUp() {
parent::setUp(); parent::setUp();
@ -28,9 +34,15 @@ class PluginTest extends TestCase {
$authBackend = $this->getMockBuilder('OCA\DAV\DAV\PublicAuth')->disableOriginalConstructor()->getMock(); $authBackend = $this->getMockBuilder('OCA\DAV\DAV\PublicAuth')->disableOriginalConstructor()->getMock();
$authBackend->method('isDavAuthenticated')->willReturn(true); $authBackend->method('isDavAuthenticated')->willReturn(true);
$this->config = $this->getMock('\OCP\IConfig');
$this->config->expects($this->any())->method('getSystemValue')
->with($this->equalTo('secret'))
->willReturn('mysecret');
$this->urlGenerator = $this->getMock('OCP\IURLGenerator');
/** @var IRequest $request */ /** @var IRequest $request */
$request = $this->getMockBuilder('OCP\IRequest')->disableOriginalConstructor()->getMock(); $this->plugin = new PublishPlugin($this->config, $this->urlGenerator);
$this->plugin = new PublishPlugin($authBackend, $request);
$root = new SimpleCollection('calendars'); $root = new SimpleCollection('calendars');
$this->server = new Server($root); $this->server = new Server($root);