From 9610657c53f74203e816da6adf3937d8f5b39573 Mon Sep 17 00:00:00 2001 From: Andrew Longosz Date: Thu, 27 Jun 2024 13:25:41 +0200 Subject: [PATCH] [Tests] Added unit coverage for ContentFieldValidationException --- .../ContentFieldValidationExceptionTest.php | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 tests/lib/Base/Exception/ContentFieldValidationExceptionTest.php diff --git a/tests/lib/Base/Exception/ContentFieldValidationExceptionTest.php b/tests/lib/Base/Exception/ContentFieldValidationExceptionTest.php new file mode 100644 index 0000000000..e5ea72f6e5 --- /dev/null +++ b/tests/lib/Base/Exception/ContentFieldValidationExceptionTest.php @@ -0,0 +1,72 @@ + [ + 'eng-GB' => [ + new ValidationError('error 1'), new ValidationError('error 2'), + ], + 'pol-PL' => [ + new ValidationError('error 1'), new ValidationError('error 2'), + ], + ], + 456 => [ + 'pol-PL' => [ + new ValidationError('error 3'), new ValidationError('error 4'), + ], + 'eng-GB' => [ + new ValidationError('error 3'), new ValidationError('error 4'), + ], + ], + ]; + + $exception = new ContentFieldValidationException($errors); + + self::assertSame($errors, $exception->getFieldErrors()); + + return $exception; + } + + /** + * @depends testGetFieldErrors + */ + public function testCreateNewWithMultiline(ContentFieldValidationException $exception): void + { + $newException = ContentFieldValidationException::createNewWithMultiline( + $exception->getFieldErrors(), + 'My Content' + ); + + $expectedExceptionMessage = <<getMessage()); + } +}