2015-11-24 01:53:55 +03:00
|
|
|
<?php
|
|
|
|
|
2015-12-03 19:23:22 +03:00
|
|
|
namespace Test\Comments;
|
|
|
|
|
|
|
|
use Test\TestCase;
|
|
|
|
|
2015-11-24 01:53:55 +03:00
|
|
|
/**
|
|
|
|
* Class Test_Comments_FakeFactory
|
|
|
|
*/
|
2015-12-03 19:23:22 +03:00
|
|
|
class Test_Comments_FakeFactory extends TestCase implements \OCP\Comments\ICommentsManagerFactory {
|
2015-11-24 01:53:55 +03:00
|
|
|
|
|
|
|
public function getManager() {
|
|
|
|
return $this->getMock('\OCP\Comments\ICommentsManager');
|
|
|
|
}
|
2015-12-03 18:35:57 +03:00
|
|
|
|
|
|
|
public function testOverwriteDefaultManager() {
|
2015-12-03 19:19:40 +03:00
|
|
|
$config = \OC::$server->getConfig();
|
2015-12-03 18:35:57 +03:00
|
|
|
$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();
|
2015-12-03 18:35:57 +03:00
|
|
|
$this->assertEquals($managerMock, $manager);
|
|
|
|
|
|
|
|
$config->setSystemValue('comments.managerFactory', $defaultManagerFactory);
|
|
|
|
}
|
2015-11-24 01:53:55 +03:00
|
|
|
}
|