aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/AppFramework/Services/AppConfigTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/AppFramework/Services/AppConfigTest.php')
-rw-r--r--tests/lib/AppFramework/Services/AppConfigTest.php279
1 files changed, 128 insertions, 151 deletions
diff --git a/tests/lib/AppFramework/Services/AppConfigTest.php b/tests/lib/AppFramework/Services/AppConfigTest.php
index a7d14d5001c..38fa6bdcac6 100644
--- a/tests/lib/AppFramework/Services/AppConfigTest.php
+++ b/tests/lib/AppFramework/Services/AppConfigTest.php
@@ -2,24 +2,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2024, Maxence Lange <maxence@artificial-owl.com
- *
- * @author Maxence Lange <maxence@artificial-owl.com>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Test\AppFramework\Services;
@@ -44,16 +28,16 @@ class AppConfigTest extends TestCase {
parent::setUp();
$this->config = $this->createMock(IConfig::class);
$this->appConfigCore = $this->createMock(AppConfigCore::class);
-
+
$this->appConfig = new AppConfig($this->config, $this->appConfigCore, self::TEST_APPID);
}
public function testGetAppKeys(): void {
$expected = ['key1', 'key2', 'key3', 'key4', 'key5', 'key6', 'key7', 'test8'];
$this->appConfigCore->expects($this->once())
- ->method('getKeys')
- ->with(self::TEST_APPID)
- ->willReturn($expected);
+ ->method('getKeys')
+ ->with(self::TEST_APPID)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->getAppKeys());
}
@@ -62,7 +46,7 @@ class AppConfigTest extends TestCase {
* @return array
* @see testHasAppKey
*/
- public function providerHasAppKey(): array {
+ public static function providerHasAppKey(): array {
return [
// lazy, expected
[false, true],
@@ -73,17 +57,17 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerHasAppKey
*
* @param bool $lazy
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerHasAppKey')]
public function testHasAppKey(bool $lazy, bool $expected): void {
$key = 'key';
$this->appConfigCore->expects($this->once())
- ->method('hasKey')
- ->with(self::TEST_APPID, $key, $lazy)
- ->willReturn($expected);
+ ->method('hasKey')
+ ->with(self::TEST_APPID, $key, $lazy)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->hasAppKey($key, $lazy));
}
@@ -92,7 +76,7 @@ class AppConfigTest extends TestCase {
* @return array
* @see testIsSensitive
*/
- public function providerIsSensitive(): array {
+ public static function providerIsSensitive(): array {
return [
// lazy, expected
[false, true],
@@ -103,33 +87,33 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerIsSensitive
*
* @param bool $lazy
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerIsSensitive')]
public function testIsSensitive(bool $lazy, bool $expected): void {
$key = 'key';
$this->appConfigCore->expects($this->once())
- ->method('isSensitive')
- ->with(self::TEST_APPID, $key, $lazy)
- ->willReturn($expected);
+ ->method('isSensitive')
+ ->with(self::TEST_APPID, $key, $lazy)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->isSensitive($key, $lazy));
}
/**
- * @dataProvider providerIsSensitive
*
* @param bool $lazy
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerIsSensitive')]
public function testIsSensitiveException(bool $lazy, bool $expected): void {
$key = 'unknown-key';
$this->appConfigCore->expects($this->once())
- ->method('isSensitive')
- ->with(self::TEST_APPID, $key, $lazy)
- ->willThrowException(new AppConfigUnknownKeyException());
+ ->method('isSensitive')
+ ->with(self::TEST_APPID, $key, $lazy)
+ ->willThrowException(new AppConfigUnknownKeyException());
$this->expectException(AppConfigUnknownKeyException::class);
$this->appConfig->isSensitive($key, $lazy);
@@ -139,7 +123,7 @@ class AppConfigTest extends TestCase {
* @return array
* @see testIsLazy
*/
- public function providerIsLazy(): array {
+ public static function providerIsLazy(): array {
return [
// expected
[true],
@@ -148,16 +132,15 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerIsLazy
- *
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerIsLazy')]
public function testIsLazy(bool $expected): void {
$key = 'key';
$this->appConfigCore->expects($this->once())
- ->method('isLazy')
- ->with(self::TEST_APPID, $key)
- ->willReturn($expected);
+ ->method('isLazy')
+ ->with(self::TEST_APPID, $key)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->isLazy($key));
}
@@ -165,9 +148,9 @@ class AppConfigTest extends TestCase {
public function testIsLazyException(): void {
$key = 'unknown-key';
$this->appConfigCore->expects($this->once())
- ->method('isLazy')
- ->with(self::TEST_APPID, $key)
- ->willThrowException(new AppConfigUnknownKeyException());
+ ->method('isLazy')
+ ->with(self::TEST_APPID, $key)
+ ->willThrowException(new AppConfigUnknownKeyException());
$this->expectException(AppConfigUnknownKeyException::class);
$this->appConfig->isLazy($key);
@@ -177,7 +160,7 @@ class AppConfigTest extends TestCase {
* @return array
* @see testGetAllAppValues
*/
- public function providerGetAllAppValues(): array {
+ public static function providerGetAllAppValues(): array {
return [
// key, filtered
['', false],
@@ -188,11 +171,11 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerGetAllAppValues
*
* @param string $key
* @param bool $filtered
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAllAppValues')]
public function testGetAllAppValues(string $key, bool $filtered): void {
$expected = [
'key1' => 'value1',
@@ -202,9 +185,9 @@ class AppConfigTest extends TestCase {
];
$this->appConfigCore->expects($this->once())
- ->method('getAllValues')
- ->with(self::TEST_APPID, $key, $filtered)
- ->willReturn($expected);
+ ->method('getAllValues')
+ ->with(self::TEST_APPID, $key, $filtered)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->getAllAppValues($key, $filtered));
}
@@ -213,8 +196,8 @@ class AppConfigTest extends TestCase {
$key = 'key';
$value = 'value';
$this->appConfigCore->expects($this->once())
- ->method('setValueMixed')
- ->with(self::TEST_APPID, $key, $value);
+ ->method('setValueMixed')
+ ->with(self::TEST_APPID, $key, $value);
$this->appConfig->setAppValue($key, $value);
}
@@ -230,7 +213,7 @@ class AppConfigTest extends TestCase {
* @see testSetAppValueArray
* @see testSetAppValueArrayException
*/
- public function providerSetAppValue(): array {
+ public static function providerSetAppValue(): array {
return [
// lazy, sensitive, expected
[false, false, true],
@@ -245,108 +228,108 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerSetAppValue
*
* @param bool $lazy
* @param bool $sensitive
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetAppValue')]
public function testSetAppValueString(bool $lazy, bool $sensitive, bool $expected): void {
$key = 'key';
$value = 'valueString';
$this->appConfigCore->expects($this->once())
- ->method('setValueString')
- ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
- ->willReturn($expected);
+ ->method('setValueString')
+ ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->setAppValueString($key, $value, $lazy, $sensitive));
}
/**
- * @dataProvider providerSetAppValue
*
* @param bool $lazy
* @param bool $sensitive
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetAppValue')]
public function testSetAppValueStringException(bool $lazy, bool $sensitive): void {
$key = 'key';
$value = 'valueString';
$this->appConfigCore->expects($this->once())
- ->method('setValueString')
- ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
- ->willThrowException(new AppConfigTypeConflictException());
+ ->method('setValueString')
+ ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
+ ->willThrowException(new AppConfigTypeConflictException());
$this->expectException(AppConfigTypeConflictException::class);
$this->appConfig->setAppValueString($key, $value, $lazy, $sensitive);
}
/**
- * @dataProvider providerSetAppValue
*
* @param bool $lazy
* @param bool $sensitive
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetAppValue')]
public function testSetAppValueInt(bool $lazy, bool $sensitive, bool $expected): void {
$key = 'key';
$value = 42;
$this->appConfigCore->expects($this->once())
- ->method('setValueInt')
- ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
- ->willReturn($expected);
+ ->method('setValueInt')
+ ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->setAppValueInt($key, $value, $lazy, $sensitive));
}
/**
- * @dataProvider providerSetAppValue
*
* @param bool $lazy
* @param bool $sensitive
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetAppValue')]
public function testSetAppValueIntException(bool $lazy, bool $sensitive): void {
$key = 'key';
$value = 42;
$this->appConfigCore->expects($this->once())
- ->method('setValueInt')
- ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
- ->willThrowException(new AppConfigTypeConflictException());
+ ->method('setValueInt')
+ ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
+ ->willThrowException(new AppConfigTypeConflictException());
$this->expectException(AppConfigTypeConflictException::class);
$this->appConfig->setAppValueInt($key, $value, $lazy, $sensitive);
}
/**
- * @dataProvider providerSetAppValue
*
* @param bool $lazy
* @param bool $sensitive
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetAppValue')]
public function testSetAppValueFloat(bool $lazy, bool $sensitive, bool $expected): void {
$key = 'key';
$value = 3.14;
$this->appConfigCore->expects($this->once())
- ->method('setValueFloat')
- ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
- ->willReturn($expected);
+ ->method('setValueFloat')
+ ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->setAppValueFloat($key, $value, $lazy, $sensitive));
}
/**
- * @dataProvider providerSetAppValue
*
* @param bool $lazy
* @param bool $sensitive
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetAppValue')]
public function testSetAppValueFloatException(bool $lazy, bool $sensitive): void {
$key = 'key';
$value = 3.14;
$this->appConfigCore->expects($this->once())
- ->method('setValueFloat')
- ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
- ->willThrowException(new AppConfigTypeConflictException());
+ ->method('setValueFloat')
+ ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
+ ->willThrowException(new AppConfigTypeConflictException());
$this->expectException(AppConfigTypeConflictException::class);
$this->appConfig->setAppValueFloat($key, $value, $lazy, $sensitive);
@@ -356,7 +339,7 @@ class AppConfigTest extends TestCase {
* @return array
* @see testSetAppValueBool
*/
- public function providerSetAppValueBool(): array {
+ public static function providerSetAppValueBool(): array {
return [
// lazy, expected
[false, true],
@@ -367,70 +350,69 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerSetAppValueBool
*
* @param bool $lazy
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetAppValueBool')]
public function testSetAppValueBool(bool $lazy, bool $expected): void {
$key = 'key';
$value = true;
$this->appConfigCore->expects($this->once())
- ->method('setValueBool')
- ->with(self::TEST_APPID, $key, $value, $lazy)
- ->willReturn($expected);
+ ->method('setValueBool')
+ ->with(self::TEST_APPID, $key, $value, $lazy)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->setAppValueBool($key, $value, $lazy));
}
/**
- * @dataProvider providerSetAppValueBool
- *
* @param bool $lazy
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetAppValueBool')]
public function testSetAppValueBoolException(bool $lazy): void {
$key = 'key';
$value = true;
$this->appConfigCore->expects($this->once())
- ->method('setValueBool')
- ->with(self::TEST_APPID, $key, $value, $lazy)
- ->willThrowException(new AppConfigTypeConflictException());
+ ->method('setValueBool')
+ ->with(self::TEST_APPID, $key, $value, $lazy)
+ ->willThrowException(new AppConfigTypeConflictException());
$this->expectException(AppConfigTypeConflictException::class);
$this->appConfig->setAppValueBool($key, $value, $lazy);
}
/**
- * @dataProvider providerSetAppValue
*
* @param bool $lazy
* @param bool $sensitive
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetAppValue')]
public function testSetAppValueArray(bool $lazy, bool $sensitive, bool $expected): void {
$key = 'key';
$value = ['item' => true];
$this->appConfigCore->expects($this->once())
- ->method('setValueArray')
- ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
- ->willReturn($expected);
+ ->method('setValueArray')
+ ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->setAppValueArray($key, $value, $lazy, $sensitive));
}
/**
- * @dataProvider providerSetAppValue
*
* @param bool $lazy
* @param bool $sensitive
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetAppValue')]
public function testSetAppValueArrayException(bool $lazy, bool $sensitive): void {
$key = 'key';
$value = ['item' => true];
$this->appConfigCore->expects($this->once())
- ->method('setValueArray')
- ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
- ->willThrowException(new AppConfigTypeConflictException());
+ ->method('setValueArray')
+ ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
+ ->willThrowException(new AppConfigTypeConflictException());
$this->expectException(AppConfigTypeConflictException::class);
$this->appConfig->setAppValueArray($key, $value, $lazy, $sensitive);
@@ -441,9 +423,9 @@ class AppConfigTest extends TestCase {
$value = 'value';
$default = 'default';
$this->appConfigCore->expects($this->once())
- ->method('getValueMixed')
- ->with(self::TEST_APPID, $key, $default)
- ->willReturn($value);
+ ->method('getValueMixed')
+ ->with(self::TEST_APPID, $key, $default)
+ ->willReturn($value);
$this->assertSame($value, $this->appConfig->getAppValue($key, $default));
}
@@ -452,9 +434,9 @@ class AppConfigTest extends TestCase {
$key = 'key';
$default = 'default';
$this->appConfigCore->expects($this->once())
- ->method('getValueMixed')
- ->with(self::TEST_APPID, $key, $default)
- ->willReturn($default);
+ ->method('getValueMixed')
+ ->with(self::TEST_APPID, $key, $default)
+ ->willReturn($default);
$this->assertSame($default, $this->appConfig->getAppValue($key, $default));
}
@@ -472,7 +454,7 @@ class AppConfigTest extends TestCase {
* @see testGetAppValueArray
* @see testGetAppValueArrayException
*/
- public function providerGetAppValue(): array {
+ public static function providerGetAppValue(): array {
return [
// lazy, exist
[false, false],
@@ -483,11 +465,11 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerGetAppValue
*
* @param bool $lazy
* @param bool $exist
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAppValue')]
public function testGetAppValueString(bool $lazy, bool $exist): void {
$key = 'key';
$value = 'valueString';
@@ -495,37 +477,36 @@ class AppConfigTest extends TestCase {
$expected = ($exist) ? $value : $default;
$this->appConfigCore->expects($this->once())
- ->method('getValueString')
- ->with(self::TEST_APPID, $key, $default, $lazy)
- ->willReturn($expected);
+ ->method('getValueString')
+ ->with(self::TEST_APPID, $key, $default, $lazy)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->getAppValueString($key, $default, $lazy));
}
/**
- * @dataProvider providerGetAppValue
- *
* @param bool $lazy
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAppValue')]
public function testGetAppValueStringException(bool $lazy): void {
$key = 'key';
$default = 'default';
$this->appConfigCore->expects($this->once())
- ->method('getValueString')
- ->with(self::TEST_APPID, $key, $default, $lazy)
- ->willThrowException(new AppConfigTypeConflictException());
+ ->method('getValueString')
+ ->with(self::TEST_APPID, $key, $default, $lazy)
+ ->willThrowException(new AppConfigTypeConflictException());
$this->expectException(AppConfigTypeConflictException::class);
$this->appConfig->getAppValueString($key, $default, $lazy);
}
/**
- * @dataProvider providerGetAppValue
*
* @param bool $lazy
* @param bool $exist
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAppValue')]
public function testGetAppValueInt(bool $lazy, bool $exist): void {
$key = 'key';
$value = 42;
@@ -533,37 +514,36 @@ class AppConfigTest extends TestCase {
$expected = ($exist) ? $value : $default;
$this->appConfigCore->expects($this->once())
- ->method('getValueInt')
- ->with(self::TEST_APPID, $key, $default, $lazy)
- ->willReturn($expected);
+ ->method('getValueInt')
+ ->with(self::TEST_APPID, $key, $default, $lazy)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->getAppValueInt($key, $default, $lazy));
}
/**
- * @dataProvider providerGetAppValue
- *
* @param bool $lazy
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAppValue')]
public function testGetAppValueIntException(bool $lazy): void {
$key = 'key';
$default = 17;
$this->appConfigCore->expects($this->once())
- ->method('getValueInt')
- ->with(self::TEST_APPID, $key, $default, $lazy)
- ->willThrowException(new AppConfigTypeConflictException());
+ ->method('getValueInt')
+ ->with(self::TEST_APPID, $key, $default, $lazy)
+ ->willThrowException(new AppConfigTypeConflictException());
$this->expectException(AppConfigTypeConflictException::class);
$this->appConfig->getAppValueInt($key, $default, $lazy);
}
/**
- * @dataProvider providerGetAppValue
*
* @param bool $lazy
* @param bool $exist
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAppValue')]
public function testGetAppValueFloat(bool $lazy, bool $exist): void {
$key = 'key';
$value = 3.14;
@@ -571,37 +551,36 @@ class AppConfigTest extends TestCase {
$expected = ($exist) ? $value : $default;
$this->appConfigCore->expects($this->once())
- ->method('getValueFloat')
- ->with(self::TEST_APPID, $key, $default, $lazy)
- ->willReturn($expected);
+ ->method('getValueFloat')
+ ->with(self::TEST_APPID, $key, $default, $lazy)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->getAppValueFloat($key, $default, $lazy));
}
/**
- * @dataProvider providerGetAppValue
- *
* @param bool $lazy
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAppValue')]
public function testGetAppValueFloatException(bool $lazy): void {
$key = 'key';
$default = 17.04;
$this->appConfigCore->expects($this->once())
- ->method('getValueFloat')
- ->with(self::TEST_APPID, $key, $default, $lazy)
- ->willThrowException(new AppConfigTypeConflictException());
+ ->method('getValueFloat')
+ ->with(self::TEST_APPID, $key, $default, $lazy)
+ ->willThrowException(new AppConfigTypeConflictException());
$this->expectException(AppConfigTypeConflictException::class);
$this->appConfig->getAppValueFloat($key, $default, $lazy);
}
/**
- * @dataProvider providerGetAppValue
*
* @param bool $lazy
* @param bool $exist
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAppValue')]
public function testGetAppValueBool(bool $lazy, bool $exist): void {
$key = 'key';
$value = true;
@@ -609,37 +588,36 @@ class AppConfigTest extends TestCase {
$expected = ($exist) ? $value : $default; // yes, it can be simplified
$this->appConfigCore->expects($this->once())
- ->method('getValueBool')
- ->with(self::TEST_APPID, $key, $default, $lazy)
- ->willReturn($expected);
+ ->method('getValueBool')
+ ->with(self::TEST_APPID, $key, $default, $lazy)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->getAppValueBool($key, $default, $lazy));
}
/**
- * @dataProvider providerGetAppValue
- *
* @param bool $lazy
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAppValue')]
public function testGetAppValueBoolException(bool $lazy): void {
$key = 'key';
$default = false;
$this->appConfigCore->expects($this->once())
- ->method('getValueBool')
- ->with(self::TEST_APPID, $key, $default, $lazy)
- ->willThrowException(new AppConfigTypeConflictException());
+ ->method('getValueBool')
+ ->with(self::TEST_APPID, $key, $default, $lazy)
+ ->willThrowException(new AppConfigTypeConflictException());
$this->expectException(AppConfigTypeConflictException::class);
$this->appConfig->getAppValueBool($key, $default, $lazy);
}
/**
- * @dataProvider providerGetAppValue
*
* @param bool $lazy
* @param bool $exist
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAppValue')]
public function testGetAppValueArray(bool $lazy, bool $exist): void {
$key = 'key';
$value = ['item' => true];
@@ -647,26 +625,25 @@ class AppConfigTest extends TestCase {
$expected = ($exist) ? $value : $default;
$this->appConfigCore->expects($this->once())
- ->method('getValueArray')
- ->with(self::TEST_APPID, $key, $default, $lazy)
- ->willReturn($expected);
+ ->method('getValueArray')
+ ->with(self::TEST_APPID, $key, $default, $lazy)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->getAppValueArray($key, $default, $lazy));
}
/**
- * @dataProvider providerGetAppValue
- *
* @param bool $lazy
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAppValue')]
public function testGetAppValueArrayException(bool $lazy): void {
$key = 'key';
$default = [];
$this->appConfigCore->expects($this->once())
- ->method('getValueArray')
- ->with(self::TEST_APPID, $key, $default, $lazy)
- ->willThrowException(new AppConfigTypeConflictException());
+ ->method('getValueArray')
+ ->with(self::TEST_APPID, $key, $default, $lazy)
+ ->willThrowException(new AppConfigTypeConflictException());
$this->expectException(AppConfigTypeConflictException::class);
$this->appConfig->getAppValueArray($key, $default, $lazy);
@@ -675,16 +652,16 @@ class AppConfigTest extends TestCase {
public function testDeleteAppValue(): void {
$key = 'key';
$this->appConfigCore->expects($this->once())
- ->method('deleteKey')
- ->with(self::TEST_APPID, $key);
+ ->method('deleteKey')
+ ->with(self::TEST_APPID, $key);
$this->appConfig->deleteAppValue($key);
}
public function testDeleteAppValues(): void {
$this->appConfigCore->expects($this->once())
- ->method('deleteApp')
- ->with(self::TEST_APPID);
+ ->method('deleteApp')
+ ->with(self::TEST_APPID);
$this->appConfig->deleteAppValues();
}