diff options
Diffstat (limited to 'tests/Settings')
-rw-r--r-- | tests/Settings/Controller/AdminSettingsControllerTest.php | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/tests/Settings/Controller/AdminSettingsControllerTest.php b/tests/Settings/Controller/AdminSettingsControllerTest.php index 1d4d6eb9dbb..51357f67a2d 100644 --- a/tests/Settings/Controller/AdminSettingsControllerTest.php +++ b/tests/Settings/Controller/AdminSettingsControllerTest.php @@ -46,6 +46,8 @@ class AdminSettingsControllerTest extends TestCase { private $navigationManager; /** @var IManager|\PHPUnit_Framework_MockObject_MockObject */ private $settingsManager; + /** @var string */ + private $adminUid = 'lololo'; public function setUp() { parent::setUp(); @@ -60,6 +62,16 @@ class AdminSettingsControllerTest extends TestCase { $this->navigationManager, $this->settingsManager ); + + $user = \OC::$server->getUserManager()->createUser($this->adminUid, 'olo'); + \OC_User::setUserId($user->getUID()); + \OC::$server->getGroupManager()->createGroup('admin')->addUser($user); + } + + public function tearDown() { + \OC::$server->getUserManager()->get($this->adminUid)->delete(); + + parent::tearDown(); } public function testIndex() { @@ -77,11 +89,6 @@ class AdminSettingsControllerTest extends TestCase { ->with('test') ->willReturn([5 => new TipsTricks($this->getMockBuilder('\OCP\IConfig')->getMock())]); - // so unity… - $user = \OC::$server->getUserManager()->createUser('lolo', 'olo'); - \OC_User::setUserId($user->getUID()); - \OC::$server->getGroupManager()->get('admin')->addUser($user); - $expected = new TemplateResponse('settings', 'settings/frame', ['forms' => ['personal' => [], 'admin' => []], 'content' => '']); $this->assertEquals($expected, $this->adminSettingsController->index('test')); } |