diff options
Diffstat (limited to 'tests/lib/RichObjectStrings')
-rw-r--r-- | tests/lib/RichObjectStrings/DefinitionsTest.php | 10 | ||||
-rw-r--r-- | tests/lib/RichObjectStrings/ValidatorTest.php | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/tests/lib/RichObjectStrings/DefinitionsTest.php b/tests/lib/RichObjectStrings/DefinitionsTest.php index 9299a556972..60ea820e844 100644 --- a/tests/lib/RichObjectStrings/DefinitionsTest.php +++ b/tests/lib/RichObjectStrings/DefinitionsTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -7,10 +8,11 @@ namespace Test\RichObjectStrings; use OCP\RichObjectStrings\Definitions; +use OCP\RichObjectStrings\InvalidObjectExeption; use Test\TestCase; class DefinitionsTest extends TestCase { - public function dataGetDefinition() { + public static function dataGetDefinition() { $definitions = new Definitions(); $testsuite = []; foreach ($definitions->definitions as $type => $definition) { @@ -19,9 +21,9 @@ class DefinitionsTest extends TestCase { return $testsuite; } - + public function testGetDefinitionNotExisting(): void { - $this->expectException(\OCP\RichObjectStrings\InvalidObjectExeption::class); + $this->expectException(InvalidObjectExeption::class); $this->expectExceptionMessage('Object type is undefined'); $definitions = new Definitions(); @@ -29,10 +31,10 @@ class DefinitionsTest extends TestCase { } /** - * @dataProvider dataGetDefinition * @param string $type * @param array $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataGetDefinition')] public function testGetDefinition($type, array $expected): void { $definitions = new Definitions(); $definition = $definitions->getDefinition($type); diff --git a/tests/lib/RichObjectStrings/ValidatorTest.php b/tests/lib/RichObjectStrings/ValidatorTest.php index c5ce1f04dad..26688d3401a 100644 --- a/tests/lib/RichObjectStrings/ValidatorTest.php +++ b/tests/lib/RichObjectStrings/ValidatorTest.php @@ -39,7 +39,7 @@ class ValidatorTest extends TestCase { $this->expectException(InvalidObjectExeption::class); - $this->expectExceptionMessage('Object is invalid, value 123 is not a string'); + $this->expectExceptionMessage('Object for placeholder string1 is invalid, value 123 for key key is not a string'); $v->validate('test {string1} test.', [ 'string1' => [ 'type' => 'user', @@ -49,7 +49,7 @@ class ValidatorTest extends TestCase { ], ]); - $this->expectExceptionMessage('Object is invalid, key 456 is not a string'); + $this->expectExceptionMessage('Object for placeholder string1 is invalid, key 456 is not a string'); $v->validate('test {string1} test.', [ 'string1' => [ 'type' => 'user', @@ -80,9 +80,7 @@ class ValidatorTest extends TestCase { ]; } - /** - * @dataProvider dataValidateParameterKeys - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataValidateParameterKeys')] public function testValidateParameterKeys(mixed $key, ?string $throws): void { if ($throws !== null) { |