Skip to content

Commit

Permalink
Add a basic test for the validation client due to codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
SecondeJK committed Jul 2, 2024
1 parent 7278f1c commit 0bec49c
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/Client/Exception/Validation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);

namespace VonageTest\Client\Exception;

use PHPUnit\Framework\TestCase;
use Vonage\Client\Exception\Exception;

class Validation extends TestCase
{
public function testValidationException()
{
$message = 'Validation failed';
$code = 422;
$previous = new Exception('Previous exception');
$errors = [
'field1' => 'Error message 1',
'field2' => 'Error message 2'
];

$exception = new Validation($message, $code, $previous, $errors);

// Assert the exception message
$this->assertEquals($message, $exception->getMessage());

// Assert the exception code
$this->assertEquals($code, $exception->getCode());

// Assert the previous exception
$this->assertSame($previous, $exception->getPrevious());

// Assert the validation errors
$this->assertEquals($errors, $exception->getValidationErrors());
}
}

0 comments on commit 0bec49c

Please sign in to comment.