[Pkg-owncloud-commits] [owncloud-doc] 86/270: udpate testing section

David Prévot taffit at moszumanska.debian.org
Thu Jul 31 03:53:04 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud-doc.

commit e9c66443576b61d11532fc194844d60f9a24bf37
Author: Bernhard Posselt <dev at bernhard-posselt.com>
Date:   Mon May 12 20:15:21 2014 +0200

    udpate testing section
---
 developer_manual/app/testing.rst | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/developer_manual/app/testing.rst b/developer_manual/app/testing.rst
index 820b4b3..77d7930 100644
--- a/developer_manual/app/testing.rst
+++ b/developer_manual/app/testing.rst
@@ -57,25 +57,28 @@ would look like this:
     class AuthorStorageTest extends \PHPUnit_Framework_TestCase {
 
         private $container;
+        private $storage;
 
         protected function setUp() {
             $app = new \OCA\MyApp\AppInfo\Application();
             $this->container = $notes->getContainer();
-            $this->container['RootStorage'] = $this->
-                getMockBuilder('\OCP\Files\Folder')->
-                disableOriginalConstructor()->
-                getMock();
+            $this->storage = $storage = $this->getMockBuilder('\OCP\Files\Folder')
+                ->disableOriginalConstructor()
+                ->getMock();
+
+            $this->container->registerService('RootStorage', function($c) use ($storage) {
+                return $storage;
+            });
         }
 
         /**
          * @expectedException \OCA\MyApp\Storage\StorageException
          */
         public function testFileNotFound() {
-            $this->container['RootStorage']->
-                expects($this->once())->
-                method('get')->
-                with($this->equalTo(3))->
-                will($this->throwException(new \OCP\Files\NotFoundException()));
+            $this->storage->expects($this->once())
+                ->method('get')
+                ->with($this->equalTo(3))
+                ->will($this->throwException(new \OCP\Files\NotFoundException()));
 
             $this->container['AuthorStorage']->getContent(3);
         }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-doc.git



More information about the Pkg-owncloud-commits mailing list