diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-12-04 19:51:04 +0100 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-12-19 15:20:24 +0100 |
commit | 24993280edcf66f9daa5a5e82428fefef4a3ab56 (patch) | |
tree | ede7ca0417af874185588a845fe5f7f754076f60 /tests/lib/updater.php | |
parent | f671b232cc122cdb8e993c8b35bd5419b32a9ae4 (diff) | |
download | nextcloud-server-24993280edcf66f9daa5a5e82428fefef4a3ab56.tar.gz nextcloud-server-24993280edcf66f9daa5a5e82428fefef4a3ab56.zip |
Next step in server-to-server sharing next generation, see #12285
Beside some small improvements and bug fixes this will probably the final state for OC8.
To test this you need to set up two ownCloud instances. Let's say:
URL: myPC/firstOwnCloud user: user1
URL: myPC/secondOwnCloud user: user2
Now user1 can share a file with user2 by entering the username and the URL to the second ownCloud to the share-drop-down, in this case "user2@myPC/secondOwnCloud".
The next time user2 login he will get a notification that he received a server-to-server share with the option to accept/decline it. If he accept it the share will be mounted. In both cases a event will be send back to user1 and add a notification to the activity stream that the share was accepted/declined.
If user1 decides to unshare the file again from user2 the share will automatically be removed from the second ownCloud server and user2 will see a notification in his activity stream that user1@myPC/firstOwnCloud has unshared the file/folder from him.
Diffstat (limited to 'tests/lib/updater.php')
-rw-r--r-- | tests/lib/updater.php | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/lib/updater.php b/tests/lib/updater.php index 2dab2750dcd..f847ffc91bf 100644 --- a/tests/lib/updater.php +++ b/tests/lib/updater.php @@ -30,30 +30,30 @@ class UpdaterTest extends \Test\TestCase { $updater = new Updater(\OC::$server->getHTTPHelper(), \OC::$server->getConfig()); $this->assertSame($result, $updater->isUpgradePossible($oldVersion, $newVersion)); } - + public function testBrokenXmlResponse(){ $invalidUpdater = $this->getUpdaterMock('OMG!'); $invalidResult = $invalidUpdater->check(); $this->assertEmpty($invalidResult); } - + public function testEmptyResponse(){ $emptyUpdater = $this->getUpdaterMock(''); $emptyResult = $emptyUpdater->check(); $this->assertEmpty($emptyResult); - + // Error while fetching new contents e.g. too many redirects $falseUpdater = $this->getUpdaterMock(false); $falseResult = $falseUpdater->check(); $this->assertEmpty($falseResult); } - + public function testValidEmptyXmlResponse(){ $updater = $this->getUpdaterMock( '<?xml version="1.0"?><owncloud><version></version><versionstring></versionstring><url></url><web></web></owncloud>' ); $result = array_map('strval', $updater->check()); - + $this->assertArrayHasKey('version', $result); $this->assertArrayHasKey('versionstring', $result); $this->assertArrayHasKey('url', $result); @@ -63,7 +63,7 @@ class UpdaterTest extends \Test\TestCase { $this->assertEmpty($result['url']); $this->assertEmpty($result['web']); } - + public function testValidUpdateResponse(){ $newUpdater = $this->getUpdaterMock( '<?xml version="1.0"?> @@ -75,7 +75,7 @@ class UpdaterTest extends \Test\TestCase { </owncloud>' ); $newResult = array_map('strval', $newUpdater->check()); - + $this->assertArrayHasKey('version', $newResult); $this->assertArrayHasKey('versionstring', $newResult); $this->assertArrayHasKey('url', $newResult); @@ -85,22 +85,22 @@ class UpdaterTest extends \Test\TestCase { $this->assertEquals('http://download.owncloud.org/community/owncloud-7.0.3.zip', $newResult['url']); $this->assertEquals('http://owncloud.org/', $newResult['web']); } - + protected function getUpdaterMock($content){ // Invalidate cache $mockedAppConfig = $this->getMockBuilder('\OC\AppConfig') ->disableOriginalConstructor() ->getMock() ; - + + $certificateManager = $this->getMock('\OCP\ICertificateManager'); $mockedHTTPHelper = $this->getMockBuilder('\OC\HTTPHelper') - ->setConstructorArgs(array(\OC::$server->getConfig())) + ->setConstructorArgs(array(\OC::$server->getConfig(), $certificateManager)) ->getMock() ; - - $mockedHTTPHelper->method('getUrlContent') - ->willReturn($content) - ; + + $mockedHTTPHelper->expects($this->once())->method('getUrlContent')->will($this->returnValue($content)); + return new Updater($mockedHTTPHelper, $mockedAppConfig); } |