diff options
Diffstat (limited to 'apps/federation/tests')
-rw-r--r-- | apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php | 6 | ||||
-rw-r--r-- | apps/federation/tests/DbHandlerTest.php (renamed from apps/federation/tests/Lib/DbHandlerTest.php) | 2 | ||||
-rw-r--r-- | apps/federation/tests/HooksTest.php (renamed from apps/federation/tests/Lib/HooksTest.php) | 2 | ||||
-rw-r--r-- | apps/federation/tests/SyncFederationAddressbooksTest.php (renamed from apps/federation/tests/Lib/SyncFederationAddressbooksTest.php) | 4 | ||||
-rw-r--r-- | apps/federation/tests/TrustedServersTest.php (renamed from apps/federation/tests/Lib/TrustedServersTest.php) | 16 |
5 files changed, 20 insertions, 10 deletions
diff --git a/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php b/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php index 5b4a1f87a5f..2fc4fe881a6 100644 --- a/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php +++ b/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php @@ -24,7 +24,13 @@ namespace OCA\Federation\Tests\BackgroundJob; use OCA\Federation\BackgroundJob\RequestSharedSecret; +use OCA\Federation\DbHandler; +use OCA\Federation\TrustedServers; use OCP\AppFramework\Http; +use OCP\BackgroundJob\IJobList; +use OCP\Http\Client\IClient; +use OCP\Http\Client\IResponse; +use OCP\IURLGenerator; use Test\TestCase; class RequestSharedSecretTest extends TestCase { diff --git a/apps/federation/tests/Lib/DbHandlerTest.php b/apps/federation/tests/DbHandlerTest.php index 03a740b0277..6e5b8f2f06c 100644 --- a/apps/federation/tests/Lib/DbHandlerTest.php +++ b/apps/federation/tests/DbHandlerTest.php @@ -21,7 +21,7 @@ */ -namespace OCA\Federation\Tests\Lib; +namespace OCA\Federation\Tests; use OCA\Federation\DbHandler; diff --git a/apps/federation/tests/Lib/HooksTest.php b/apps/federation/tests/HooksTest.php index 6f917b4bb62..014829d9cf6 100644 --- a/apps/federation/tests/Lib/HooksTest.php +++ b/apps/federation/tests/HooksTest.php @@ -20,7 +20,7 @@ */ -namespace OCA\Federation\Tests\Lib; +namespace OCA\Federation\Tests; use OCA\Federation\Hooks; diff --git a/apps/federation/tests/Lib/SyncFederationAddressbooksTest.php b/apps/federation/tests/SyncFederationAddressbooksTest.php index 2d7945b9690..4c266fae3a0 100644 --- a/apps/federation/tests/Lib/SyncFederationAddressbooksTest.php +++ b/apps/federation/tests/SyncFederationAddressbooksTest.php @@ -20,7 +20,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ -namespace OCA\Federation\Tests\Lib; +namespace OCA\Federation\Tests; use OCA\Federation\DbHandler; use OCA\Federation\SyncFederationAddressBooks; @@ -52,6 +52,7 @@ class SyncFederationAddressbooksTest extends \Test\TestCase { $syncService->expects($this->once())->method('syncRemoteAddressBook') ->willReturn(1); + /** @var \OCA\DAV\CardDAV\SyncService $syncService */ $s = new SyncFederationAddressBooks($dbHandler, $syncService); $s->syncThemAll(function($url, $ex) { $this->callBacks[] = [$url, $ex]; @@ -79,6 +80,7 @@ class SyncFederationAddressbooksTest extends \Test\TestCase { $syncService->expects($this->once())->method('syncRemoteAddressBook') ->willThrowException(new \Exception('something did not work out')); + /** @var \OCA\DAV\CardDAV\SyncService $syncService */ $s = new SyncFederationAddressBooks($dbHandler, $syncService); $s->syncThemAll(function($url, $ex) { $this->callBacks[] = [$url, $ex]; diff --git a/apps/federation/tests/Lib/TrustedServersTest.php b/apps/federation/tests/TrustedServersTest.php index 167734b2f61..e49db2556be 100644 --- a/apps/federation/tests/Lib/TrustedServersTest.php +++ b/apps/federation/tests/TrustedServersTest.php @@ -21,7 +21,7 @@ */ -namespace OCA\Federation\Tests\Lib; +namespace OCA\Federation\Tests; use OCA\Federation\DbHandler; @@ -38,7 +38,7 @@ use Test\TestCase; class TrustedServersTest extends TestCase { - /** @var TrustedServers */ + /** @var \PHPUnit_Framework_MockObject_MockObject | TrustedServers */ private $trustedServers; /** @var \PHPUnit_Framework_MockObject_MockObject | DbHandler */ @@ -101,7 +101,7 @@ class TrustedServersTest extends TestCase { * @param bool $success */ public function testAddServer($success) { - /** @var \PHPUnit_Framework_MockObject_MockObject | TrustedServers $trustedServer */ + /** @var \PHPUnit_Framework_MockObject_MockObject|TrustedServers $trustedServers */ $trustedServers = $this->getMockBuilder('OCA\Federation\TrustedServers') ->setConstructorArgs( [ @@ -172,7 +172,7 @@ class TrustedServersTest extends TestCase { ->with('federation', 'autoAddServers', '1')->willReturn($status); $this->assertSame($expected, - $this->trustedServers->getAutoAddServers($status) + $this->trustedServers->getAutoAddServers() ); } @@ -208,6 +208,7 @@ class TrustedServersTest extends TestCase { function($eventId, $event) { $this->assertSame($eventId, 'OCP\Federation\TrustedServerEvent::remove'); $this->assertInstanceOf('Symfony\Component\EventDispatcher\GenericEvent', $event); + /** @var \Symfony\Component\EventDispatcher\GenericEvent $event */ $this->assertSame('url_hash', $event->getSubject()); } ); @@ -215,9 +216,10 @@ class TrustedServersTest extends TestCase { } public function testGetServers() { - $this->dbHandler->expects($this->once())->method('getAllServer')->willReturn(true); + $this->dbHandler->expects($this->once())->method('getAllServer')->willReturn(['servers']); - $this->assertTrue( + $this->assertEquals( + ['servers'], $this->trustedServers->getServers() ); } @@ -257,7 +259,7 @@ class TrustedServersTest extends TestCase { $server = 'server1'; - /** @var \PHPUnit_Framework_MockObject_MockObject | TrustedServers $trustedServer */ + /** @var \PHPUnit_Framework_MockObject_MockObject | TrustedServers $trustedServers */ $trustedServers = $this->getMockBuilder('OCA\Federation\TrustedServers') ->setConstructorArgs( [ |