mirror of
https://github.com/opdavies/build-configs.git
synced 2025-03-13 05:26:56 +00:00
test: project name should be a string
This commit is contained in:
parent
de6dc1851c
commit
f25395d877
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
/.phpunit.result.cache
|
||||
/build/
|
||||
/vendor/
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
<?php
|
||||
|
||||
test('example', function () {
|
||||
expect(true)->toBeTrue();
|
||||
});
|
23
tests/Validator/ConfigurationValidatorTest.php
Normal file
23
tests/Validator/ConfigurationValidatorTest.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
use OliverDaviesLtd\BuildConfigs\Validator\ConfigurationValidator;
|
||||
|
||||
beforeEach(function (): void {
|
||||
$this->validator = new ConfigurationValidator();
|
||||
});
|
||||
|
||||
test('The project name should be a string', function (mixed $projectName, int $expectedViolationCount) {
|
||||
$configuration = [
|
||||
'name' => $projectName,
|
||||
];
|
||||
|
||||
expect($this->validator->validate($configuration))
|
||||
->toHaveCount($expectedViolationCount);
|
||||
})->with(function () {
|
||||
yield 'Non-empty string' => ['test', 0];
|
||||
yield 'Empty string' => ['', 1];
|
||||
yield 'Integer' => [1, 1];
|
||||
yield 'Null' => [null, 1];
|
||||
yield 'True' => [true, 1];
|
||||
yield 'False' => [false, 2];
|
||||
});
|
Loading…
Reference in a new issue