]> source.dussan.org Git - nextcloud-server.git/commitdiff
PHPUnit 3.6 does not support @expectedException with the generic exception class
authorBart Visscher <bartv@thisnet.nl>
Fri, 12 Oct 2012 17:28:24 +0000 (19:28 +0200)
committerBart Visscher <bartv@thisnet.nl>
Fri, 12 Oct 2012 17:28:24 +0000 (19:28 +0200)
tests/lib/share/share.php

index 48d0270cc5712a1707723cbdc87a687c73b2b8bb..7f6784f8df7ca1f9e56ea00d96335e603ad4a5ba 100644 (file)
@@ -61,11 +61,13 @@ class Test_Share extends UnitTestCase {
                $query->execute(array('test'));
        }
 
-       /**
-        * @expectedException Exception
-        */
        public function testShareInvalidShareType() {
-               OCP\Share::shareItem('test', 'test.txt', 'foobar', $this->user2, OCP\Share::PERMISSION_READ);
+               $message = 'Share type foobar is not valid for test.txt';
+               try {
+                       OCP\Share::shareItem('test', 'test.txt', 'foobar', $this->user2, OCP\Share::PERMISSION_READ);
+               } catch (Exception $exception) {
+                       $this->assertEqual($exception->getMessage(), $message);
+               }
        }
 
        public function testInvalidItemType() {