nextcloud/tests/lib/comments/fakefactory.php

29 lines
837 B
PHP
Raw Normal View History

<?php
2015-12-03 19:23:22 +03:00
namespace Test\Comments;
use Test\TestCase;
/**
* Class Test_Comments_FakeFactory
*/
2015-12-03 19:23:22 +03:00
class Test_Comments_FakeFactory extends TestCase implements \OCP\Comments\ICommentsManagerFactory {
public function getManager() {
return $this->getMock('\OCP\Comments\ICommentsManager');
}
public function testOverwriteDefaultManager() {
2015-12-03 19:19:40 +03:00
$config = \OC::$server->getConfig();
$defaultManagerFactory = $config->getSystemValue('comments.managerFactory', '\OC\Comments\ManagerFactory');
$managerMock = $this->getMock('\OCP\Comments\ICommentsManager');
2015-12-03 19:23:22 +03:00
$config->setSystemValue('comments.managerFactory', '\Test\Comments\Test_Comments_FakeFactory');
2015-12-03 19:19:40 +03:00
$manager = \OC::$server->getCommentsManager();
$this->assertEquals($managerMock, $manager);
$config->setSystemValue('comments.managerFactory', $defaultManagerFactory);
}
}