update unit tests

Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
This commit is contained in:
Björn Schiessle 2018-09-25 16:17:51 +02:00
parent 179e4d5b76
commit 418d54fa2d
No known key found for this signature in database
GPG key ID: 2378A753E2BF04F6
2 changed files with 44 additions and 2 deletions

View file

@ -94,6 +94,7 @@ class SAMLControllerTest extends TestCase {
$this->logger,
$this->l
);
}
/**
@ -125,6 +126,11 @@ class SAMLControllerTest extends TestCase {
]);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('gs.enabled', false)
->willReturn(false);
$this->config
->expects($this->at(2))
->method('getAppValue')
->with('user_saml', 'general-uid_mapping')
->willReturn('uid');
@ -156,6 +162,11 @@ class SAMLControllerTest extends TestCase {
]);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('gs.enabled', false)
->willReturn(false);
$this->config
->expects($this->at(2))
->method('getAppValue')
->with('user_saml', 'general-uid_mapping')
->willReturn('uid');
@ -205,6 +216,11 @@ class SAMLControllerTest extends TestCase {
]);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('gs.enabled', false)
->willReturn(false);
$this->config
->expects($this->at(2))
->method('getAppValue')
->with('user_saml', 'general-uid_mapping')
->willReturn('uid');
@ -254,6 +270,11 @@ class SAMLControllerTest extends TestCase {
]);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('gs.enabled', false)
->willReturn(false);
$this->config
->expects($this->at(2))
->method('getAppValue')
->with('user_saml', 'general-uid_mapping')
->willReturn('uid');
@ -311,6 +332,11 @@ class SAMLControllerTest extends TestCase {
]);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('gs.enabled', false)
->willReturn(false);
$this->config
->expects($this->at(2))
->method('getAppValue')
->with('user_saml', 'general-uid_mapping')
->willReturn('uid');
@ -363,6 +389,11 @@ class SAMLControllerTest extends TestCase {
]);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('gs.enabled', false)
->willReturn(false);
$this->config
->expects($this->at(2))
->method('getAppValue')
->with('user_saml', 'general-uid_mapping')
->willReturn('uid');
@ -402,6 +433,11 @@ class SAMLControllerTest extends TestCase {
]);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('gs.enabled', false)
->willReturn(false);
$this->config
->expects($this->at(2))
->method('getAppValue')
->with('user_saml', 'general-uid_mapping')
->willReturn('uid');

View file

@ -27,6 +27,7 @@ use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IGroup;
use OCP\IGroupManager;
use OCP\ILogger;
use OCP\ISession;
use OCP\IURLGenerator;
use OCP\IUser;
@ -50,6 +51,8 @@ class UserBackendTest extends TestCase {
private $userBackend;
/** @var \PHPUnit_Framework_MockObject_MockObject|SAMLSettings */
private $SAMLSettings;
/** @var \PHPUnit_Framework_MockObject_MockObject|ILogger */
private $logger;
public function setUp() {
parent::setUp();
@ -61,6 +64,7 @@ class UserBackendTest extends TestCase {
$this->userManager = $this->createMock(IUserManager::class);
$this->groupManager = $this->createMock(IGroupManager::class);
$this->SAMLSettings = $this->getMockBuilder(SAMLSettings::class)->disableOriginalConstructor()->getMock();
$this->logger = $this->createMock(ILogger::class);
}
public function getMockedBuilder(array $mockedFunctions = []) {
@ -73,7 +77,8 @@ class UserBackendTest extends TestCase {
$this->db,
$this->userManager,
$this->groupManager,
$this->SAMLSettings
$this->SAMLSettings,
$this->logger
])
->setMethods($mockedFunctions)
->getMock();
@ -85,7 +90,8 @@ class UserBackendTest extends TestCase {
$this->db,
$this->userManager,
$this->groupManager,
$this->SAMLSettings
$this->SAMLSettings,
$this->logger
);
}
}