diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2015-12-03 21:53:58 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2015-12-09 14:34:23 +0100 |
commit | 8acbb7aef971912c445346423d342bb049190a1e (patch) | |
tree | cb25f3ff0c5b55900d0a32baa5302947f83c7085 /tests/lib/comments | |
parent | d3692c32837a54198f8f8a00713d93dd64db8e61 (diff) | |
download | nextcloud-server-8acbb7aef971912c445346423d342bb049190a1e.tar.gz nextcloud-server-8acbb7aef971912c445346423d342bb049190a1e.zip |
rework test about overwriting default comments manager
Diffstat (limited to 'tests/lib/comments')
-rw-r--r-- | tests/lib/comments/fakefactory.php | 21 | ||||
-rw-r--r-- | tests/lib/comments/fakemanager.php | 33 |
2 files changed, 36 insertions, 18 deletions
diff --git a/tests/lib/comments/fakefactory.php b/tests/lib/comments/fakefactory.php index 0fa68e4cb0c..837bcb10585 100644 --- a/tests/lib/comments/fakefactory.php +++ b/tests/lib/comments/fakefactory.php @@ -2,27 +2,12 @@ namespace Test\Comments; -use Test\TestCase; - /** - * Class Test_Comments_FakeFactory + * Class FakeFactory */ -class Test_Comments_FakeFactory extends TestCase implements \OCP\Comments\ICommentsManagerFactory { +class FakeFactory implements \OCP\Comments\ICommentsManagerFactory { public function getManager() { - return $this->getMock('\OCP\Comments\ICommentsManager'); - } - - public function testOverwriteDefaultManager() { - $config = \OC::$server->getConfig(); - $defaultManagerFactory = $config->getSystemValue('comments.managerFactory', '\OC\Comments\ManagerFactory'); - - $managerMock = $this->getMock('\OCP\Comments\ICommentsManager'); - - $config->setSystemValue('comments.managerFactory', '\Test\Comments\Test_Comments_FakeFactory'); - $manager = \OC::$server->getCommentsManager(); - $this->assertEquals($managerMock, $manager); - - $config->setSystemValue('comments.managerFactory', $defaultManagerFactory); + return new FakeManager(); } } diff --git a/tests/lib/comments/fakemanager.php b/tests/lib/comments/fakemanager.php new file mode 100644 index 00000000000..a3cd9c0c064 --- /dev/null +++ b/tests/lib/comments/fakemanager.php @@ -0,0 +1,33 @@ +<?php + +namespace Test\Comments; + +/** + * Class FakeManager + */ +class FakeManager implements \OCP\Comments\ICommentsManager { + + public function get($id) {} + + public function getTree($id, $limit = 0, $offset = 0) {} + + public function getForObject( + $objectType, + $objectId, + $limit = 0, + $offset = 0, + \DateTime $notOlderThan = null + ) {} + + public function getNumberOfCommentsForObject($objectType, $objectId) {} + + public function create($actorType, $actorId, $objectType, $objectId) {} + + public function delete($id) {} + + public function save(\OCP\Comments\IComment &$comment) {} + + public function deleteReferencesOfActor($actorType, $actorId) {} + + public function deleteCommentsAtObject($objectType, $objectId) {} +} |