diff --git a/apps/files_sharing/tests/js/publicAppSpec.js b/apps/files_sharing/tests/js/publicAppSpec.js
index cedc51f98f1c1611f3cd4c265359baf58476bfd8..17b7ffc97989ee8761fe9116d3bc54922867a543 100644
--- a/apps/files_sharing/tests/js/publicAppSpec.js
+++ b/apps/files_sharing/tests/js/publicAppSpec.js
@@ -21,12 +21,13 @@
 
 describe('OCA.Sharing.PublicApp tests', function() {
 	var App = OCA.Sharing.PublicApp;
-	var hostStub, protocolStub, webrootStub;
+	var hostStub, portStub, protocolStub, webrootStub;
 	var $preview;
 
 	beforeEach(function() {
 		protocolStub = sinon.stub(OC, 'getProtocol').returns('https');
 		hostStub = sinon.stub(OC, 'getHost').returns('example.com');
+		portStub = sinon.stub(OC, 'getPort').returns(9876);
 		webrootStub = sinon.stub(OC, 'getRootPath').returns('/owncloud');
 		$preview = $('<div id="preview"></div>');
 		$('#testArea').append($preview);
@@ -40,6 +41,7 @@ describe('OCA.Sharing.PublicApp tests', function() {
 	afterEach(function() {
 		protocolStub.restore();
 		hostStub.restore();
+		portStub.restore();
 		webrootStub.restore();
 	});