Skip to content

[Scheduler] Fix optional $count variable in testGetNextRunDates #59125

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

Merged
merged 1 commit into from
Dec 14, 2024

Conversation

codedmonkey
Copy link
Contributor

Q A
Branch? 6.4
Bug fix? yes (in tests)
New feature? no
Deprecations? no
Issues N/A
License MIT

Fixes a weird side effect of the optional $count variable in testGetNextRunDates, because it uses the Null Coalescing Operator it was always expecting 0 iterations if not passing a value from the provider.

It doesn't need to be optional because it's always passed from the provider so we could just make it a required variable.

@carsonbot
Copy link

Hey!

Thanks for your PR. You are targeting branch "7.3" but it seems your PR description refers to branch "6.4".
Could you update the PR description or change target branch? This helps core maintainers a lot.

Cheers!

Carsonbot

@codedmonkey codedmonkey changed the base branch from 7.3 to 6.4 December 7, 2024 11:32
@codedmonkey codedmonkey force-pushed the periodical-trigger-test branch from 859e07a to 88e6b36 Compare December 7, 2024 11:35
@@ -108,7 +108,7 @@ public static function provideForToString()
/**
* @dataProvider providerGetNextRunDates
*/
public function testGetNextRunDates(\DateTimeImmutable $from, TriggerInterface $trigger, array $expected, int $count = 0)
public function testGetNextRunDates(\DateTimeImmutable $from, TriggerInterface $trigger, array $expected, ?int $count = null)
Copy link
Member

Choose a reason for hiding this comment

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

we never pass null either indeed:

Suggested change
public function testGetNextRunDates(\DateTimeImmutable $from, TriggerInterface $trigger, array $expected, ?int $count = null)
public function testGetNextRunDates(\DateTimeImmutable $from, TriggerInterface $trigger, array $expected, int $count)

and let's remove the ?? count below

@OskarStark OskarStark changed the title [Scheduler] Fix optional count variable in testGetNextRunDates [Scheduler] Fix optional $count variable in testGetNextRunDates Dec 7, 2024
@codedmonkey
Copy link
Contributor Author

Thanks Nicolas. Changed made!

@codedmonkey codedmonkey force-pushed the periodical-trigger-test branch from 88e6b36 to d8fa076 Compare December 12, 2024 14:37
@fabpot fabpot modified the milestones: 7.3, 6.4 Dec 14, 2024
@fabpot
Copy link
Member

fabpot commented Dec 14, 2024

Good catch, thanks @codedmonkey.

@fabpot fabpot merged commit 80b0826 into symfony:6.4 Dec 14, 2024
9 of 11 checks passed
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.

6 participants