mirror of
https://github.com/opdavies/build-configs.git
synced 2025-09-05 10:55:33 +01:00
refactor(*): change to a Symfony Console app
This commit is contained in:
parent
4af661bad4
commit
8db64458b1
41 changed files with 5938 additions and 4285 deletions
|
@ -1,45 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Test Case
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The closure you provide to your test functions is always bound to a specific PHPUnit test
|
||||
| case class. By default, that class is "PHPUnit\Framework\TestCase". Of course, you may
|
||||
| need to change it using the "uses()" function to bind a different classes or traits.
|
||||
|
|
||||
*/
|
||||
|
||||
// uses(Tests\TestCase::class)->in('Feature');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Expectations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When you're writing tests, you often need to check that values meet certain conditions. The
|
||||
| "expect()" function gives you access to a set of "expectations" methods that you can use
|
||||
| to assert different things. Of course, you may extend the Expectation API at any time.
|
||||
|
|
||||
*/
|
||||
|
||||
expect()->extend('toBeOne', function () {
|
||||
return $this->toBe(1);
|
||||
});
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Functions
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| While Pest is very powerful out-of-the-box, you may have some testing code specific to your
|
||||
| project that you don't want to repeat in every file. Here you can also expose helpers as
|
||||
| global functions to help you to reduce the number of lines of code in your test files.
|
||||
|
|
||||
*/
|
||||
|
||||
function something()
|
||||
{
|
||||
// ..
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
<?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];
|
||||
});
|
||||
|
||||
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];
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue