Skip to content

Commit

Permalink
Files/TestDoubles: bug fix - not all tests were being run
Browse files Browse the repository at this point in the history
There was a bug in the `glob` expression used to collect all the test case files, which meant that not all test case files were found and checked during the test runs.

Fixed now. Includes one minor, non-consequential fix to the test expectations.
  • Loading branch information
jrfnl committed Nov 3, 2023
1 parent f84b4aa commit cf886cb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Yoast/Tests/Files/TestDoublesUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function setCliValues( $testFile, $config ) {
*/
protected function getTestFiles( $testFileBase ) {
$sep = \DIRECTORY_SEPARATOR;
$test_files = \glob( \dirname( $testFileBase ) . $sep . 'TestDoublesUnitTests{' . $sep . ',' . $sep . '*' . $sep . '}*.inc', \GLOB_BRACE );
$test_files = \glob( \dirname( $testFileBase ) . $sep . 'TestDoublesUnitTests' . $sep . 'tests{' . $sep . ',' . $sep . '*' . $sep . '}*.inc', \GLOB_BRACE );

if ( ! empty( $test_files ) ) {
return $test_files;
Expand Down Expand Up @@ -117,7 +117,7 @@ public function getErrorList( $testFile = '' ) {
// In tests/mocks.
case 'correct-custom-dir-not-mock.inc':
return [
3 => 1,
4 => 1,
];

case 'not-double-or-mock.inc': // In tests.
Expand Down

0 comments on commit cf886cb

Please sign in to comment.