-
Notifications
You must be signed in to change notification settings - Fork 325
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
Updating to phpunit 10 #7339
base: 2.6
Are you sure you want to change the base?
Updating to phpunit 10 #7339
Conversation
8c367cb
to
3c127eb
Compare
d433aa5
to
b612f25
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not yet review the whole part. I think we should cherry pick only the required changes out of this pull request. We should not do any type refactoring in it as that makes review here hard and too big, we should keep such things seperated.
On some places prophesize was replaced with PHPUnit mock, we are still using prophosize so that replacement is not required and should stay as it is at current state.
...Bundle/AudienceTargetingBundle/Tests/Unit/Controller/TargetGroupEvaluationControllerTest.php
Outdated
Show resolved
Hide resolved
...Bundle/AudienceTargetingBundle/Tests/Unit/Controller/TargetGroupEvaluationControllerTest.php
Outdated
Show resolved
Hide resolved
src/Sulu/Bundle/ContactBundle/Tests/Functional/Controller/AccountMediaControllerTest.php
Outdated
Show resolved
Hide resolved
@@ -179,7 +177,7 @@ private function createTag($name) | |||
return $tag; | |||
} | |||
|
|||
private function createMedia($title, $collection, $mimeType, $type, $tags = [], $targetGroups = []) | |||
private function createMedia($title, $collection, $mimeType, $type, $tags = [], $targetGroups = []): Media |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should reallly focus just on the PHPUnit update this get lot of hard to review things if we do here such refactorings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test method changes should be done on 2.5 branch if possible and non breaking changes
Todos:
|
456b658
to
e5365b0
Compare
f11f153
to
b604859
Compare
3939947
to
98a2ab4
Compare
phpunit.xml.dist
Outdated
bootstrap="./vendor/autoload.php" | ||
colors="true" | ||
failOnIncomplete="true" | ||
failOnWarning="true" | ||
failOnRisky="true" | ||
> | ||
<coverage> | ||
cacheDirectory=".phpunit.cache"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to configure this? Would keep this on default if possible.
To make switching between 2.5 <-> 2.6 easier for this who don't have such files in there global gitignore we should add the directory also to the .gitignore
file of the 2.5
branch. Can you target a merge request for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean it's the default value for phpunit so we don't have to specify it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I would remove the config and just add the new directory to the .gitignore file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just saw that the cache file is already in the .gitignore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some changes I would backport to the 2.5 branch. Mostly this pull request for 2.6 should then contain only phpunit.xml required changes and data provider changes.
yield ['sulu_io', 'test-1', ['property1' => 'test1', 'property2' => 'test2']]; | ||
yield ['sulu_io', 'test-2', null]; | ||
yield ['sulu_io', 'test-3', self::createStub(NodeInterface::class)]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do such changes on the 2.5 branch?
$dir = __DIR__ . '/../../../../../../tests/Resources'; | ||
|
||
return $dir; | ||
return __DIR__ . '/../../../../../../tests/Resources'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do such changes on the 2.5 branch?
yield ['sulu_io', 'test-1', '123-123-123', true]; | ||
yield ['sulu_io', 'test-1', '123-123-123', false]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do such changes on the 2.5 branch?
$webspaceKey = 'sulu_io'; | ||
$key = 'test-1'; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
??? looks like unexpected change
*/ | ||
public function testSave($webspaceKey, $key, $data): void | ||
#[\PHPUnit\Framework\Attributes\DataProvider('dataProvider')] | ||
public function testSave(string $webspaceKey, string $key, array|NodeInterface|null $data): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should do such changes on the 2.5 branch
@@ -179,7 +177,7 @@ private function createTag($name) | |||
return $tag; | |||
} | |||
|
|||
private function createMedia($title, $collection, $mimeType, $type, $tags = [], $targetGroups = []) | |||
private function createMedia($title, $collection, $mimeType, $type, $tags = [], $targetGroups = []): Media |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test method changes should be done on 2.5 branch if possible and non breaking changes
array $targetGroups, | ||
array $ruleWhitelists, | ||
?string $webspaceKey, | ||
?TargetGroup $evaluatedTargetGroup, | ||
int $frequency = TargetGroupRuleInterface::FREQUENCY_SESSION, | ||
?TargetGroup $currentTargetGroup = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test method changes should be done on 2.5 branch if possible and non breaking changes
@@ -99,7 +97,7 @@ public function testEvaluate( | |||
$this->assertEquals($evaluatedTargetGroup, $this->targetGroupEvaluator->evaluate($frequency, $currentTargetGroup)); | |||
} | |||
|
|||
public static function provideEvaluationData() | |||
public static function provideEvaluationData(): array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test method changes should be done on 2.5 branch if possible and non breaking changes
@@ -441,7 +429,7 @@ public function testAddTargetGroupHitScript( | |||
$this->assertEquals('<body><script></script></body>', $response->getContent()); | |||
} | |||
|
|||
public static function provideAddTargetGroupHitScript() | |||
public static function provideAddTargetGroupHitScript(): array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test method changes should be done on 2.5 branch if possible and non breaking changes
|
||
<listeners> | ||
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/> | ||
</listeners> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also remove this listener on the 2.5 to be consistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did that in #7432
What's in this PR?
Updating phpunit to version 10 and fixing the tests
composer.json
Why?
It's always a good idea to have an up to date testing library.
To Do