blob: 401d8b8a83291785e6ca940f9cab535482d10494 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<?php
/**
* Copyright (c) 2015 Robin Appelman <icewind@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace Test\Traits;
/**
* Allow creating users in a temporary backend
*/
trait UserTrait {
/**
* @var \OC_User_Dummy|\OCP\UserInterface
*/
protected $userBackend;
protected function createUser($name, $password) {
$this->userBackend->createUser($name, $password);
}
protected function setUpUserTrait() {
$this->userBackend = new \OC_User_Dummy();
\OC::$server->getUserManager()->registerBackend($this->userBackend);
}
protected function tearDownUserTrait() {
\OC::$server->getUserManager()->removeBackend($this->userBackend);
}
}
|