adds test for CI env runs

This commit is contained in:
Fabio Ivona
2021-09-22 10:38:21 +02:00
parent dd643faa5c
commit b22f5e0c85
2 changed files with 21 additions and 3 deletions

View File

@ -24,7 +24,7 @@ it('alerts users about tests with arguments but no input', function () {
);
it('can return an array of all test suite filenames', function () {
$testSuite = new TestSuite(getcwd(), 'tests');
$testSuite = TestSuite::getInstance(getcwd(), 'tests');
$test = function () {};
$testSuite->tests->set(new \Pest\Factories\TestCaseFactory(__FILE__, 'foo', $test));
$testSuite->tests->set(new \Pest\Factories\TestCaseFactory(__FILE__, 'bar', $test));
@ -36,7 +36,7 @@ it('can return an array of all test suite filenames', function () {
});
it('can filter the test suite filenames to those with the only method', function () {
$testSuite = new TestSuite(getcwd(), 'tests');
$testSuite = TestSuite::getInstance(getcwd(), 'tests');
$test = function () {};
$testWithOnly = new \Pest\Factories\TestCaseFactory(__FILE__, 'foo', $test);
@ -49,3 +49,20 @@ it('can filter the test suite filenames to those with the only method', function
__FILE__,
]);
});
it('does not filter the test suite filenames to those with the only method when working in CI pipeline', function(){
$testSuite = TestSuite::getInstance(getcwd(), 'tests', 'ci');
$test = function () {};
$testWithOnly = new \Pest\Factories\TestCaseFactory(__FILE__, 'foo', $test);
$testWithOnly->only = true;
$testSuite->tests->set($testWithOnly);
$testSuite->tests->set(new \Pest\Factories\TestCaseFactory('Baz/Bar/Boo.php', 'bar', $test));
expect($testSuite->tests->getFilenames())->toEqual([
__FILE__,
'Baz/Bar/Boo.php',
]);
});