diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2015-12-03 23:53:58 +0300 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2015-12-09 16:34:23 +0300 |
commit | 8acbb7aef971912c445346423d342bb049190a1e (patch) | |
tree | cb25f3ff0c5b55900d0a32baa5302947f83c7085 /tests | |
parent | d3692c32837a54198f8f8a00713d93dd64db8e61 (diff) |
rework test about overwriting default comments manager
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/comments/fakefactory.php | 21 | ||||
-rw-r--r-- | tests/lib/comments/fakemanager.php | 33 | ||||
-rw-r--r-- | tests/lib/server.php | 12 |
3 files changed, 48 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) {} +} diff --git a/tests/lib/server.php b/tests/lib/server.php index 0bee19822d2..6b569e77dd9 100644 --- a/tests/lib/server.php +++ b/tests/lib/server.php @@ -174,4 +174,16 @@ class Server extends \Test\TestCase { $this->assertInstanceOf('\OC_EventSource', $this->server->createEventSource(), 'service returned by "createEventSource" did not return the right class'); $this->assertInstanceOf('\OCP\IEventSource', $this->server->createEventSource(), 'service returned by "createEventSource" did not return the right class'); } + + public function testOverwriteDefaultCommentsManager() { + $config = $this->server->getConfig(); + $defaultManagerFactory = $config->getSystemValue('comments.managerFactory', '\OC\Comments\ManagerFactory'); + + $config->setSystemValue('comments.managerFactory', '\Test\Comments\FakeFactory'); + + $manager = $this->server->getCommentsManager(); + $this->assertInstanceOf('\OCP\Comments\ICommentsManager', $manager); + + $config->setSystemValue('comments.managerFactory', $defaultManagerFactory); + } } |