Fix errors in the tests

This commit is contained in:
Joas Schilling 2016-05-09 15:37:51 +02:00
parent da332c134e
commit a6b4ba9ba1
No known key found for this signature in database
GPG Key ID: 70A0B324C41C0946
5 changed files with 20 additions and 10 deletions

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