Skip to content

Commit

Permalink
NamingConventions/NamespaceName: 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.
  • Loading branch information
jrfnl committed Nov 3, 2023
1 parent cf886cb commit 85eb928
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Yoast/Tests/NamingConventions/NamespaceNameUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,15 @@ public function setCliValues( $testFile, $config ) {
*/
protected function getTestFiles( $testFileBase ) {
$sep = \DIRECTORY_SEPARATOR;
$test_files = \glob( \dirname( $testFileBase ) . $sep . 'NamespaceNameUnitTests{' . $sep . ',' . $sep . '*' . $sep . '}*.inc', \GLOB_BRACE );
$test_files = \glob(
\dirname( $testFileBase ) . $sep . 'NamespaceNameUnitTests{'
. $sep . ',' // Files in the "NamespaceNameUnitTests" directory.
. $sep . '*' . $sep . ',' // Files in first-level subdirectories.
. $sep . '*' . $sep . '*' . $sep . ',' // Files in second-level subdirectories.
. $sep . '*' . $sep . '*' . $sep . '*' . $sep // Files in third-level subdirectories.
. '}*.inc',
\GLOB_BRACE
);

if ( ! empty( $test_files ) ) {
return $test_files;
Expand Down

0 comments on commit 85eb928

Please sign in to comment.