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/Files | |
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/Files')
-rw-r--r-- | tests/lib/Files/Cache/CacheTest.php | 4 | ||||
-rw-r--r-- | tests/lib/Files/FileInfoTest.php | 9 | ||||
-rw-r--r-- | tests/lib/Files/Node/IntegrationTest.php | 2 | ||||
-rw-r--r-- | tests/lib/Files/Node/NodeTest.php | 10 | ||||
-rw-r--r-- | tests/lib/Files/Node/RootTest.php | 9 |
5 files changed, 14 insertions, 20 deletions
diff --git a/tests/lib/Files/Cache/CacheTest.php b/tests/lib/Files/Cache/CacheTest.php index d984964ca9f..f94b4f57078 100644 --- a/tests/lib/Files/Cache/CacheTest.php +++ b/tests/lib/Files/Cache/CacheTest.php @@ -332,7 +332,7 @@ class CacheTest extends \Test\TestCase { $userId = $this->getUniqueId('user'); \OC::$server->getUserManager()->createUser($userId, $userId); $this->loginAsUser($userId); - $user = new \OC\User\User($userId, null); + $user = new \OC\User\User($userId, null, \OC::$server->getEventDispatcher()); $file1 = 'folder'; $file2 = 'folder/foobar'; @@ -402,7 +402,7 @@ class CacheTest extends \Test\TestCase { $userId = static::getUniqueID('user'); \OC::$server->getUserManager()->createUser($userId, $userId); static::loginAsUser($userId); - $user = new \OC\User\User($userId, null); + $user = new \OC\User\User($userId, null, \OC::$server->getEventDispatcher()); $file1 = 'folder'; $file2 = 'folder/foobar'; diff --git a/tests/lib/Files/FileInfoTest.php b/tests/lib/Files/FileInfoTest.php index ee7a10ccec4..b1ab880ad70 100644 --- a/tests/lib/Files/FileInfoTest.php +++ b/tests/lib/Files/FileInfoTest.php @@ -14,6 +14,7 @@ use OC\Files\Storage\Home; use OC\Files\Storage\Temporary; use OC\User\User; use OCP\IConfig; +use OCP\IUser; use Test\TestCase; use Test\Traits\UserTrait; @@ -29,9 +30,15 @@ class FileInfoTest extends TestCase { } public function testIsMountedHomeStorage() { + $user = $this->createMock(IUser::class); + $user->method('getUID') + ->willReturn('foo'); + $user->method('getHome') + ->willReturn('foo'); + $fileInfo = new FileInfo( '', - new Home(['user' => new User('foo', $this->userBackend, null, $this->config)]), + new Home(['user' => $user]), '', [], null); $this->assertFalse($fileInfo->isMounted()); } diff --git a/tests/lib/Files/Node/IntegrationTest.php b/tests/lib/Files/Node/IntegrationTest.php index b5cd832d1dd..6d9b0ce20b9 100644 --- a/tests/lib/Files/Node/IntegrationTest.php +++ b/tests/lib/Files/Node/IntegrationTest.php @@ -45,7 +45,7 @@ class IntegrationTest extends \Test\TestCase { \OC_Hook::clear('OC_Filesystem'); - $user = new User($this->getUniqueID('user'), new \Test\Util\User\Dummy); + $user = new User($this->getUniqueID('user'), new \Test\Util\User\Dummy, \OC::$server->getEventDispatcher()); $this->loginAsUser($user->getUID()); $this->view = new View(); diff --git a/tests/lib/Files/Node/NodeTest.php b/tests/lib/Files/Node/NodeTest.php index 9200ae69f75..dee5a0211c5 100644 --- a/tests/lib/Files/Node/NodeTest.php +++ b/tests/lib/Files/Node/NodeTest.php @@ -18,6 +18,7 @@ use OCP\Files\Storage; use OCP\IConfig; use OCP\ILogger; use OCP\IURLGenerator; +use OCP\IUser; use OCP\IUserManager; use OCP\Files\NotFoundException; @@ -45,14 +46,7 @@ abstract class NodeTest extends \Test\TestCase { protected function setUp() { parent::setUp(); - $config = $this->getMockBuilder(IConfig::class) - ->disableOriginalConstructor() - ->getMock(); - $urlGenerator = $this->getMockBuilder(IURLGenerator - ::class) - ->disableOriginalConstructor() - ->getMock(); - $this->user = new \OC\User\User('', new \Test\Util\User\Dummy, null, $config, $urlGenerator); + $this->user = $this->createMock(IUser::class); $this->manager = $this->getMockBuilder(Manager::class) ->disableOriginalConstructor() ->getMock(); diff --git a/tests/lib/Files/Node/RootTest.php b/tests/lib/Files/Node/RootTest.php index fd050c8d90c..8a6e5411f26 100644 --- a/tests/lib/Files/Node/RootTest.php +++ b/tests/lib/Files/Node/RootTest.php @@ -39,14 +39,7 @@ class RootTest extends \Test\TestCase { protected function setUp() { parent::setUp(); - $config = $this->getMockBuilder(IConfig::class) - ->disableOriginalConstructor() - ->getMock(); - $urlgenerator = $this->getMockBuilder(IURLGenerator::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->user = new \OC\User\User('', new \Test\Util\User\Dummy, null, $config, $urlgenerator); + $this->user = $this->createMock(IUser::class); $this->manager = $this->getMockBuilder(Manager::class) ->disableOriginalConstructor() ->getMock(); |