diff options
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php | 9 | ||||
-rw-r--r-- | tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php | 84 | ||||
-rw-r--r-- | tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php | 22 | ||||
-rw-r--r-- | tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php | 21 | ||||
-rw-r--r-- | tests/lib/Files/ViewTest.php | 5 | ||||
-rw-r--r-- | tests/lib/Share20/ManagerTest.php | 47 | ||||
-rw-r--r-- | tests/lib/Updater/VersionCheckTest.php | 12 | ||||
-rw-r--r-- | tests/lib/Util/User/Dummy.php | 6 | ||||
-rw-r--r-- | tests/lib/UtilTest.php | 2 |
9 files changed, 124 insertions, 84 deletions
diff --git a/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php index 2b7a79bae2f..9eca127cb89 100644 --- a/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php +++ b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php @@ -26,6 +26,7 @@ namespace Test\AppFramework\Middleware; use OC\AppFramework\Http\Request; use OC\AppFramework\Middleware\MiddlewareDispatcher; +use OCP\AppFramework\Controller; use OCP\AppFramework\Middleware; use OCP\AppFramework\Http\Response; @@ -61,7 +62,7 @@ class TestMiddleware extends Middleware { $this->beforeControllerThrowsEx = $beforeControllerThrowsEx; } - public function beforeController($controller, $methodName){ + public function beforeController(Controller $controller, $methodName){ self::$beforeControllerCalled++; $this->beforeControllerOrder = self::$beforeControllerCalled; $this->controller = $controller; @@ -71,7 +72,7 @@ class TestMiddleware extends Middleware { } } - public function afterException($controller, $methodName, \Exception $exception){ + public function afterException(Controller $controller, $methodName, \Exception $exception){ self::$afterExceptionCalled++; $this->afterExceptionOrder = self::$afterExceptionCalled; $this->controller = $controller; @@ -80,7 +81,7 @@ class TestMiddleware extends Middleware { parent::afterException($controller, $methodName, $exception); } - public function afterController($controller, $methodName, Response $response){ + public function afterController(Controller $controller, $methodName, Response $response){ self::$afterControllerCalled++; $this->afterControllerOrder = self::$afterControllerCalled; $this->controller = $controller; @@ -89,7 +90,7 @@ class TestMiddleware extends Middleware { return parent::afterController($controller, $methodName, $response); } - public function beforeOutput($controller, $methodName, $output){ + public function beforeOutput(Controller $controller, $methodName, $output){ self::$beforeOutputCalled++; $this->beforeOutputOrder = self::$beforeOutputCalled; $this->controller = $controller; diff --git a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php index d0096d43f3d..498eaed8949 100644 --- a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php @@ -17,26 +17,30 @@ use OC\AppFramework\Middleware\Security\CORSMiddleware; use OC\AppFramework\Utility\ControllerMethodReflector; use OC\AppFramework\Middleware\Security\Exceptions\SecurityException; use OC\Security\Bruteforce\Throttler; +use OC\User\Session; +use OCP\AppFramework\Controller; use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\Response; - +use OCP\IConfig; +use OCP\Security\ISecureRandom; class CORSMiddlewareTest extends \Test\TestCase { + /** @var ControllerMethodReflector */ private $reflector; + /** @var Session|\PHPUnit_Framework_MockObject_MockObject */ private $session; /** @var Throttler */ private $throttler; + /** @var Controller */ + private $controller; protected function setUp() { parent::setUp(); $this->reflector = new ControllerMethodReflector(); - $this->session = $this->getMockBuilder('\OC\User\Session') - ->disableOriginalConstructor() - ->getMock(); - $this->throttler = $this->getMockBuilder('\OC\Security\Bruteforce\Throttler') - ->disableOriginalConstructor() - ->getMock(); + $this->session = $this->createMock(Session::class); + $this->throttler = $this->createMock(Throttler::class); + $this->controller = $this->createMock(Controller::class); } /** @@ -49,13 +53,13 @@ class CORSMiddlewareTest extends \Test\TestCase { 'HTTP_ORIGIN' => 'test' ] ], - $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(), - $this->getMockBuilder('\OCP\IConfig')->getMock() + $this->createMock(ISecureRandom::class), + $this->createMock(IConfig::class) ); $this->reflector->reflect($this, __FUNCTION__); $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler); - $response = $middleware->afterController($this, __FUNCTION__, new Response()); + $response = $middleware->afterController($this->controller, __FUNCTION__, new Response()); $headers = $response->getHeaders(); $this->assertEquals('test', $headers['Access-Control-Allow-Origin']); } @@ -68,12 +72,12 @@ class CORSMiddlewareTest extends \Test\TestCase { 'HTTP_ORIGIN' => 'test' ] ], - $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(), - $this->getMockBuilder('\OCP\IConfig')->getMock() + $this->createMock(ISecureRandom::class), + $this->createMock(IConfig::class) ); $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler); - $response = $middleware->afterController($this, __FUNCTION__, new Response()); + $response = $middleware->afterController($this->controller, __FUNCTION__, new Response()); $headers = $response->getHeaders(); $this->assertFalse(array_key_exists('Access-Control-Allow-Origin', $headers)); } @@ -85,13 +89,13 @@ class CORSMiddlewareTest extends \Test\TestCase { public function testNoOriginHeaderNoCORSHEADER() { $request = new Request( [], - $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(), - $this->getMockBuilder('\OCP\IConfig')->getMock() + $this->createMock(ISecureRandom::class), + $this->createMock(IConfig::class) ); $this->reflector->reflect($this, __FUNCTION__); $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler); - $response = $middleware->afterController($this, __FUNCTION__, new Response()); + $response = $middleware->afterController($this->controller, __FUNCTION__, new Response()); $headers = $response->getHeaders(); $this->assertFalse(array_key_exists('Access-Control-Allow-Origin', $headers)); } @@ -108,15 +112,15 @@ class CORSMiddlewareTest extends \Test\TestCase { 'HTTP_ORIGIN' => 'test' ] ], - $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(), - $this->getMockBuilder('\OCP\IConfig')->getMock() + $this->createMock(ISecureRandom::class), + $this->createMock(IConfig::class) ); $this->reflector->reflect($this, __FUNCTION__); $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler); $response = new Response(); $response->addHeader('AcCess-control-Allow-Credentials ', 'TRUE'); - $middleware->afterController($this, __FUNCTION__, $response); + $middleware->afterController($this->controller, __FUNCTION__, $response); } /** @@ -126,8 +130,8 @@ class CORSMiddlewareTest extends \Test\TestCase { public function testNoCORSShouldAllowCookieAuth() { $request = new Request( [], - $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(), - $this->getMockBuilder('\OCP\IConfig')->getMock() + $this->createMock(ISecureRandom::class), + $this->createMock(IConfig::class) ); $this->reflector->reflect($this, __FUNCTION__); $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler); @@ -139,7 +143,7 @@ class CORSMiddlewareTest extends \Test\TestCase { ->will($this->returnValue(true)); $this->reflector->reflect($this, __FUNCTION__); - $middleware->beforeController($this, __FUNCTION__, new Response()); + $middleware->beforeController($this->controller, __FUNCTION__); } /** @@ -151,8 +155,8 @@ class CORSMiddlewareTest extends \Test\TestCase { 'PHP_AUTH_USER' => 'user', 'PHP_AUTH_PW' => 'pass' ]], - $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(), - $this->getMockBuilder('\OCP\IConfig')->getMock() + $this->createMock(ISecureRandom::class), + $this->createMock(IConfig::class) ); $this->session->expects($this->once()) ->method('logout'); @@ -163,7 +167,7 @@ class CORSMiddlewareTest extends \Test\TestCase { $this->reflector->reflect($this, __FUNCTION__); $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler); - $middleware->beforeController($this, __FUNCTION__, new Response()); + $middleware->beforeController($this->controller, __FUNCTION__); } /** @@ -176,8 +180,8 @@ class CORSMiddlewareTest extends \Test\TestCase { 'PHP_AUTH_USER' => 'user', 'PHP_AUTH_PW' => 'pass' ]], - $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(), - $this->getMockBuilder('\OCP\IConfig')->getMock() + $this->createMock(ISecureRandom::class), + $this->createMock(IConfig::class) ); $this->session->expects($this->once()) ->method('logout'); @@ -188,7 +192,7 @@ class CORSMiddlewareTest extends \Test\TestCase { $this->reflector->reflect($this, __FUNCTION__); $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler); - $middleware->beforeController($this, __FUNCTION__, new Response()); + $middleware->beforeController($this->controller, __FUNCTION__); } /** @@ -201,8 +205,8 @@ class CORSMiddlewareTest extends \Test\TestCase { 'PHP_AUTH_USER' => 'user', 'PHP_AUTH_PW' => 'pass' ]], - $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(), - $this->getMockBuilder('\OCP\IConfig')->getMock() + $this->createMock(ISecureRandom::class), + $this->createMock(IConfig::class) ); $this->session->expects($this->once()) ->method('logout'); @@ -213,7 +217,7 @@ class CORSMiddlewareTest extends \Test\TestCase { $this->reflector->reflect($this, __FUNCTION__); $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler); - $middleware->beforeController($this, __FUNCTION__, new Response()); + $middleware->beforeController($this->controller, __FUNCTION__); } public function testAfterExceptionWithSecurityExceptionNoStatus() { @@ -222,11 +226,11 @@ class CORSMiddlewareTest extends \Test\TestCase { 'PHP_AUTH_USER' => 'user', 'PHP_AUTH_PW' => 'pass' ]], - $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(), - $this->getMockBuilder('\OCP\IConfig')->getMock() + $this->createMock(ISecureRandom::class), + $this->createMock(IConfig::class) ); $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler); - $response = $middleware->afterException($this, __FUNCTION__, new SecurityException('A security exception')); + $response = $middleware->afterException($this->controller, __FUNCTION__, new SecurityException('A security exception')); $expected = new JSONResponse(['message' => 'A security exception'], 500); $this->assertEquals($expected, $response); @@ -238,11 +242,11 @@ class CORSMiddlewareTest extends \Test\TestCase { 'PHP_AUTH_USER' => 'user', 'PHP_AUTH_PW' => 'pass' ]], - $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(), - $this->getMockBuilder('\OCP\IConfig')->getMock() + $this->createMock(ISecureRandom::class), + $this->createMock(IConfig::class) ); $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler); - $response = $middleware->afterException($this, __FUNCTION__, new SecurityException('A security exception', 501)); + $response = $middleware->afterException($this->controller, __FUNCTION__, new SecurityException('A security exception', 501)); $expected = new JSONResponse(['message' => 'A security exception'], 501); $this->assertEquals($expected, $response); @@ -258,11 +262,11 @@ class CORSMiddlewareTest extends \Test\TestCase { 'PHP_AUTH_USER' => 'user', 'PHP_AUTH_PW' => 'pass' ]], - $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(), - $this->getMockBuilder('\OCP\IConfig')->getMock() + $this->createMock(ISecureRandom::class), + $this->createMock(IConfig::class) ); $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler); - $middleware->afterException($this, __FUNCTION__, new \Exception('A regular exception')); + $middleware->afterException($this->controller, __FUNCTION__, new \Exception('A regular exception')); } } diff --git a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php index 17ac30b8fe4..773cb2b196f 100644 --- a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php @@ -131,7 +131,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { ->with($this->equalTo('files')); $this->reader->reflect(__CLASS__, __FUNCTION__); - $this->middleware->beforeController(__CLASS__, __FUNCTION__); + $this->middleware->beforeController($this->controller, __FUNCTION__); } @@ -152,7 +152,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { try { $this->reader->reflect(__CLASS__, $method); - $sec->beforeController(__CLASS__, $method); + $sec->beforeController($this->controller, $method); } catch (SecurityException $ex){ $this->assertEquals($status, $ex->getCode()); } @@ -234,7 +234,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { $sec = $this->getMiddleware(false, false); $this->reader->reflect(__CLASS__, __FUNCTION__); - $sec->beforeController(__CLASS__, __FUNCTION__); + $sec->beforeController($this->controller, __FUNCTION__); } @@ -261,7 +261,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { } $this->reader->reflect(__CLASS__, $method); - $sec->beforeController(__CLASS__, $method); + $sec->beforeController($this->controller, $method); } @@ -277,7 +277,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { ->method('passesStrictCookieCheck') ->will($this->returnValue(true)); $this->reader->reflect(__CLASS__, __FUNCTION__); - $this->middleware->beforeController(__CLASS__, __FUNCTION__); + $this->middleware->beforeController($this->controller, __FUNCTION__); } @@ -291,7 +291,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { ->will($this->returnValue(false)); $this->reader->reflect(__CLASS__, __FUNCTION__); - $this->middleware->beforeController(__CLASS__, __FUNCTION__); + $this->middleware->beforeController($this->controller, __FUNCTION__); } /** @@ -306,7 +306,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { ->will($this->returnValue(true)); $this->reader->reflect(__CLASS__, __FUNCTION__); - $this->middleware->beforeController(__CLASS__, __FUNCTION__); + $this->middleware->beforeController($this->controller, __FUNCTION__); } /** @@ -322,7 +322,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { ->will($this->returnValue(true)); $this->reader->reflect(__CLASS__, __FUNCTION__); - $this->middleware->beforeController(__CLASS__, __FUNCTION__); + $this->middleware->beforeController($this->controller, __FUNCTION__); } /** @@ -338,7 +338,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { ->will($this->returnValue(false)); $this->reader->reflect(__CLASS__, __FUNCTION__); - $this->middleware->beforeController(__CLASS__, __FUNCTION__); + $this->middleware->beforeController($this->controller, __FUNCTION__); } @@ -352,7 +352,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { ->will($this->returnValue(false)); $this->reader->reflect(__CLASS__, __FUNCTION__); - $this->middleware->beforeController(__CLASS__, __FUNCTION__); + $this->middleware->beforeController($this->controller, __FUNCTION__); } /** @@ -367,7 +367,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { ->willReturn(true); $this->reader->reflect(__CLASS__, __FUNCTION__); - $this->middleware->beforeController(__CLASS__, __FUNCTION__); + $this->middleware->beforeController($this->controller, __FUNCTION__); } public function dataCsrfOcsController() { diff --git a/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php b/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php index af2045cb7c1..3c218bb53c7 100644 --- a/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php @@ -15,21 +15,21 @@ namespace Test\AppFramework\Middleware; use OC\AppFramework\Http\Request; use OC\AppFramework\Middleware\SessionMiddleware; use OC\AppFramework\Utility\ControllerMethodReflector; +use OCP\AppFramework\Controller; use OCP\AppFramework\Http\Response; class SessionMiddlewareTest extends \Test\TestCase { - /** - * @var ControllerMethodReflector - */ + /** @var ControllerMethodReflector */ private $reflector; - /** - * @var Request - */ + /** @var Request */ private $request; + /** @var Controller */ + private $controller; + protected function setUp() { parent::setUp(); @@ -39,6 +39,7 @@ class SessionMiddlewareTest extends \Test\TestCase { $this->getMockBuilder('\OCP\IConfig')->getMock() ); $this->reflector = new ControllerMethodReflector(); + $this->controller = $this->createMock(Controller::class); } /** @@ -49,7 +50,7 @@ class SessionMiddlewareTest extends \Test\TestCase { $this->reflector->reflect($this, __FUNCTION__); $middleware = new SessionMiddleware($this->request, $this->reflector, $session); - $middleware->beforeController($this, __FUNCTION__); + $middleware->beforeController($this->controller, __FUNCTION__); } /** @@ -60,7 +61,7 @@ class SessionMiddlewareTest extends \Test\TestCase { $this->reflector->reflect($this, __FUNCTION__); $middleware = new SessionMiddleware($this->request, $this->reflector, $session); - $middleware->afterController($this, __FUNCTION__, new Response()); + $middleware->afterController($this->controller, __FUNCTION__, new Response()); } public function testSessionClosedOnBeforeController() { @@ -68,7 +69,7 @@ class SessionMiddlewareTest extends \Test\TestCase { $this->reflector->reflect($this, __FUNCTION__); $middleware = new SessionMiddleware($this->request, $this->reflector, $session); - $middleware->beforeController($this, __FUNCTION__); + $middleware->beforeController($this->controller, __FUNCTION__); } public function testSessionNotClosedOnAfterController() { @@ -76,7 +77,7 @@ class SessionMiddlewareTest extends \Test\TestCase { $this->reflector->reflect($this, __FUNCTION__); $middleware = new SessionMiddleware($this->request, $this->reflector, $session); - $middleware->afterController($this, __FUNCTION__, new Response()); + $middleware->afterController($this->controller, __FUNCTION__, new Response()); } /** diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php index f1e1ee7d417..2983e065ca8 100644 --- a/tests/lib/Files/ViewTest.php +++ b/tests/lib/Files/ViewTest.php @@ -18,6 +18,7 @@ use OC\Files\View; use OCP\Constants; use OCP\Files\Config\IMountProvider; use OCP\Files\FileInfo; +use OCP\Files\Storage\IStorage; use OCP\Lock\ILockingProvider; use OCP\Lock\LockedException; use OCP\Share; @@ -32,11 +33,11 @@ class TemporaryNoTouch extends Temporary { } class TemporaryNoCross extends Temporary { - public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = null) { + public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = null) { return Common::copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime); } - public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { return Common::moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); } } diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php index a764350c406..01d594de7ae 100644 --- a/tests/lib/Share20/ManagerTest.php +++ b/tests/lib/Share20/ManagerTest.php @@ -23,6 +23,7 @@ namespace Test\Share20; use OC\Files\Mount\MoveableMount; use OC\HintException; use OC\Share20\DefaultShareProvider; +use OCP\Defaults; use OCP\Files\File; use OCP\Files\Folder; use OCP\Files\IRootFolder; @@ -31,8 +32,10 @@ use OCP\Files\Node; use OCP\Files\Storage; use OCP\IGroup; use OCP\IServerContainer; +use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; +use OCP\Mail\IMailer; use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\IProviderFactory; use OCP\Share\IShare; @@ -85,6 +88,12 @@ class ManagerTest extends \Test\TestCase { protected $rootFolder; /** @var EventDispatcher | \PHPUnit_Framework_MockObject_MockObject */ protected $eventDispatcher; + /** @var IMailer|\PHPUnit_Framework_MockObject_MockObject */ + protected $mailer; + /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */ + protected $urlGenerator; + /** @var \OC_Defaults|\PHPUnit_Framework_MockObject_MockObject */ + protected $defaults; public function setUp() { @@ -97,6 +106,9 @@ class ManagerTest extends \Test\TestCase { $this->userManager = $this->createMock(IUserManager::class); $this->rootFolder = $this->createMock(IRootFolder::class); $this->eventDispatcher = $this->createMock(EventDispatcher::class); + $this->mailer = $this->createMock(IMailer::class); + $this->urlGenerator = $this->createMock(IURLGenerator::class); + $this->defaults = $this->createMock(\OC_Defaults::class); $this->l = $this->createMock(IL10N::class); $this->l->method('t') @@ -117,7 +129,10 @@ class ManagerTest extends \Test\TestCase { $this->factory, $this->userManager, $this->rootFolder, - $this->eventDispatcher + $this->eventDispatcher, + $this->mailer, + $this->urlGenerator, + $this->defaults ); $this->defaultProvider = $this->createMock(DefaultShareProvider::class); @@ -141,7 +156,10 @@ class ManagerTest extends \Test\TestCase { $this->factory, $this->userManager, $this->rootFolder, - $this->eventDispatcher + $this->eventDispatcher, + $this->mailer, + $this->urlGenerator, + $this->defaults ]); } @@ -2108,7 +2126,10 @@ class ManagerTest extends \Test\TestCase { $factory, $this->userManager, $this->rootFolder, - $this->eventDispatcher + $this->eventDispatcher, + $this->mailer, + $this->urlGenerator, + $this->defaults ); $share = $this->createMock(IShare::class); @@ -2147,7 +2168,10 @@ class ManagerTest extends \Test\TestCase { $factory, $this->userManager, $this->rootFolder, - $this->eventDispatcher + $this->eventDispatcher, + $this->mailer, + $this->urlGenerator, + $this->defaults ); $share = $this->createMock(IShare::class); @@ -2795,7 +2819,10 @@ class ManagerTest extends \Test\TestCase { $factory, $this->userManager, $this->rootFolder, - $this->eventDispatcher + $this->eventDispatcher, + $this->mailer, + $this->urlGenerator, + $this->defaults ); $this->assertSame($expected, $manager->shareProviderExists($shareType) @@ -2823,7 +2850,10 @@ class ManagerTest extends \Test\TestCase { $factory, $this->userManager, $this->rootFolder, - $this->eventDispatcher + $this->eventDispatcher, + $this->mailer, + $this->urlGenerator, + $this->defaults ); $factory->setProvider($this->defaultProvider); @@ -2882,7 +2912,10 @@ class ManagerTest extends \Test\TestCase { $factory, $this->userManager, $this->rootFolder, - $this->eventDispatcher + $this->eventDispatcher, + $this->mailer, + $this->urlGenerator, + $this->defaults ); $factory->setProvider($this->defaultProvider); diff --git a/tests/lib/Updater/VersionCheckTest.php b/tests/lib/Updater/VersionCheckTest.php index 79c0a88dbf6..6f6c6c1ad0c 100644 --- a/tests/lib/Updater/VersionCheckTest.php +++ b/tests/lib/Updater/VersionCheckTest.php @@ -59,8 +59,8 @@ class VersionCheckTest extends \Test\TestCase { $expectedResult = [ 'version' => '8.0.4.2', 'versionstring' => 'ownCloud 8.0.4', - 'url' => 'https://download.owncloud.org/community/owncloud-8.0.4.zip', - 'web' => 'http://doc.owncloud.org/server/8.0/admin_manual/maintenance/upgrade.html', + 'url' => 'https://download.example.org/community/owncloud-8.0.4.zip', + 'web' => 'http://doc.example.org/server/8.0/admin_manual/maintenance/upgrade.html', ]; $this->config @@ -81,8 +81,8 @@ class VersionCheckTest extends \Test\TestCase { $expectedResult = [ 'version' => '8.0.4.2', 'versionstring' => 'ownCloud 8.0.4', - 'url' => 'https://download.owncloud.org/community/owncloud-8.0.4.zip', - 'web' => 'http://doc.owncloud.org/server/8.0/admin_manual/maintenance/upgrade.html', + 'url' => 'https://download.example.org/community/owncloud-8.0.4.zip', + 'web' => 'http://doc.example.org/server/8.0/admin_manual/maintenance/upgrade.html', 'autoupdater' => '0', ]; @@ -119,8 +119,8 @@ class VersionCheckTest extends \Test\TestCase { <owncloud> <version>8.0.4.2</version> <versionstring>ownCloud 8.0.4</versionstring> - <url>https://download.owncloud.org/community/owncloud-8.0.4.zip</url> - <web>http://doc.owncloud.org/server/8.0/admin_manual/maintenance/upgrade.html</web> + <url>https://download.example.org/community/owncloud-8.0.4.zip</url> + <web>http://doc.example.org/server/8.0/admin_manual/maintenance/upgrade.html</web> <autoupdater>0</autoupdater> </owncloud>'; $this->updater diff --git a/tests/lib/Util/User/Dummy.php b/tests/lib/Util/User/Dummy.php index ea47f5d7d15..806a97bacba 100644 --- a/tests/lib/Util/User/Dummy.php +++ b/tests/lib/Util/User/Dummy.php @@ -95,7 +95,7 @@ class Dummy extends Backend implements \OCP\IUserBackend { * * @param string $uid The username * @param string $password The password - * @return string + * @return string|bool * * Check if the password is correct without logging in the user * returns the user id or false @@ -103,9 +103,9 @@ class Dummy extends Backend implements \OCP\IUserBackend { public function checkPassword($uid, $password) { if (isset($this->users[$uid]) && $this->users[$uid] === $password) { return $uid; - } else { - return false; } + + return false; } /** diff --git a/tests/lib/UtilTest.php b/tests/lib/UtilTest.php index 39a29742e4f..52d18571647 100644 --- a/tests/lib/UtilTest.php +++ b/tests/lib/UtilTest.php @@ -305,7 +305,7 @@ class UtilTest extends \Test\TestCase { * @group DB */ function testDefaultApps($defaultAppConfig, $expectedPath, $enabledApps) { - $oldDefaultApps = \OCP\Config::getSystemValue('defaultapp', ''); + $oldDefaultApps = \OC::$server->getConfig()->getSystemValue('defaultapp', ''); // CLI is doing messy stuff with the webroot, so need to work it around $oldWebRoot = \OC::$WEBROOT; \OC::$WEBROOT = ''; |