Uses Collision ^7.0

This commit is contained in:
Nuno Maduro
2022-09-15 01:07:15 +01:00
parent eab944023c
commit 3ff95faaaa
47 changed files with 646 additions and 308 deletions

View File

@ -10,8 +10,8 @@ it('show only the names of named datasets in their description', function () {
],
]));
expect($descriptions[0])->toBe('test description with data set "one"');
expect($descriptions[1])->toBe('test description with data set "two"');
expect($descriptions[0])->toBe('data set "one"')
->and($descriptions[1])->toBe('data set "two"');
});
it('show the actual dataset of non-named datasets in their description', function () {
@ -22,8 +22,8 @@ it('show the actual dataset of non-named datasets in their description', functio
],
]));
expect($descriptions[0])->toBe('test description with (1)');
expect($descriptions[1])->toBe('test description with (array(2))');
expect($descriptions[0])->toBe('(1)');
expect($descriptions[1])->toBe('(array(2))');
});
it('show only the names of multiple named datasets in their description', function () {
@ -38,10 +38,10 @@ it('show only the names of multiple named datasets in their description', functi
],
]));
expect($descriptions[0])->toBe('test description with data set "one" / data set "three"');
expect($descriptions[1])->toBe('test description with data set "one" / data set "four"');
expect($descriptions[2])->toBe('test description with data set "two" / data set "three"');
expect($descriptions[3])->toBe('test description with data set "two" / data set "four"');
expect($descriptions[0])->toBe('data set "one" / data set "three"');
expect($descriptions[1])->toBe('data set "one" / data set "four"');
expect($descriptions[2])->toBe('data set "two" / data set "three"');
expect($descriptions[3])->toBe('data set "two" / data set "four"');
});
it('show the actual dataset of multiple non-named datasets in their description', function () {
@ -56,10 +56,10 @@ it('show the actual dataset of multiple non-named datasets in their description'
],
]));
expect($descriptions[0])->toBe('test description with (1) / (3)');
expect($descriptions[1])->toBe('test description with (1) / (array(4))');
expect($descriptions[2])->toBe('test description with (array(2)) / (3)');
expect($descriptions[3])->toBe('test description with (array(2)) / (array(4))');
expect($descriptions[0])->toBe('(1) / (3)');
expect($descriptions[1])->toBe('(1) / (array(4))');
expect($descriptions[2])->toBe('(array(2)) / (3)');
expect($descriptions[3])->toBe('(array(2)) / (array(4))');
});
it('show the correct description for mixed named and not-named datasets', function () {
@ -74,8 +74,8 @@ it('show the correct description for mixed named and not-named datasets', functi
],
]));
expect($descriptions[0])->toBe('test description with data set "one" / (3)');
expect($descriptions[1])->toBe('test description with data set "one" / data set "four"');
expect($descriptions[2])->toBe('test description with (array(2)) / (3)');
expect($descriptions[3])->toBe('test description with (array(2)) / data set "four"');
expect($descriptions[0])->toBe('data set "one" / (3)');
expect($descriptions[1])->toBe('data set "one" / data set "four"');
expect($descriptions[2])->toBe('(array(2)) / (3)');
expect($descriptions[3])->toBe('(array(2)) / data set "four"');
});

View File

@ -20,7 +20,8 @@ it('does not allow to add the same test description twice', function () {
it('alerts users about tests with arguments but no input', function () {
$testSuite = new TestSuite(getcwd(), 'tests');
$method = new TestCaseMethodFactory('foo', 'bar', function (int $arg) {});
$method = new TestCaseMethodFactory('foo', 'bar', function (int $arg) {
});
$testSuite->tests->set($method);
})->throws(
@ -29,7 +30,7 @@ it('alerts users about tests with arguments but no input', function () {
);
it('can return an array of all test suite filenames', function () {
$testSuite = TestSuite::getInstance(getcwd(), 'tests');
$testSuite = new TestSuite(getcwd(), 'tests');
$testSuite->tests->set(new TestCaseMethodFactory('a', 'b', null));
$testSuite->tests->set(new TestCaseMethodFactory('c', 'd', null));
@ -57,9 +58,10 @@ it('can filter the test suite filenames to those with the only method', function
it('does not filter the test suite filenames to those with the only method when working in CI pipeline', function () {
$previousEnvironment = Environment::name();
Environment::name(Environment::CI);
$testSuite = TestSuite::getInstance(getcwd(), 'tests');
$testSuite = new TestSuite(getcwd(), 'tests');
$test = function () {};
$test = function () {
};
$testWithOnly = new TestCaseMethodFactory('a', 'b', null);
$testWithOnly->only = true;