From e223181ab7152ad214fca38ec1fb16b83be64a3f Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 11 Mar 2023 01:11:21 +0000 Subject: [PATCH] test: language should be a supported language --- tests/Validator/ConfigurationValidatorTest.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/Validator/ConfigurationValidatorTest.php b/tests/Validator/ConfigurationValidatorTest.php index 4885b84..ca34691 100644 --- a/tests/Validator/ConfigurationValidatorTest.php +++ b/tests/Validator/ConfigurationValidatorTest.php @@ -21,3 +21,20 @@ test('The project name should be a string', function (mixed $projectName, int $e yield 'True' => [true, 1]; yield 'False' => [false, 2]; }); + +test('The project language should be a supported language', function (mixed $language, int $expectedViolationCount) { + $configuration = [ + 'language' => $language, + ]; + + expect($this->validator->validate($configuration)) + ->toHaveCount($expectedViolationCount); +})->with(function () { + yield 'Supported language string' => ['php', 0]; + yield 'Non-supported language string' => ['not-supported', 1]; + yield 'Empty string' => ['', 1]; + yield 'Integer' => [1, 2]; + yield 'Null' => [null, 1]; + yield 'True' => [true, 2]; + yield 'False' => [false, 2]; +});