Skip to content

Commit 4d733d0

Browse files
committed
fix tests
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
1 parent 78ef725 commit 4d733d0

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

‎tests/unit/Service/ProviderServiceTest.php‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
use OCA\UserOIDC\AppInfo\Application;
1212
use OCA\UserOIDC\Db\ProviderMapper;
1313
use OCA\UserOIDC\Service\ProviderService;
14-
use OCP\IConfig;
14+
use OCP\IAppConfig;
1515
use PHPUnit\Framework\Assert;
1616
use PHPUnit\Framework\TestCase;
1717

1818
class ProviderServiceTest extends TestCase {
1919

2020
/**
21-
* @var IConfig|\PHPUnit\Framework\MockObject\MockObject
21+
* @var IAppConfig|\PHPUnit\Framework\MockObject\MockObject
2222
*/
23-
private $config;
23+
private $appConfig;
2424
/**
2525
* @var ProviderMapper|\PHPUnit\Framework\MockObject\MockObject
2626
*/
@@ -32,9 +32,9 @@ class ProviderServiceTest extends TestCase {
3232

3333
public function setUp(): void {
3434
parent::setUp();
35-
$this->config = $this->createMock(IConfig::class);
35+
$this->appConfig = $this->createMock(IAppConfig::class);
3636
$this->providerMapper = $this->createMock(ProviderMapper::class);
37-
$this->providerService = new ProviderService($this->config, $this->providerMapper);
37+
$this->providerService = new ProviderService($this->appConfig, $this->providerMapper);
3838
}
3939

4040
public function testGetProvidersWithSettings() {
@@ -48,8 +48,8 @@ public function testGetProvidersWithSettings() {
4848
->method('getProviders')
4949
->willReturn($providers);
5050

51-
$this->config->expects(self::any())
52-
->method('getAppValue')
51+
$this->appConfig->expects(self::any())
52+
->method('getValueString')
5353
->willReturn('1');
5454

5555
Assert::assertEquals([
@@ -183,8 +183,8 @@ public function testSetSettings() {
183183
'restrictLoginToGroups' => false,
184184
'nestedAndFallbackClaims' => false,
185185
];
186-
$this->config->expects(self::any())
187-
->method('getAppValue')
186+
$this->appConfig->expects(self::any())
187+
->method('getValueString')
188188
->willReturnMap([
189189
[Application::APP_ID, 'provider-1-' . ProviderService::SETTING_MAPPING_DISPLAYNAME, '', 'dn'],
190190
[Application::APP_ID, 'provider-1-' . ProviderService::SETTING_MAPPING_EMAIL, '', 'mail'],
@@ -249,8 +249,8 @@ public function testDeleteSettings() {
249249
$realKeysToDelete = array_map(function ($setting) {
250250
return 'provider-1-' . $setting;
251251
}, $keysToDelete);
252-
$this->config->expects(self::exactly(count($keysToDelete)))
253-
->method('deleteAppValue')
252+
$this->appConfig->expects(self::exactly(count($keysToDelete)))
253+
->method('deleteKey')
254254
->willReturnCallback(function ($appName, $key) use ($realKeysToDelete) {
255255
$this->assertEquals(Application::APP_ID, $appName);
256256
$this->assertContains($key, $realKeysToDelete);
@@ -260,8 +260,8 @@ public function testDeleteSettings() {
260260
}
261261

262262
public function testSetSetting() {
263-
$this->config->expects(self::once())
264-
->method('setAppValue')
263+
$this->appConfig->expects(self::once())
264+
->method('setValueString')
265265
->with(Application::APP_ID, 'provider-1-key', 'value');
266266

267267
$this->providerService->setSetting(1, 'key', 'value');
@@ -276,8 +276,8 @@ public function dataGetSetting() {
276276

277277
/** @dataProvider dataGetSetting */
278278
public function testGetSetting($providerId, $key, $stored, $expected, $default = '') {
279-
$this->config->expects(self::once())
280-
->method('getAppValue')
279+
$this->appConfig->expects(self::once())
280+
->method('getValueString')
281281
->with(Application::APP_ID, 'provider-' . $providerId . '-' . $key, '')
282282
->willReturn($stored);
283283

0 commit comments

Comments
 (0)