Merge pull request #24514 from owncloud/federation-psr4

Move federation app to PSR-4
This commit is contained in:
Vincent Petry 2016-05-23 09:52:38 +02:00
commit 9264674b36
23 changed files with 21 additions and 11 deletions

View file

@ -20,7 +20,7 @@
*
*/
namespace OCA\Federation\Middleware ;
namespace OCA\Federation\Middleware;
use OC\HintException;
use OCP\AppFramework\Http;

View file

@ -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 {

View file

@ -21,7 +21,7 @@
*/
namespace OCA\Federation\Tests\lib;
namespace OCA\Federation\Tests;
use OCA\Federation\DbHandler;

View file

@ -20,7 +20,7 @@
*/
namespace OCA\Federation\Tests\lib;
namespace OCA\Federation\Tests;
use OCA\Federation\Hooks;

View file

@ -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];

View file

@ -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(
[