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

DX: remove recursion from AbstractIntegrationTestCase::testIntegration #7577

Merged
merged 2 commits into from Dec 21, 2023
Merged

DX: remove recursion from AbstractIntegrationTestCase::testIntegration #7577

merged 2 commits into from Dec 21, 2023

Conversation

kubawerlos
Copy link
Contributor

The (re)moved testIntegration call was inside of doTest (called in line 148, which is inside of testIntegration).

@coveralls
Copy link

coveralls commented Dec 16, 2023

Coverage Status

coverage: 94.795%. remained the same
when pulling fc4eebf on 6b7562617765726c6f73:dx_AbstractIntegrationTestCase
into 34b7d63 on PHP-CS-Fixer:master.

Comment on lines 148 to +151
$this->doTest($case);

// run the test again with the `expected` part, this should always stay the same
$this->doTest(
Copy link
Member

@keradus keradus Dec 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm mid-mid here.

this approach means whenever someone calling ->doTest(), they shall always call it twice. I'm not sure if it's good.
(i know there are not so many cases we call it, but imagine we make this AbstractIntegrationTestCase public ultimately, for libraries of custom repos)

maybe they can continue to call it once, and in doTest we do like

function doTest() {
    check reqs for PHP...

    $this->verifyIntegration($expected, $input); // of course, full IntegrationCase to be passed
    $this->verifyIntegration($expected, null);
}

or even
function doTest() {
    check reqs for PHP...

    foreach ([$epected, $input], [$expected, null])
        regular testing logic....
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't the previous implementation even worse? Anyone calling doTest would also call testIntegration. We can refactor this later, this one is only about removing recursion.

Copy link
Member

@keradus keradus Dec 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't the previous implementation even worse?

thus I gave the approval, right? ;)

@kubawerlos kubawerlos merged commit 8058b05 into PHP-CS-Fixer:master Dec 21, 2023
25 checks passed
@kubawerlos kubawerlos deleted the dx_AbstractIntegrationTestCase branch December 21, 2023 15:00
danog pushed a commit to zoonru/PHP-CS-Fixer that referenced this pull request Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants