diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/data/app/expected-info.json | 3 | ||||
-rw-r--r-- | tests/lib/DB/QueryBuilder/QueryBuilderTest.php | 20 | ||||
-rw-r--r-- | tests/lib/InfoXmlTest.php | 7 | ||||
-rw-r--r-- | tests/lib/Share20/DefaultShareProviderTest.php | 25 |
4 files changed, 34 insertions, 21 deletions
diff --git a/tests/data/app/expected-info.json b/tests/data/app/expected-info.json index 6ddd3ae8568..fb596f296da 100644 --- a/tests/data/app/expected-info.json +++ b/tests/data/app/expected-info.json @@ -76,5 +76,6 @@ "uninstall": [] }, "background-jobs": [], - "two-factor-providers": [] + "two-factor-providers": [], + "commands": [] } diff --git a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php index de8f84ac345..3c10d25c535 100644 --- a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php +++ b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php @@ -740,7 +740,7 @@ class QueryBuilderTest extends \Test\TestCase { ); $this->assertSame( - 'SELECT `column` FROM WHERE ' . $expectedQuery, + 'SELECT `column` WHERE ' . $expectedQuery, $this->queryBuilder->getSQL() ); } @@ -765,7 +765,7 @@ class QueryBuilderTest extends \Test\TestCase { ); $this->assertSame( - 'SELECT `column` FROM WHERE ' . $expectedQuery, + 'SELECT `column` WHERE ' . $expectedQuery, $this->queryBuilder->getSQL() ); } @@ -797,7 +797,7 @@ class QueryBuilderTest extends \Test\TestCase { ); $this->assertSame( - 'SELECT `column` FROM WHERE ' . $expectedQuery, + 'SELECT `column` WHERE ' . $expectedQuery, $this->queryBuilder->getSQL() ); } @@ -829,7 +829,7 @@ class QueryBuilderTest extends \Test\TestCase { ); $this->assertSame( - 'SELECT `column` FROM GROUP BY ' . $expectedQuery, + 'SELECT `column` GROUP BY ' . $expectedQuery, $this->queryBuilder->getSQL() ); } @@ -862,7 +862,7 @@ class QueryBuilderTest extends \Test\TestCase { ); $this->assertSame( - 'SELECT `column` FROM GROUP BY ' . $expectedQuery, + 'SELECT `column` GROUP BY ' . $expectedQuery, $this->queryBuilder->getSQL() ); } @@ -957,7 +957,7 @@ class QueryBuilderTest extends \Test\TestCase { ); $this->assertSame( - 'SELECT FROM ' . $expectedQuery, + 'SELECT ' . $expectedQuery, $this->queryBuilder->getSQL() ); } @@ -999,7 +999,7 @@ class QueryBuilderTest extends \Test\TestCase { ); $this->assertSame( - 'SELECT FROM ' . $expectedQuery, + 'SELECT ' . $expectedQuery, $this->queryBuilder->getSQL() ); } @@ -1041,7 +1041,7 @@ class QueryBuilderTest extends \Test\TestCase { ); $this->assertSame( - 'SELECT FROM ' . $expectedQuery, + 'SELECT ' . $expectedQuery, $this->queryBuilder->getSQL() ); } @@ -1071,7 +1071,7 @@ class QueryBuilderTest extends \Test\TestCase { ); $this->assertSame( - 'SELECT FROM ' . $expectedQuery, + 'SELECT ' . $expectedQuery, $this->queryBuilder->getSQL() ); } @@ -1109,7 +1109,7 @@ class QueryBuilderTest extends \Test\TestCase { ); $this->assertSame( - 'SELECT FROM ' . $expectedQuery, + 'SELECT ' . $expectedQuery, $this->queryBuilder->getSQL() ); } diff --git a/tests/lib/InfoXmlTest.php b/tests/lib/InfoXmlTest.php index bf6cd08ee39..4e75ca78203 100644 --- a/tests/lib/InfoXmlTest.php +++ b/tests/lib/InfoXmlTest.php @@ -118,5 +118,12 @@ class InfoXmlTest extends TestCase { $this->assertInstanceOf($migration, \OC::$server->query($migration)); } } + + if (isset($appInfo['commands'])) { + foreach ($appInfo['commands'] as $command) { + $this->assertTrue(class_exists($command), 'Asserting command "'. $command . '"exists'); + $this->assertInstanceOf($command, \OC::$server->query($command)); + } + } } } diff --git a/tests/lib/Share20/DefaultShareProviderTest.php b/tests/lib/Share20/DefaultShareProviderTest.php index 2fe50460836..0ae2ef922fc 100644 --- a/tests/lib/Share20/DefaultShareProviderTest.php +++ b/tests/lib/Share20/DefaultShareProviderTest.php @@ -3,6 +3,7 @@ * @author Roeland Jago Douma <rullzer@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, Roeland Jago Douma <roeland@famdouma.nl> * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -20,7 +21,6 @@ */ namespace Test\Share20; -use OC\Share20\Exception\ProviderException; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\Files\File; use OCP\Files\Folder; @@ -395,7 +395,8 @@ class DefaultShareProviderTest extends \Test\TestCase { $share = $this->createMock(IShare::class); $share->method('getId')->willReturn($id); - $provider = $this->getMockBuilder('OC\Share20\DefaultShareProvider') + /** @var DefaultShareProvider $provider */ + $provider = $this->getMockBuilder(DefaultShareProvider::class) ->setConstructorArgs([ $this->dbConn, $this->userManager, @@ -484,7 +485,8 @@ class DefaultShareProviderTest extends \Test\TestCase { $share->method('getId')->willReturn($id); $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_GROUP); - $provider = $this->getMockBuilder('OC\Share20\DefaultShareProvider') + /** @var DefaultShareProvider $provider */ + $provider = $this->getMockBuilder(DefaultShareProvider::class) ->setConstructorArgs([ $this->dbConn, $this->userManager, @@ -599,7 +601,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $share = new \OC\Share20\Share($this->rootFolder, $this->userManager); $shareOwner = $this->createMock(IUser::class); - $shareOwner->method('getUID')->WillReturn('shareOwner'); + $shareOwner->method('getUID')->willReturn('shareOwner'); $path = $this->createMock(File::class); $path->method('getId')->willReturn(100); @@ -1158,26 +1160,26 @@ class DefaultShareProviderTest extends \Test\TestCase { ]); $this->assertEquals(1, $qb->execute()); - $file = $this->getMock('\OCP\Files\File'); + $file = $this->createMock(File::class); $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf()); $this->rootFolder->method('getById')->with($deletedFileId)->willReturn([$file]); $groups = []; foreach(range(0, 100) as $i) { - $group = $this->getMock('\OCP\IGroup'); + $group = $this->createMock(IGroup::class); $group->method('getGID')->willReturn('group'.$i); $groups[] = $group; } - $group = $this->getMock('\OCP\IGroup'); + $group = $this->createMock(IGroup::class); $group->method('getGID')->willReturn('sharedWith'); $groups[] = $group; - $user = $this->getMock('\OCP\IUser'); + $user = $this->createMock(IUser::class); $user->method('getUID')->willReturn('sharedWith'); - $owner = $this->getMock('\OCP\IUser'); + $owner = $this->createMock(IUser::class); $owner->method('getUID')->willReturn('shareOwner'); - $initiator = $this->getMock('\OCP\IUser'); + $initiator = $this->createMock(IUser::class); $initiator->method('getUID')->willReturn('sharedBy'); $this->userManager->method('get')->willReturnMap([ @@ -1230,6 +1232,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $share = $this->provider->getSharesBy('sharedBy', \OCP\Share::SHARE_TYPE_USER, null, false, 1, 0); $this->assertCount(1, $share); + /** @var IShare $share */ $share = $share[0]; $this->assertEquals($id, $share->getId()); $this->assertEquals('sharedWith', $share->getSharedWith()); @@ -1279,6 +1282,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $share = $this->provider->getSharesBy('sharedBy', \OCP\Share::SHARE_TYPE_USER, $file, false, 1, 0); $this->assertCount(1, $share); + /** @var IShare $share */ $share = $share[0]; $this->assertEquals($id, $share->getId()); $this->assertEquals('sharedWith', $share->getSharedWith()); @@ -1328,6 +1332,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $shares = $this->provider->getSharesBy('shareOwner', \OCP\Share::SHARE_TYPE_USER, null, true, -1, 0); $this->assertCount(2, $shares); + /** @var IShare $share */ $share = $shares[0]; $this->assertEquals($id1, $share->getId()); $this->assertSame('sharedWith', $share->getSharedWith()); |