diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index 4442bbb9..686d701e 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -648,6 +648,7 @@ ✓ it alerts users about tests with arguments but no input ✓ it can return an array of all test suite filenames ✓ it can filter the test suite filenames to those with the only method + ✓ it does not filter the test suite filenames to those with the only method when working in CI pipeline PASS Tests\Visual\Help ✓ visual snapshot of help command output @@ -681,5 +682,5 @@ ✓ it is a test ✓ it uses correct parent class - Tests: 4 incompleted, 9 skipped, 447 passed + Tests: 4 incompleted, 9 skipped, 448 passed \ No newline at end of file diff --git a/tests/Unit/TestSuite.php b/tests/Unit/TestSuite.php index 7d6c88a9..383506a3 100644 --- a/tests/Unit/TestSuite.php +++ b/tests/Unit/TestSuite.php @@ -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', + ]); +});