Skip to content

Commit

Permalink
Merge pull request #316 from Yoast/JRF/yoastcs-fix-some-tests-not-run…
Browse files Browse the repository at this point in the history
…ning

YoastCS: fix some tests not running
  • Loading branch information
jrfnl authored Nov 3, 2023
2 parents f84b4aa + 85eb928 commit 7f0ba01
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 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
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 7f0ba01

Please sign in to comment.