summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/tests
diff options
context:
space:
mode:
Diffstat (limited to 'apps/user_ldap/tests')
-rw-r--r--apps/user_ldap/tests/AccessTest.php18
-rw-r--r--apps/user_ldap/tests/ConfigurationTest.php2
-rw-r--r--apps/user_ldap/tests/ConnectionTest.php2
-rw-r--r--apps/user_ldap/tests/GroupLDAPPluginTest.php48
-rw-r--r--apps/user_ldap/tests/Group_LDAPTest.php30
-rw-r--r--apps/user_ldap/tests/HelperTest.php2
-rw-r--r--apps/user_ldap/tests/Jobs/SyncTest.php2
-rw-r--r--apps/user_ldap/tests/LDAPProviderTest.php88
-rw-r--r--apps/user_ldap/tests/LDAPTest.php2
-rw-r--r--apps/user_ldap/tests/Migration/AbstractUUIDFixTest.php2
-rw-r--r--apps/user_ldap/tests/Migration/UUIDFixGroupTest.php2
-rw-r--r--apps/user_ldap/tests/Migration/UUIDFixInsertTest.php2
-rw-r--r--apps/user_ldap/tests/Migration/UUIDFixUserTest.php2
-rw-r--r--apps/user_ldap/tests/Settings/AdminTest.php2
-rw-r--r--apps/user_ldap/tests/Settings/SectionTest.php2
-rw-r--r--apps/user_ldap/tests/User/DeletedUsersIndexTest.php4
-rw-r--r--apps/user_ldap/tests/User/ManagerTest.php2
-rw-r--r--apps/user_ldap/tests/User/UserTest.php8
-rw-r--r--apps/user_ldap/tests/UserLDAPPluginTest.php64
-rw-r--r--apps/user_ldap/tests/User_LDAPTest.php34
-rw-r--r--apps/user_ldap/tests/User_ProxyTest.php2
21 files changed, 160 insertions, 160 deletions
diff --git a/apps/user_ldap/tests/AccessTest.php b/apps/user_ldap/tests/AccessTest.php
index 0d327ce2e06..004a2619219 100644
--- a/apps/user_ldap/tests/AccessTest.php
+++ b/apps/user_ldap/tests/AccessTest.php
@@ -78,7 +78,7 @@ class AccessTest extends TestCase {
/** @var Access */
private $access;
- public function setUp(): void {
+ protected function setUp(): void {
$this->connection = $this->createMock(Connection::class);
$this->ldap = $this->createMock(LDAP::class);
$this->userManager = $this->createMock(Manager::class);
@@ -441,11 +441,11 @@ class AccessTest extends TestCase {
$this->assertSame($values[0], strtolower($dnFromServer));
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage LDAP password changes are disabled
- */
+
public function testSetPasswordWithDisabledChanges() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('LDAP password changes are disabled');
+
$this->connection
->method('__get')
->willReturn(false);
@@ -473,11 +473,11 @@ class AccessTest extends TestCase {
$this->assertFalse($this->access->setPassword('CN=foo', 'MyPassword'));
}
- /**
- * @expectedException \OC\HintException
- * @expectedExceptionMessage Password change rejected.
- */
+
public function testSetPasswordWithRejectedChange() {
+ $this->expectException(\OC\HintException::class);
+ $this->expectExceptionMessage('Password change rejected.');
+
$this->connection
->method('__get')
->willReturn(true);
diff --git a/apps/user_ldap/tests/ConfigurationTest.php b/apps/user_ldap/tests/ConfigurationTest.php
index 5820fff25ed..4298c8f294b 100644
--- a/apps/user_ldap/tests/ConfigurationTest.php
+++ b/apps/user_ldap/tests/ConfigurationTest.php
@@ -29,7 +29,7 @@ class ConfigurationTest extends \Test\TestCase {
/** @var Configuration */
protected $configuration;
- public function setUp(): void {
+ protected function setUp(): void {
parent::setUp();
$this->configuration = new Configuration('t01', false);
}
diff --git a/apps/user_ldap/tests/ConnectionTest.php b/apps/user_ldap/tests/ConnectionTest.php
index f08b5d9bf1d..3090c56c11c 100644
--- a/apps/user_ldap/tests/ConnectionTest.php
+++ b/apps/user_ldap/tests/ConnectionTest.php
@@ -44,7 +44,7 @@ class ConnectionTest extends \Test\TestCase {
/** @var Connection */
protected $connection;
- public function setUp(): void {
+ protected function setUp(): void {
parent::setUp();
$this->ldap = $this->createMock(ILDAPWrapper::class);
diff --git a/apps/user_ldap/tests/GroupLDAPPluginTest.php b/apps/user_ldap/tests/GroupLDAPPluginTest.php
index 3b8bfd795c5..773f937a77e 100644
--- a/apps/user_ldap/tests/GroupLDAPPluginTest.php
+++ b/apps/user_ldap/tests/GroupLDAPPluginTest.php
@@ -84,11 +84,11 @@ class GroupLDAPPluginTest extends \Test\TestCase {
$pluginManager->createGroup('group');
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage No plugin implements createGroup in this LDAP Backend.
- */
+
public function testCreateGroupNotRegistered() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('No plugin implements createGroup in this LDAP Backend.');
+
$pluginManager = $this->getGroupPluginManager();
$pluginManager->createGroup('foo');
}
@@ -114,11 +114,11 @@ class GroupLDAPPluginTest extends \Test\TestCase {
$pluginManager->deleteGroup('group');
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage No plugin implements deleteGroup in this LDAP Backend.
- */
+
public function testDeleteGroupNotRegistered() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('No plugin implements deleteGroup in this LDAP Backend.');
+
$pluginManager = $this->getGroupPluginManager();
$pluginManager->deleteGroup('foo');
}
@@ -145,11 +145,11 @@ class GroupLDAPPluginTest extends \Test\TestCase {
$pluginManager->addToGroup('uid', 'gid');
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage No plugin implements addToGroup in this LDAP Backend.
- */
+
public function testAddToGroupNotRegistered() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('No plugin implements addToGroup in this LDAP Backend.');
+
$pluginManager = $this->getGroupPluginManager();
$pluginManager->addToGroup('foo', 'bar');
}
@@ -176,11 +176,11 @@ class GroupLDAPPluginTest extends \Test\TestCase {
$pluginManager->removeFromGroup('uid', 'gid');
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage No plugin implements removeFromGroup in this LDAP Backend.
- */
+
public function testRemoveFromGroupNotRegistered() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('No plugin implements removeFromGroup in this LDAP Backend.');
+
$pluginManager = $this->getGroupPluginManager();
$pluginManager->removeFromGroup('foo', 'bar');
}
@@ -207,11 +207,11 @@ class GroupLDAPPluginTest extends \Test\TestCase {
$pluginManager->countUsersInGroup('gid', 'search');
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage No plugin implements countUsersInGroup in this LDAP Backend.
- */
+
public function testCountUsersInGroupNotRegistered() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('No plugin implements countUsersInGroup in this LDAP Backend.');
+
$pluginManager = $this->getGroupPluginManager();
$pluginManager->countUsersInGroup('foo', 'bar');
}
@@ -237,11 +237,11 @@ class GroupLDAPPluginTest extends \Test\TestCase {
$pluginManager->getGroupDetails('gid');
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage No plugin implements getGroupDetails in this LDAP Backend.
- */
+
public function testgetGroupDetailsNotRegistered() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('No plugin implements getGroupDetails in this LDAP Backend.');
+
$pluginManager = $this->getGroupPluginManager();
$pluginManager->getGroupDetails('foo');
}
diff --git a/apps/user_ldap/tests/Group_LDAPTest.php b/apps/user_ldap/tests/Group_LDAPTest.php
index e0ece5d50a6..2dae666d1dc 100644
--- a/apps/user_ldap/tests/Group_LDAPTest.php
+++ b/apps/user_ldap/tests/Group_LDAPTest.php
@@ -770,10 +770,10 @@ class Group_LDAPTest extends TestCase {
$this->assertEquals($ldap->createGroup('gid'),true);
}
- /**
- * @expectedException \Exception
- */
+
public function testCreateGroupFailing() {
+ $this->expectException(\Exception::class);
+
/** @var GroupPluginManager|\PHPUnit_Framework_MockObject_MockObject $pluginManager */
$pluginManager = $this->getMockBuilder('\OCA\User_LDAP\GroupPluginManager')
->setMethods(['implementsActions', 'createGroup'])
@@ -825,10 +825,10 @@ class Group_LDAPTest extends TestCase {
$this->assertEquals($ldap->deleteGroup('gid'),'result');
}
- /**
- * @expectedException \Exception
- */
+
public function testDeleteGroupFailing() {
+ $this->expectException(\Exception::class);
+
/** @var GroupPluginManager|\PHPUnit_Framework_MockObject_MockObject $pluginManager */
$pluginManager = $this->getMockBuilder('\OCA\User_LDAP\GroupPluginManager')
->setMethods(['implementsActions', 'deleteGroup'])
@@ -871,10 +871,10 @@ class Group_LDAPTest extends TestCase {
$this->assertEquals($ldap->addToGroup('uid', 'gid'),'result');
}
- /**
- * @expectedException \Exception
- */
+
public function testAddToGroupFailing() {
+ $this->expectException(\Exception::class);
+
/** @var GroupPluginManager|\PHPUnit_Framework_MockObject_MockObject $pluginManager */
$pluginManager = $this->getMockBuilder('\OCA\User_LDAP\GroupPluginManager')
->setMethods(['implementsActions', 'addToGroup'])
@@ -917,10 +917,10 @@ class Group_LDAPTest extends TestCase {
$this->assertEquals($ldap->removeFromGroup('uid', 'gid'),'result');
}
- /**
- * @expectedException \Exception
- */
+
public function testRemoveFromGroupFailing() {
+ $this->expectException(\Exception::class);
+
/** @var GroupPluginManager|\PHPUnit_Framework_MockObject_MockObject $pluginManager */
$pluginManager = $this->getMockBuilder('\OCA\User_LDAP\GroupPluginManager')
->setMethods(['implementsActions', 'removeFromGroup'])
@@ -963,10 +963,10 @@ class Group_LDAPTest extends TestCase {
$this->assertEquals($ldap->getGroupDetails('gid'),'result');
}
- /**
- * @expectedException \Exception
- */
+
public function testGetGroupDetailsFailing() {
+ $this->expectException(\Exception::class);
+
/** @var GroupPluginManager|\PHPUnit_Framework_MockObject_MockObject $pluginManager */
$pluginManager = $this->getMockBuilder('\OCA\User_LDAP\GroupPluginManager')
->setMethods(['implementsActions', 'getGroupDetails'])
diff --git a/apps/user_ldap/tests/HelperTest.php b/apps/user_ldap/tests/HelperTest.php
index 3804938199d..eae87a6a924 100644
--- a/apps/user_ldap/tests/HelperTest.php
+++ b/apps/user_ldap/tests/HelperTest.php
@@ -36,7 +36,7 @@ class HelperTest extends \Test\TestCase {
/** @var Helper */
private $helper;
- public function setUp(): void {
+ protected function setUp(): void {
parent::setUp();
$this->config = $this->createMock(IConfig::class);
diff --git a/apps/user_ldap/tests/Jobs/SyncTest.php b/apps/user_ldap/tests/Jobs/SyncTest.php
index d16ce6672df..e45f1d3fd10 100644
--- a/apps/user_ldap/tests/Jobs/SyncTest.php
+++ b/apps/user_ldap/tests/Jobs/SyncTest.php
@@ -69,7 +69,7 @@ class SyncTest extends TestCase {
/** @var AccessFactory|\PHPUnit_Framework_MockObject_MockObject */
protected $accessFactory;
- public function setUp(): void {
+ protected function setUp(): void {
parent::setUp();
$this->helper = $this->createMock(Helper::class);
diff --git a/apps/user_ldap/tests/LDAPProviderTest.php b/apps/user_ldap/tests/LDAPProviderTest.php
index cbce73be295..03756e85cc5 100644
--- a/apps/user_ldap/tests/LDAPProviderTest.php
+++ b/apps/user_ldap/tests/LDAPProviderTest.php
@@ -103,11 +103,11 @@ class LDAPProviderTest extends \Test\TestCase {
return $factory->getLDAPProvider();
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage User id not found in LDAP
- */
+
public function testGetUserDNUserIDNotFound() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('User id not found in LDAP');
+
$userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP')
->setMethods(['userExists'])
->disableOriginalConstructor()
@@ -142,11 +142,11 @@ class LDAPProviderTest extends \Test\TestCase {
$ldapProvider->getUserDN('existing_user'));
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage Group id not found in LDAP
- */
+
public function testGetGroupDNGroupIDNotFound() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('Group id not found in LDAP');
+
$userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP')
->disableOriginalConstructor()
->getMock();
@@ -240,11 +240,11 @@ class LDAPProviderTest extends \Test\TestCase {
$ldapProvider->sanitizeDN('cn=existing_user,ou=Are Sufficient To,ou=Test,dc=example,dc=org'));
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage User id not found in LDAP
- */
+
public function testGetLDAPConnectionUserIDNotFound() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('User id not found in LDAP');
+
$userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP')
->setMethods(['userExists'])
->disableOriginalConstructor()
@@ -275,11 +275,11 @@ class LDAPProviderTest extends \Test\TestCase {
$this->assertTrue($ldapProvider->getLDAPConnection('existing_user'));
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage Group id not found in LDAP
- */
+
public function testGetGroupLDAPConnectionGroupIDNotFound() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('Group id not found in LDAP');
+
$userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP')
->disableOriginalConstructor()
->getMock();
@@ -321,11 +321,11 @@ class LDAPProviderTest extends \Test\TestCase {
$this->assertTrue($ldapProvider->getGroupLDAPConnection('existing_group'));
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage User id not found in LDAP
- */
+
public function testGetLDAPBaseUsersUserIDNotFound() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('User id not found in LDAP');
+
$userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP')
->setMethods(['userExists'])
->disableOriginalConstructor()
@@ -384,11 +384,11 @@ class LDAPProviderTest extends \Test\TestCase {
$this->assertEquals($bases[1], $ldapProvider->getLDAPBaseUsers('existing_user'));
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage User id not found in LDAP
- */
+
public function testGetLDAPBaseGroupsUserIDNotFound() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('User id not found in LDAP');
+
$userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP')
->setMethods(['userExists'])
->disableOriginalConstructor()
@@ -440,11 +440,11 @@ class LDAPProviderTest extends \Test\TestCase {
$this->assertEquals($bases[0], $ldapProvider->getLDAPBaseGroups('existing_user'));
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage User id not found in LDAP
- */
+
public function testClearCacheUserIDNotFound() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('User id not found in LDAP');
+
$userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP')
->setMethods(['userExists'])
->disableOriginalConstructor()
@@ -479,11 +479,11 @@ class LDAPProviderTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage Group id not found in LDAP
- */
+
public function testClearGroupCacheGroupIDNotFound() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('Group id not found in LDAP');
+
$userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP')
->disableOriginalConstructor()
->getMock();
@@ -565,11 +565,11 @@ class LDAPProviderTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage User id not found in LDAP
- */
+
public function testGetLDAPDisplayNameFieldUserIDNotFound() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('User id not found in LDAP');
+
$userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP')
->setMethods(['userExists'])
->disableOriginalConstructor()
@@ -603,11 +603,11 @@ class LDAPProviderTest extends \Test\TestCase {
$this->assertEquals('displayName', $ldapProvider->getLDAPDisplayNameField('existing_user'));
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage User id not found in LDAP
- */
+
public function testGetLDAPEmailFieldUserIDNotFound() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('User id not found in LDAP');
+
$userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP')
->setMethods(['userExists'])
->disableOriginalConstructor()
@@ -641,11 +641,11 @@ class LDAPProviderTest extends \Test\TestCase {
$this->assertEquals('mail', $ldapProvider->getLDAPEmailField('existing_user'));
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage Group id not found in LDAP
- */
+
public function testGetLDAPGroupMemberAssocUserIDNotFound() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('Group id not found in LDAP');
+
$userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP')
->disableOriginalConstructor()
->getMock();
diff --git a/apps/user_ldap/tests/LDAPTest.php b/apps/user_ldap/tests/LDAPTest.php
index a6c097c6f85..441124cdf4d 100644
--- a/apps/user_ldap/tests/LDAPTest.php
+++ b/apps/user_ldap/tests/LDAPTest.php
@@ -30,7 +30,7 @@ class LDAPTest extends TestCase {
/** @var LDAP|\PHPUnit_Framework_MockObject_MockObject */
private $ldap;
- public function setUp(): void {
+ protected function setUp(): void {
parent::setUp();
$this->ldap = $this->getMockBuilder(LDAP::class)
->setMethods(['invokeLDAPMethod'])
diff --git a/apps/user_ldap/tests/Migration/AbstractUUIDFixTest.php b/apps/user_ldap/tests/Migration/AbstractUUIDFixTest.php
index 323a3464ce8..60e92ab926c 100644
--- a/apps/user_ldap/tests/Migration/AbstractUUIDFixTest.php
+++ b/apps/user_ldap/tests/Migration/AbstractUUIDFixTest.php
@@ -58,7 +58,7 @@ abstract class AbstractUUIDFixTest extends TestCase {
/** @var bool */
protected $isUser = true;
- public function setUp(): void {
+ protected function setUp(): void {
parent::setUp();
$this->ldap = $this->createMock(LDAP::class);
diff --git a/apps/user_ldap/tests/Migration/UUIDFixGroupTest.php b/apps/user_ldap/tests/Migration/UUIDFixGroupTest.php
index c0bbd8098b1..3adcdec35ea 100644
--- a/apps/user_ldap/tests/Migration/UUIDFixGroupTest.php
+++ b/apps/user_ldap/tests/Migration/UUIDFixGroupTest.php
@@ -35,7 +35,7 @@ use OCA\User_LDAP\Tests\Migration\AbstractUUIDFixTest;
* @group DB
*/
class UUIDFixGroupTest extends AbstractUUIDFixTest {
- public function setUp(): void {
+ protected function setUp(): void {
$this->isUser = false;
parent::setUp();
diff --git a/apps/user_ldap/tests/Migration/UUIDFixInsertTest.php b/apps/user_ldap/tests/Migration/UUIDFixInsertTest.php
index 32f601f2b11..a39338186e8 100644
--- a/apps/user_ldap/tests/Migration/UUIDFixInsertTest.php
+++ b/apps/user_ldap/tests/Migration/UUIDFixInsertTest.php
@@ -47,7 +47,7 @@ class UUIDFixInsertTest extends TestCase {
/** @var UUIDFixInsert */
protected $job;
- public function setUp(): void {
+ protected function setUp(): void {
parent::setUp();
$this->jobList = $this->createMock(IJobList::class);
diff --git a/apps/user_ldap/tests/Migration/UUIDFixUserTest.php b/apps/user_ldap/tests/Migration/UUIDFixUserTest.php
index 8e91a00156b..6793a8dd8ce 100644
--- a/apps/user_ldap/tests/Migration/UUIDFixUserTest.php
+++ b/apps/user_ldap/tests/Migration/UUIDFixUserTest.php
@@ -34,7 +34,7 @@ use OCA\User_LDAP\User_Proxy;
* @group DB
*/
class UUIDFixUserTest extends AbstractUUIDFixTest {
- public function setUp(): void {
+ protected function setUp(): void {
$this->isUser = true;
parent::setUp();
diff --git a/apps/user_ldap/tests/Settings/AdminTest.php b/apps/user_ldap/tests/Settings/AdminTest.php
index d421c379bf5..156033bcb8c 100644
--- a/apps/user_ldap/tests/Settings/AdminTest.php
+++ b/apps/user_ldap/tests/Settings/AdminTest.php
@@ -43,7 +43,7 @@ class AdminTest extends TestCase {
/** @var IL10N */
private $l10n;
- public function setUp(): void {
+ protected function setUp(): void {
parent::setUp();
$this->l10n = $this->getMockBuilder(IL10N::class)->getMock();
diff --git a/apps/user_ldap/tests/Settings/SectionTest.php b/apps/user_ldap/tests/Settings/SectionTest.php
index 0bd7a8010b6..60a36971314 100644
--- a/apps/user_ldap/tests/Settings/SectionTest.php
+++ b/apps/user_ldap/tests/Settings/SectionTest.php
@@ -37,7 +37,7 @@ class SectionTest extends TestCase {
/** @var Section */
private $section;
- public function setUp(): void {
+ protected function setUp(): void {
parent::setUp();
$this->url = $this->createMock(IURLGenerator::class);
$this->l = $this->createMock(IL10N::class);
diff --git a/apps/user_ldap/tests/User/DeletedUsersIndexTest.php b/apps/user_ldap/tests/User/DeletedUsersIndexTest.php
index e81a81f742f..c6f2d9bebd2 100644
--- a/apps/user_ldap/tests/User/DeletedUsersIndexTest.php
+++ b/apps/user_ldap/tests/User/DeletedUsersIndexTest.php
@@ -48,7 +48,7 @@ class DeletedUsersIndexTest extends \Test\TestCase {
/** @var UserMapping|\PHPUnit_Framework_MockObject_MockObject */
protected $mapping;
- public function setUp(): void {
+ protected function setUp(): void {
parent::setUp();
// no mocks for those as tests go against DB
@@ -63,7 +63,7 @@ class DeletedUsersIndexTest extends \Test\TestCase {
$this->dui = new DeletedUsersIndex($this->config, $this->db, $this->mapping);
}
- public function tearDown(): void {
+ protected function tearDown(): void {
$this->config->deleteAppFromAllUsers('user_ldap');
parent::tearDown();
}
diff --git a/apps/user_ldap/tests/User/ManagerTest.php b/apps/user_ldap/tests/User/ManagerTest.php
index a8abd1e4667..896e981883f 100644
--- a/apps/user_ldap/tests/User/ManagerTest.php
+++ b/apps/user_ldap/tests/User/ManagerTest.php
@@ -86,7 +86,7 @@ class ManagerTest extends \Test\TestCase {
/** @var Manager */
protected $manager;
- public function setUp(): void {
+ protected function setUp(): void {
parent::setUp();
$this->access = $this->createMock(Access::class);
diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php
index 992d3ce990c..5a94dd39cc6 100644
--- a/apps/user_ldap/tests/User/UserTest.php
+++ b/apps/user_ldap/tests/User/UserTest.php
@@ -76,7 +76,7 @@ class UserTest extends \Test\TestCase {
/** @var User */
protected $user;
- public function setUp(): void {
+ protected function setUp(): void {
parent::setUp();
$this->connection = $this->createMock(Connection::class);
@@ -1114,10 +1114,10 @@ class UserTest extends \Test\TestCase {
$this->assertFalse($this->user->getHomePath());
}
- /**
- * @expectedException \Exception
- */
+
public function testGetHomePathConfiguredNotAvailableNotAllowed() {
+ $this->expectException(\Exception::class);
+
$this->connection->expects($this->any())
->method('__get')
->with($this->equalTo('homeFolderNamingRule'))
diff --git a/apps/user_ldap/tests/UserLDAPPluginTest.php b/apps/user_ldap/tests/UserLDAPPluginTest.php
index 1d7d2ee7c75..fac6156450a 100644
--- a/apps/user_ldap/tests/UserLDAPPluginTest.php
+++ b/apps/user_ldap/tests/UserLDAPPluginTest.php
@@ -85,11 +85,11 @@ class UserLDAPPluginTest extends \Test\TestCase {
$pluginManager->createUser('user', 'password');
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage No plugin implements createUser in this LDAP Backend.
- */
+
public function testCreateUserNotRegistered() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('No plugin implements createUser in this LDAP Backend.');
+
$pluginManager = $this->getUserPluginManager();
$pluginManager->createUser('foo','bar');
}
@@ -116,11 +116,11 @@ class UserLDAPPluginTest extends \Test\TestCase {
$pluginManager->setPassword('user', 'password');
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage No plugin implements setPassword in this LDAP Backend.
- */
+
public function testSetPasswordNotRegistered() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('No plugin implements setPassword in this LDAP Backend.');
+
$pluginManager = $this->getUserPluginManager();
$pluginManager->setPassword('foo','bar');
}
@@ -146,11 +146,11 @@ class UserLDAPPluginTest extends \Test\TestCase {
$pluginManager->getHome('uid');
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage No plugin implements getHome in this LDAP Backend.
- */
+
public function testGetHomeNotRegistered() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('No plugin implements getHome in this LDAP Backend.');
+
$pluginManager = $this->getUserPluginManager();
$pluginManager->getHome('foo');
}
@@ -176,11 +176,11 @@ class UserLDAPPluginTest extends \Test\TestCase {
$pluginManager->getDisplayName('uid');
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage No plugin implements getDisplayName in this LDAP Backend.
- */
+
public function testGetDisplayNameNotRegistered() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('No plugin implements getDisplayName in this LDAP Backend.');
+
$pluginManager = $this->getUserPluginManager();
$pluginManager->getDisplayName('foo');
}
@@ -207,11 +207,11 @@ class UserLDAPPluginTest extends \Test\TestCase {
$pluginManager->setDisplayName('user', 'password');
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage No plugin implements setDisplayName in this LDAP Backend.
- */
+
public function testSetDisplayNameNotRegistered() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('No plugin implements setDisplayName in this LDAP Backend.');
+
$pluginManager = $this->getUserPluginManager();
$pluginManager->setDisplayName('foo', 'bar');
}
@@ -237,11 +237,11 @@ class UserLDAPPluginTest extends \Test\TestCase {
$pluginManager->canChangeAvatar('uid');
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage No plugin implements canChangeAvatar in this LDAP Backend.
- */
+
public function testCanChangeAvatarNotRegistered() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('No plugin implements canChangeAvatar in this LDAP Backend.');
+
$pluginManager = $this->getUserPluginManager();
$pluginManager->canChangeAvatar('foo');
}
@@ -264,11 +264,11 @@ class UserLDAPPluginTest extends \Test\TestCase {
$pluginManager->countUsers();
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage No plugin implements countUsers in this LDAP Backend.
- */
+
public function testCountUsersNotRegistered() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('No plugin implements countUsers in this LDAP Backend.');
+
$pluginManager = $this->getUserPluginManager();
$pluginManager->countUsers();
}
@@ -300,11 +300,11 @@ class UserLDAPPluginTest extends \Test\TestCase {
$pluginManager->deleteUser('uid');
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage No plugin implements deleteUser in this LDAP Backend.
- */
+
public function testDeleteUserNotRegistered() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('No plugin implements deleteUser in this LDAP Backend.');
+
$pluginManager = $this->getUserPluginManager();
$pluginManager->deleteUser('foo');
}
diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php
index e8076a051a1..b4766300df5 100644
--- a/apps/user_ldap/tests/User_LDAPTest.php
+++ b/apps/user_ldap/tests/User_LDAPTest.php
@@ -787,10 +787,10 @@ class User_LDAPTest extends TestCase {
$this->assertEquals($dataDir.'/susannah/', $result);
}
- /**
- * @expectedException \Exception
- */
+
public function testGetHomeNoPath() {
+ $this->expectException(\Exception::class);
+
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager);
$this->prepareMockForUserExists();
@@ -836,10 +836,10 @@ class User_LDAPTest extends TestCase {
$this->assertFalse($result);
}
- /**
- * @expectedException \OC\User\NoUserException
- */
+
public function testGetHomeDeletedUser() {
+ $this->expectException(\OC\User\NoUserException::class);
+
$uid = 'newyorker';
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager);
@@ -1280,11 +1280,11 @@ class User_LDAPTest extends TestCase {
}));
}
- /**
- * @expectedException \OC\HintException
- * @expectedExceptionMessage Password fails quality checking policy
- */
+
public function testSetPasswordInvalid() {
+ $this->expectException(\OC\HintException::class);
+ $this->expectExceptionMessage('Password fails quality checking policy');
+
$this->prepareAccessForSetPassword($this->access);
$this->userManager->expects($this->atLeastOnce())
->method('get')
@@ -1324,11 +1324,11 @@ class User_LDAPTest extends TestCase {
$this->assertFalse(\OC_User::setPassword('roland', 'dt12234$'));
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage LDAP setPassword: Could not get user object for uid NotExistingUser. Maybe the LDAP entry has no set display name attribute?
- */
+
public function testSetPasswordWithInvalidUser() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('LDAP setPassword: Could not get user object for uid NotExistingUser. Maybe the LDAP entry has no set display name attribute?');
+
$this->userManager
->expects($this->once())
->method('get')
@@ -1425,10 +1425,10 @@ class User_LDAPTest extends TestCase {
$this->assertEquals($newDisplayName, $this->backend->setDisplayName('uid', $newDisplayName));
}
- /**
- * @expectedException \OC\HintException
- */
+
public function testSetDisplayNameErrorWithPlugin() {
+ $this->expectException(\OC\HintException::class);
+
$newDisplayName = 'J. Baker';
$this->pluginManager->expects($this->once())
->method('implementsActions')
diff --git a/apps/user_ldap/tests/User_ProxyTest.php b/apps/user_ldap/tests/User_ProxyTest.php
index 02a1815804c..dc9758013fe 100644
--- a/apps/user_ldap/tests/User_ProxyTest.php
+++ b/apps/user_ldap/tests/User_ProxyTest.php
@@ -49,7 +49,7 @@ class User_ProxyTest extends TestCase {
/** @var UserPluginManager|\PHPUnit_Framework_MockObject_MockObject */
private $userPluginManager;
- public function setUp(): void {
+ protected function setUp(): void {
parent::setUp();
$this->ldapWrapper = $this->createMock(ILDAPWrapper::class);