diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2017-11-03 17:40:05 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2017-11-09 11:10:58 +0100 |
commit | fc6b3902af03b770bc1de29cae50fb00022f355d (patch) | |
tree | dd345a51a1730c97fc69c168d6d11486ab2e0942 /apps/user_ldap/tests/WizardTest.php | |
parent | 59c05d54472aeed458611341970a72e42e5b9e6a (diff) | |
download | nextcloud-server-fc6b3902af03b770bc1de29cae50fb00022f355d.tar.gz nextcloud-server-fc6b3902af03b770bc1de29cae50fb00022f355d.zip |
adjust tests
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/tests/WizardTest.php')
-rw-r--r-- | apps/user_ldap/tests/WizardTest.php | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/apps/user_ldap/tests/WizardTest.php b/apps/user_ldap/tests/WizardTest.php index e7717aad37c..f11f7bec206 100644 --- a/apps/user_ldap/tests/WizardTest.php +++ b/apps/user_ldap/tests/WizardTest.php @@ -28,8 +28,11 @@ namespace OCA\User_LDAP\Tests; +use OCA\User_LDAP\Access; +use OCA\User_LDAP\Configuration; use OCA\User_LDAP\ILDAPWrapper; use \OCA\User_LDAP\Wizard; +use Test\TestCase; /** * Class Test_Wizard @@ -38,7 +41,7 @@ use \OCA\User_LDAP\Wizard; * * @package OCA\User_LDAP\Tests */ -class WizardTest extends \Test\TestCase { +class WizardTest extends TestCase { protected function setUp() { parent::setUp(); //we need to make sure the consts are defined, otherwise tests will fail @@ -62,30 +65,22 @@ class WizardTest extends \Test\TestCase { $connMethods = get_class_methods('\OCA\User_LDAP\Connection'); $accMethods = get_class_methods('\OCA\User_LDAP\Access'); } + /** @var ILDAPWrapper|\PHPUnit_Framework_MockObject_MockObject $lw */ $lw = $this->createMock(ILDAPWrapper::class); - $conf = $this->getMockBuilder('\OCA\User_LDAP\Configuration') + + /** @var Configuration|\PHPUnit_Framework_MockObject_MockObject $conf */ + $conf = $this->getMockBuilder(Configuration::class) ->setMethods($confMethods) ->setConstructorArgs([$lw, null, null]) ->getMock(); - $connector = $this->getMockBuilder('\OCA\User_LDAP\Connection') - ->setMethods($connMethods) - ->setConstructorArgs([$lw, null, null]) - ->getMock(); - - $um = $this->getMockBuilder('\OCA\User_LDAP\User\Manager') - ->disableOriginalConstructor() - ->getMock(); - $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig()); - $access = $this->getMockBuilder('\OCA\User_LDAP\Access') - ->setMethods($accMethods) - ->setConstructorArgs([$connector, $lw, $um, $helper]) - ->getMock(); + /** @var Access|\PHPUnit_Framework_MockObject_MockObject $access */ + $access = $this->createMock(Access::class); return array(new Wizard($conf, $lw, $access), $conf, $lw, $access); } - private function prepareLdapWrapperForConnections(&$ldap) { + private function prepareLdapWrapperForConnections(\PHPUnit_Framework_MockObject_MockObject &$ldap) { $ldap->expects($this->once()) ->method('connect') //dummy value, usually invalid |