diff options
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/comments/fakefactory.php | 19 | ||||
-rw-r--r-- | tests/lib/comments/manager.php | 19 |
2 files changed, 16 insertions, 22 deletions
diff --git a/tests/lib/comments/fakefactory.php b/tests/lib/comments/fakefactory.php index 202b02f6411..cd85a4f34ca 100644 --- a/tests/lib/comments/fakefactory.php +++ b/tests/lib/comments/fakefactory.php @@ -10,13 +10,20 @@ */ class Test_Comments_FakeFactory extends Test\TestCase implements \OCP\Comments\ICommentsManagerFactory { - public function testNothing() { - // If there would not be at least one test, phpunit would scream failure - // So we have one and skip it. - $this->markTestSkipped(); - } - 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_FakeFactory'); + $manager = \oc::$server->getCommentsManager(); + $this->assertEquals($managerMock, $manager); + + $config->setSystemValue('comments.managerFactory', $defaultManagerFactory); + } } diff --git a/tests/lib/comments/manager.php b/tests/lib/comments/manager.php index 610dfe51a47..35a1c8a2af5 100644 --- a/tests/lib/comments/manager.php +++ b/tests/lib/comments/manager.php @@ -475,10 +475,10 @@ class Test_Comments_Manager extends Test\TestCase } public function testDeleteReferencesOfActorWithUserManagement() { - $user = \oc::$server->getUserManager()->createUser('xenia', '123456'); + $user = \OC::$server->getUserManager()->createUser('xenia', '123456'); $this->assertTrue($user instanceof \OCP\IUser); - $manager = $this->getManager(); + $manager = \OC::$server->getCommentsManager(); $comment = $manager->create('user', $user->getUID(), 'file', 'file64'); $comment ->setMessage('Most important comment I ever left on the Internet.') @@ -489,7 +489,7 @@ class Test_Comments_Manager extends Test\TestCase $commentID = $comment->getId(); $user->delete(); - $comment =$manager->get($commentID); + $comment = $manager->get($commentID); $this->assertSame($comment->getActorType(), \OCP\Comments\ICommentsManager::DELETED_USER); $this->assertSame($comment->getActorId(), \OCP\Comments\ICommentsManager::DELETED_USER); } @@ -544,17 +544,4 @@ class Test_Comments_Manager extends Test\TestCase $this->assertTrue($wasSuccessful); } - 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_FakeFactory'); - $manager = \oc::$server->getCommentsManager(); - $this->assertEquals($managerMock, $manager); - - $config->setSystemValue('comments.managerFactory', $defaultManagerFactory); - } - } |