diff options
author | Joas Schilling <coding@schilljs.com> | 2019-02-22 13:07:26 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2019-03-01 20:56:59 +0100 |
commit | 01b4db62fbc4230cff953a2385d305b149744b86 (patch) | |
tree | 788b5edf5acba069bd6996466ab9b1b30a6804d4 /tests/lib/User | |
parent | 55ae7fa2a48ce38e2807a40632f282740c0e8117 (diff) | |
download | nextcloud-server-01b4db62fbc4230cff953a2385d305b149744b86.tar.gz nextcloud-server-01b4db62fbc4230cff953a2385d305b149744b86.zip |
Add dispatcher events to User and Group objects
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/lib/User')
-rw-r--r-- | tests/lib/User/DatabaseTest.php | 10 | ||||
-rw-r--r-- | tests/lib/User/ManagerTest.php | 54 | ||||
-rw-r--r-- | tests/lib/User/SessionTest.php | 29 | ||||
-rw-r--r-- | tests/lib/User/UserTest.php | 77 |
4 files changed, 94 insertions, 76 deletions
diff --git a/tests/lib/User/DatabaseTest.php b/tests/lib/User/DatabaseTest.php index a6fb8047a98..666833ec44c 100644 --- a/tests/lib/User/DatabaseTest.php +++ b/tests/lib/User/DatabaseTest.php @@ -22,7 +22,7 @@ namespace Test\User; use OC\HintException; -use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\GenericEvent; use OC\User\User; @@ -34,7 +34,7 @@ use OC\User\User; class DatabaseTest extends Backend { /** @var array */ private $users; - /** @var EventDispatcher | \PHPUnit_Framework_MockObject_MockObject */ + /** @var EventDispatcherInterface|\PHPUnit_Framework_MockObject_MockObject */ private $eventDispatcher; public function getUser() { @@ -46,7 +46,7 @@ class DatabaseTest extends Backend { protected function setUp() { parent::setUp(); - $this->eventDispatcher = $this->createMock(EventDispatcher::class); + $this->eventDispatcher = $this->createMock(EventDispatcherInterface::class); $this->backend=new \OC\User\Database($this->eventDispatcher); } @@ -124,8 +124,8 @@ class DatabaseTest extends Backend { $user2 = $this->getUser(); $this->backend->createUser($user2, 'pass1'); - $user1Obj = new User($user1, $this->backend); - $user2Obj = new User($user2, $this->backend); + $user1Obj = new User($user1, $this->backend, $this->eventDispatcher); + $user2Obj = new User($user2, $this->backend, $this->eventDispatcher); $emailAddr1 = "$user1@nextcloud.com"; $emailAddr2 = "$user2@nextcloud.com"; diff --git a/tests/lib/User/ManagerTest.php b/tests/lib/User/ManagerTest.php index 284f7b173bc..b99d499b2a8 100644 --- a/tests/lib/User/ManagerTest.php +++ b/tests/lib/User/ManagerTest.php @@ -13,6 +13,7 @@ use OC\User\Database; use OC\User\Manager; use OCP\IConfig; use OCP\IUser; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Test\TestCase; /** @@ -26,16 +27,19 @@ class ManagerTest extends TestCase { /** @var IConfig */ private $config; + /** @var EventDispatcherInterface */ + private $dispatcher; public function setUp() { parent::setUp(); $this->config = $this->createMock(IConfig::class); + $this->dispatcher = $this->createMock(EventDispatcherInterface::class); } public function testGetBackends() { $userDummyBackend = $this->createMock(\Test\Util\User\Dummy::class); - $manager = new \OC\User\Manager($this->config); + $manager = new \OC\User\Manager($this->config, $this->dispatcher); $manager->registerBackend($userDummyBackend); $this->assertEquals([$userDummyBackend], $manager->getBackends()); $dummyDatabaseBackend = $this->createMock(Database::class); @@ -54,7 +58,7 @@ class ManagerTest extends TestCase { ->with($this->equalTo('foo')) ->will($this->returnValue(true)); - $manager = new \OC\User\Manager($this->config); + $manager = new \OC\User\Manager($this->config, $this->dispatcher); $manager->registerBackend($backend); $this->assertTrue($manager->userExists('foo')); @@ -70,14 +74,14 @@ class ManagerTest extends TestCase { ->with($this->equalTo('foo')) ->will($this->returnValue(false)); - $manager = new \OC\User\Manager($this->config); + $manager = new \OC\User\Manager($this->config, $this->dispatcher); $manager->registerBackend($backend); $this->assertFalse($manager->userExists('foo')); } public function testUserExistsNoBackends() { - $manager = new \OC\User\Manager($this->config); + $manager = new \OC\User\Manager($this->config, $this->dispatcher); $this->assertFalse($manager->userExists('foo')); } @@ -101,7 +105,7 @@ class ManagerTest extends TestCase { ->with($this->equalTo('foo')) ->will($this->returnValue(true)); - $manager = new \OC\User\Manager($this->config); + $manager = new \OC\User\Manager($this->config, $this->dispatcher); $manager->registerBackend($backend1); $manager->registerBackend($backend2); @@ -125,7 +129,7 @@ class ManagerTest extends TestCase { $backend2->expects($this->never()) ->method('userExists'); - $manager = new \OC\User\Manager($this->config); + $manager = new \OC\User\Manager($this->config, $this->dispatcher); $manager->registerBackend($backend1); $manager->registerBackend($backend2); @@ -152,7 +156,7 @@ class ManagerTest extends TestCase { } })); - $manager = new \OC\User\Manager($this->config); + $manager = new \OC\User\Manager($this->config, $this->dispatcher); $manager->registerBackend($backend); $user = $manager->checkPassword('foo', 'bar'); @@ -171,7 +175,7 @@ class ManagerTest extends TestCase { ->method('implementsActions') ->will($this->returnValue(false)); - $manager = new \OC\User\Manager($this->config); + $manager = new \OC\User\Manager($this->config, $this->dispatcher); $manager->registerBackend($backend); $this->assertFalse($manager->checkPassword('foo', 'bar')); @@ -189,7 +193,7 @@ class ManagerTest extends TestCase { $backend->expects($this->never()) ->method('loginName2UserName'); - $manager = new \OC\User\Manager($this->config); + $manager = new \OC\User\Manager($this->config, $this->dispatcher); $manager->registerBackend($backend); $this->assertEquals('foo', $manager->get('foo')->getUID()); @@ -205,7 +209,7 @@ class ManagerTest extends TestCase { ->with($this->equalTo('foo')) ->will($this->returnValue(false)); - $manager = new \OC\User\Manager($this->config); + $manager = new \OC\User\Manager($this->config, $this->dispatcher); $manager->registerBackend($backend); $this->assertEquals(null, $manager->get('foo')); @@ -223,7 +227,7 @@ class ManagerTest extends TestCase { $backend->expects($this->never()) ->method('loginName2UserName'); - $manager = new \OC\User\Manager($this->config); + $manager = new \OC\User\Manager($this->config, $this->dispatcher); $manager->registerBackend($backend); $this->assertEquals('bLeNdEr', $manager->get('bLeNdEr')->getUID()); @@ -241,7 +245,7 @@ class ManagerTest extends TestCase { $backend->expects($this->never()) ->method('loginName2UserName'); - $manager = new \OC\User\Manager($this->config); + $manager = new \OC\User\Manager($this->config, $this->dispatcher); $manager->registerBackend($backend); $result = $manager->search('fo'); @@ -275,7 +279,7 @@ class ManagerTest extends TestCase { $backend2->expects($this->never()) ->method('loginName2UserName'); - $manager = new \OC\User\Manager($this->config); + $manager = new \OC\User\Manager($this->config, $this->dispatcher); $manager->registerBackend($backend1); $manager->registerBackend($backend2); @@ -329,7 +333,7 @@ class ManagerTest extends TestCase { ->willReturn(true); - $manager = new \OC\User\Manager($this->config); + $manager = new \OC\User\Manager($this->config, $this->dispatcher); $manager->registerBackend($backend); $this->expectException(\InvalidArgumentException::class, $exception); @@ -356,7 +360,7 @@ class ManagerTest extends TestCase { $backend->expects($this->never()) ->method('loginName2UserName'); - $manager = new \OC\User\Manager($this->config); + $manager = new \OC\User\Manager($this->config, $this->dispatcher); $manager->registerBackend($backend); $user = $manager->createUser('foo', 'bar'); @@ -383,7 +387,7 @@ class ManagerTest extends TestCase { ->with($this->equalTo('foo')) ->will($this->returnValue(true)); - $manager = new \OC\User\Manager($this->config); + $manager = new \OC\User\Manager($this->config, $this->dispatcher); $manager->registerBackend($backend); $manager->createUser('foo', 'bar'); @@ -404,14 +408,14 @@ class ManagerTest extends TestCase { $backend->expects($this->never()) ->method('userExists'); - $manager = new \OC\User\Manager($this->config); + $manager = new \OC\User\Manager($this->config, $this->dispatcher); $manager->registerBackend($backend); $this->assertFalse($manager->createUser('foo', 'bar')); } public function testCreateUserNoBackends() { - $manager = new \OC\User\Manager($this->config); + $manager = new \OC\User\Manager($this->config, $this->dispatcher); $this->assertFalse($manager->createUser('foo', 'bar')); } @@ -431,7 +435,7 @@ class ManagerTest extends TestCase { ->with('MyUid', 'MyPassword') ->willReturn(false); - $manager = new Manager($config); + $manager = new Manager($config, $this->dispatcher); $manager->createUserFromBackend('MyUid', 'MyPassword', $backend); } @@ -471,7 +475,7 @@ class ManagerTest extends TestCase { ->with($this->equalTo('foo')) ->will($this->returnValue(true)); - $manager = new \OC\User\Manager($this->config); + $manager = new \OC\User\Manager($this->config, $this->dispatcher); $manager->registerBackend($backend1); $manager->registerBackend($backend2); @@ -479,7 +483,7 @@ class ManagerTest extends TestCase { } public function testCountUsersNoBackend() { - $manager = new \OC\User\Manager($this->config); + $manager = new \OC\User\Manager($this->config, $this->dispatcher); $result = $manager->countUsers(); $this->assertTrue(is_array($result)); @@ -504,7 +508,7 @@ class ManagerTest extends TestCase { ->method('getBackendName') ->will($this->returnValue('Mock_Test_Util_User_Dummy')); - $manager = new \OC\User\Manager($this->config); + $manager = new \OC\User\Manager($this->config, $this->dispatcher); $manager->registerBackend($backend); $result = $manager->countUsers(); @@ -545,7 +549,7 @@ class ManagerTest extends TestCase { ->method('getBackendName') ->will($this->returnValue('Mock_Test_Util_User_Dummy')); - $manager = new \OC\User\Manager($this->config); + $manager = new \OC\User\Manager($this->config, $this->dispatcher); $manager->registerBackend($backend1); $manager->registerBackend($backend2); @@ -660,7 +664,7 @@ class ManagerTest extends TestCase { ->with('foo', 'login', 'lastLogin') ->will($this->returnValue(0)); - $manager = new \OC\User\Manager($config); + $manager = new \OC\User\Manager($config, $this->dispatcher); $backend = new \Test\Util\User\Dummy(); $manager->registerBackend($backend); @@ -694,7 +698,7 @@ class ManagerTest extends TestCase { ->with($this->equalTo('uid2')) ->will($this->returnValue(true)); - $manager = new \OC\User\Manager($config); + $manager = new \OC\User\Manager($config, $this->dispatcher); $manager->registerBackend($backend); $users = $manager->getByEmail('test@example.com'); diff --git a/tests/lib/User/SessionTest.php b/tests/lib/User/SessionTest.php index 114b2eb5597..f6d86de7291 100644 --- a/tests/lib/User/SessionTest.php +++ b/tests/lib/User/SessionTest.php @@ -28,6 +28,7 @@ use OCP\IUser; use OCP\Lockdown\ILockdownManager; use OCP\Security\ICrypto; use OCP\Security\ISecureRandom; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; /** * @group DB @@ -167,7 +168,7 @@ class SessionTest extends \Test\TestCase { 'getUser' ]) ->getMock(); - $user = new User('sepp', null); + $user = new User('sepp', null, $this->createMock(EventDispatcherInterface::class)); $userSession->expects($this->once()) ->method('getUser') ->will($this->returnValue($isLoggedIn ? $user : null)); @@ -184,7 +185,7 @@ class SessionTest extends \Test\TestCase { $backend = $this->createMock(\Test\Util\User\Dummy::class); - $user = $this->getMockBuilder(User::class)->setConstructorArgs(['foo', $backend])->getMock(); + $user = $this->createMock(IUser::class); $user->expects($this->once()) ->method('getUID') ->will($this->returnValue('foo')); @@ -220,12 +221,12 @@ class SessionTest extends \Test\TestCase { $mockedManagerMethods = array_diff($managerMethods, ['__construct', 'emit', 'listen']); $manager = $this->getMockBuilder(Manager::class) ->setMethods($mockedManagerMethods) - ->setConstructorArgs([$this->config]) + ->setConstructorArgs([$this->config, $this->createMock(EventDispatcherInterface::class)]) ->getMock(); $backend = $this->createMock(\Test\Util\User\Dummy::class); - $user = $this->getMockBuilder(User::class)->setConstructorArgs(['foo', $backend])->getMock(); + $user = $this->createMock(IUser::class); $user->expects($this->any()) ->method('isEnabled') ->will($this->returnValue(true)); @@ -271,12 +272,12 @@ class SessionTest extends \Test\TestCase { $mockedManagerMethods = array_diff($managerMethods, ['__construct', 'emit', 'listen']); $manager = $this->getMockBuilder(Manager::class) ->setMethods($mockedManagerMethods) - ->setConstructorArgs([$this->config]) + ->setConstructorArgs([$this->config, $this->createMock(EventDispatcherInterface::class)]) ->getMock(); $backend = $this->createMock(\Test\Util\User\Dummy::class); - $user = $this->getMockBuilder(User::class)->setConstructorArgs(['foo', $backend])->getMock(); + $user = $this->createMock(IUser::class); $user->expects($this->any()) ->method('isEnabled') ->will($this->returnValue(false)); @@ -299,12 +300,12 @@ class SessionTest extends \Test\TestCase { $mockedManagerMethods = array_diff($managerMethods, ['__construct', 'emit', 'listen']); $manager = $this->getMockBuilder(Manager::class) ->setMethods($mockedManagerMethods) - ->setConstructorArgs([$this->config]) + ->setConstructorArgs([$this->config, $this->createMock(EventDispatcherInterface::class)]) ->getMock(); $backend = $this->createMock(\Test\Util\User\Dummy::class); $userSession = new \OC\User\Session($manager, $session, $this->timeFactory, $this->tokenProvider, $this->config, $this->random, $this->lockdownManager, $this->logger); - $user = $this->getMockBuilder(User::class)->setConstructorArgs(['foo', $backend])->getMock(); + $user = $this->createMock(IUser::class); $session->expects($this->never()) ->method('set'); @@ -535,7 +536,7 @@ class SessionTest extends \Test\TestCase { $mockedManagerMethods = array_diff($managerMethods, ['__construct', 'emit', 'listen']); $manager = $this->getMockBuilder(Manager::class) ->setMethods($mockedManagerMethods) - ->setConstructorArgs([$this->config]) + ->setConstructorArgs([$this->config, $this->createMock(EventDispatcherInterface::class)]) ->getMock(); $userSession = $this->getMockBuilder(Session::class) //override, otherwise tests will fail because of setcookie() @@ -621,7 +622,7 @@ class SessionTest extends \Test\TestCase { $mockedManagerMethods = array_diff($managerMethods, ['__construct', 'emit', 'listen']); $manager = $this->getMockBuilder(Manager::class) ->setMethods($mockedManagerMethods) - ->setConstructorArgs([$this->config]) + ->setConstructorArgs([$this->config, $this->createMock(EventDispatcherInterface::class)]) ->getMock(); $userSession = $this->getMockBuilder(Session::class) //override, otherwise tests will fail because of setcookie() @@ -681,7 +682,7 @@ class SessionTest extends \Test\TestCase { $mockedManagerMethods = array_diff($managerMethods, ['__construct', 'emit', 'listen']); $manager = $this->getMockBuilder(Manager::class) ->setMethods($mockedManagerMethods) - ->setConstructorArgs([$this->config]) + ->setConstructorArgs([$this->config, $this->createMock(EventDispatcherInterface::class)]) ->getMock(); $userSession = $this->getMockBuilder(Session::class) //override, otherwise tests will fail because of setcookie() @@ -729,7 +730,7 @@ class SessionTest extends \Test\TestCase { $mockedManagerMethods = array_diff($managerMethods, ['__construct', 'emit', 'listen']); $manager = $this->getMockBuilder(Manager::class) ->setMethods($mockedManagerMethods) - ->setConstructorArgs([$this->config]) + ->setConstructorArgs([$this->config, $this->createMock(EventDispatcherInterface::class)]) ->getMock(); $userSession = $this->getMockBuilder(Session::class) //override, otherwise tests will fail because of setcookie() @@ -765,8 +766,8 @@ class SessionTest extends \Test\TestCase { public function testActiveUserAfterSetSession() { $users = array( - 'foo' => new User('foo', null), - 'bar' => new User('bar', null) + 'foo' => new User('foo', null, $this->createMock(EventDispatcherInterface::class)), + 'bar' => new User('bar', null, $this->createMock(EventDispatcherInterface::class)) ); $manager = $this->getMockBuilder('\OC\User\Manager') diff --git a/tests/lib/User/UserTest.php b/tests/lib/User/UserTest.php index 2a99e725ec7..16fde814b85 100644 --- a/tests/lib/User/UserTest.php +++ b/tests/lib/User/UserTest.php @@ -17,6 +17,8 @@ use OCP\IUser; use OCP\Notification\IManager as INotificationManager; use OCP\Notification\INotification; use OCP\UserInterface; +use PHPUnit\Framework\MockObject\MockObject; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Test\TestCase; /** @@ -27,6 +29,15 @@ use Test\TestCase; * @package Test\User */ class UserTest extends TestCase { + + /** @var EventDispatcherInterface|MockObject */ + protected $dispatcher; + + public function setUp() { + parent::setUp(); + $this->dispatcher = $this->createMock(EventDispatcherInterface::class); + } + public function testDisplayName() { /** * @var \OC\User\Backend | \PHPUnit_Framework_MockObject_MockObject $backend @@ -42,7 +53,7 @@ class UserTest extends TestCase { ->with($this->equalTo(\OC\User\Backend::GET_DISPLAYNAME)) ->will($this->returnValue(true)); - $user = new User('foo', $backend); + $user = new User('foo', $backend, $this->dispatcher); $this->assertEquals('Foo', $user->getDisplayName()); } @@ -64,7 +75,7 @@ class UserTest extends TestCase { ->with($this->equalTo(\OC\User\Backend::GET_DISPLAYNAME)) ->will($this->returnValue(true)); - $user = new User('foo', $backend); + $user = new User('foo', $backend, $this->dispatcher); $this->assertEquals('foo', $user->getDisplayName()); } @@ -81,7 +92,7 @@ class UserTest extends TestCase { ->with($this->equalTo(\OC\User\Backend::GET_DISPLAYNAME)) ->will($this->returnValue(false)); - $user = new User('foo', $backend); + $user = new User('foo', $backend, $this->dispatcher); $this->assertEquals('foo', $user->getDisplayName()); } @@ -104,7 +115,7 @@ class UserTest extends TestCase { } })); - $user = new User('foo', $backend); + $user = new User('foo', $backend, $this->dispatcher); $this->assertTrue($user->setPassword('bar','')); } @@ -120,7 +131,7 @@ class UserTest extends TestCase { ->method('implementsActions') ->will($this->returnValue(false)); - $user = new User('foo', $backend); + $user = new User('foo', $backend, $this->dispatcher); $this->assertFalse($user->setPassword('bar','')); } @@ -144,7 +155,7 @@ class UserTest extends TestCase { } })); - $user = new User('foo', $backend); + $user = new User('foo', $backend, $this->dispatcher); $this->assertTrue($user->canChangeAvatar()); } @@ -168,7 +179,7 @@ class UserTest extends TestCase { } })); - $user = new User('foo', $backend); + $user = new User('foo', $backend, $this->dispatcher); $this->assertFalse($user->canChangeAvatar()); } @@ -184,7 +195,7 @@ class UserTest extends TestCase { ->method('implementsActions') ->willReturn(false); - $user = new User('foo', $backend); + $user = new User('foo', $backend, $this->dispatcher); $this->assertTrue($user->canChangeAvatar()); } @@ -197,7 +208,7 @@ class UserTest extends TestCase { ->method('deleteUser') ->with($this->equalTo('foo')); - $user = new User('foo', $backend); + $user = new User('foo', $backend, $this->dispatcher); $this->assertTrue($user->delete()); } @@ -229,7 +240,7 @@ class UserTest extends TestCase { ->method('deleteUser') ->with($this->equalTo('foo')); - $user = new User('foo', $backend); + $user = new User('foo', $backend, $this->dispatcher); $this->assertTrue($user->delete()); } @@ -253,14 +264,14 @@ class UserTest extends TestCase { } })); - $user = new User('foo', $backend); + $user = new User('foo', $backend, $this->dispatcher); $this->assertEquals('/home/foo', $user->getHome()); } public function testGetBackendClassName() { - $user = new User('foo', new \Test\Util\User\Dummy()); + $user = new User('foo', new \Test\Util\User\Dummy(), $this->dispatcher); $this->assertEquals('Dummy', $user->getBackendClassName()); - $user = new User('foo', new \OC\User\Database()); + $user = new User('foo', new \OC\User\Database(), $this->dispatcher); $this->assertEquals('Database', $user->getBackendClassName()); } @@ -287,7 +298,7 @@ class UserTest extends TestCase { ->with($this->equalTo('datadirectory')) ->will($this->returnValue('arbitrary/path')); - $user = new User('foo', $backend, null, $allConfig); + $user = new User('foo', $backend, $this->dispatcher, null, $allConfig); $this->assertEquals('arbitrary/path/foo', $user->getHome()); } @@ -307,7 +318,7 @@ class UserTest extends TestCase { } })); - $user = new User('foo', $backend); + $user = new User('foo', $backend, $this->dispatcher); $this->assertTrue($user->canChangePassword()); } @@ -321,7 +332,7 @@ class UserTest extends TestCase { ->method('implementsActions') ->will($this->returnValue(false)); - $user = new User('foo', $backend); + $user = new User('foo', $backend, $this->dispatcher); $this->assertFalse($user->canChangePassword()); } @@ -341,7 +352,7 @@ class UserTest extends TestCase { } })); - $user = new User('foo', $backend); + $user = new User('foo', $backend, $this->dispatcher); $this->assertTrue($user->canChangeDisplayName()); } @@ -355,7 +366,7 @@ class UserTest extends TestCase { ->method('implementsActions') ->will($this->returnValue(false)); - $user = new User('foo', $backend); + $user = new User('foo', $backend, $this->dispatcher); $this->assertFalse($user->canChangeDisplayName()); } @@ -380,7 +391,7 @@ class UserTest extends TestCase { ->with('foo','Foo') ->willReturn(true); - $user = new User('foo', $backend); + $user = new User('foo', $backend, $this->dispatcher); $this->assertTrue($user->setDisplayName('Foo')); $this->assertEquals('Foo',$user->getDisplayName()); } @@ -404,7 +415,7 @@ class UserTest extends TestCase { } })); - $user = new User('foo', $backend); + $user = new User('foo', $backend, $this->dispatcher); $this->assertFalse($user->setDisplayName(' ')); $this->assertEquals('foo',$user->getDisplayName()); } @@ -422,7 +433,7 @@ class UserTest extends TestCase { $backend->expects($this->never()) ->method('setDisplayName'); - $user = new User('foo', $backend); + $user = new User('foo', $backend, $this->dispatcher); $this->assertFalse($user->setDisplayName('Foo')); $this->assertEquals('foo',$user->getDisplayName()); } @@ -462,7 +473,7 @@ class UserTest extends TestCase { } })); - $user = new User('foo', $backend, $emitter); + $user = new User('foo', $backend, $this->dispatcher, $emitter); $user->setPassword('bar',''); $this->assertEquals(2, $hooksCalled); @@ -492,7 +503,7 @@ class UserTest extends TestCase { ->method('deleteUser') ->willReturn($result); $emitter = new PublicEmitter(); - $user = new User('foo', $backend, $emitter); + $user = new User('foo', $backend, $this->dispatcher, $emitter); /** * @param User $user @@ -573,7 +584,7 @@ class UserTest extends TestCase { ->method('getAbsoluteURL') ->withAnyParameters() ->willReturn('http://localhost:8888/owncloud'); - $user = new User('foo', $backend, null, null, $urlGenerator); + $user = new User('foo', $backend, $this->dispatcher, null, null, $urlGenerator); $this->assertEquals('foo@localhost:8888/owncloud', $user->getCloudId()); } @@ -609,7 +620,7 @@ class UserTest extends TestCase { 'email' ); - $user = new User('foo', $backend, $emitter, $config); + $user = new User('foo', $backend, $this->dispatcher, $emitter, $config); $user->setEMailAddress(''); } @@ -646,7 +657,7 @@ class UserTest extends TestCase { 'foo@bar.com' ); - $user = new User('foo', $backend, $emitter, $config); + $user = new User('foo', $backend, $this->dispatcher, $emitter, $config); $user->setEMailAddress('foo@bar.com'); } @@ -674,7 +685,7 @@ class UserTest extends TestCase { 'foo@bar.com' ); - $user = new User('foo', $backend, $emitter, $config); + $user = new User('foo', $backend, $this->dispatcher, $emitter, $config); $user->setEMailAddress('foo@bar.com'); } @@ -711,7 +722,7 @@ class UserTest extends TestCase { '23 TB' ); - $user = new User('foo', $backend, $emitter, $config); + $user = new User('foo', $backend, $this->dispatcher, $emitter, $config); $user->setQuota('23 TB'); } @@ -739,7 +750,7 @@ class UserTest extends TestCase { '23 TB' ); - $user = new User('foo', $backend, $emitter, $config); + $user = new User('foo', $backend, $this->dispatcher, $emitter, $config); $user->setQuota('23 TB'); } @@ -759,7 +770,7 @@ class UserTest extends TestCase { } })); - $user = new User('foo', $backend, null, $config); + $user = new User('foo', $backend, $this->dispatcher, null, $config); $this->assertSame(42, $user->getLastLogin()); } @@ -779,7 +790,7 @@ class UserTest extends TestCase { 'true' ); - $user = new User('foo', $backend, null, $config); + $user = new User('foo', $backend, $this->dispatcher, null, $config); $user->setEnabled(true); } @@ -803,6 +814,7 @@ class UserTest extends TestCase { ->setConstructorArgs([ 'foo', $backend, + $this->dispatcher, null, $config, ]) @@ -836,6 +848,7 @@ class UserTest extends TestCase { ->setConstructorArgs([ 'foo', $backend, + $this->dispatcher, null, $config, ]) @@ -867,7 +880,7 @@ class UserTest extends TestCase { } })); - $user = new User('foo', $backend, null, $config); + $user = new User('foo', $backend, $this->dispatcher, null, $config); $this->assertSame('foo@bar.com', $user->getEMailAddress()); } } |