Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YoastCS: fix some tests not running #316

Merged
merged 2 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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