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

Refactor phpunit dataprovider to be static #7419

Merged
merged 6 commits into from
May 13, 2024

Conversation

mamazu
Copy link
Contributor

@mamazu mamazu commented May 10, 2024

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Fixed tickets -
Related issues/PRs #6988
License MIT
Documentation PR -

What's in this PR?

Fixing more dataproviders.

Todo

  • src/Sulu/Component/Content/Tests/Unit/Document/Subscriber/PHPCR/SuluNodeTest.php

@mamazu mamazu changed the title Dataprovider fixups WIP: Dataprovider fixups May 10, 2024
@mamazu mamazu marked this pull request as draft May 10, 2024 17:32
@mamazu mamazu force-pushed the dataprovider_fixups branch 4 times, most recently from c3bec53 to 5d49131 Compare May 10, 2024 21:20
@mamazu
Copy link
Contributor Author

mamazu commented May 10, 2024

@alexander-schranz Do you have an idea how to tackle the dataprovider in the SuluNode? Possible options:

  • Reflect all objects that the delegator test needs.
  • Only test a couple of the methods
  • Splitting the datatprovider up in seperate test methods

@alexander-schranz
Copy link
Member

@mamazu let me know when this is ready to review.

@alexander-schranz alexander-schranz added the DX Affecting the end developer label May 13, 2024
@alexander-schranz
Copy link
Member

@mamazu I personally think the dataprovider in SuluNode does not make any sense and would replace it with own test methods. What do you think?

@mamazu
Copy link
Contributor Author

mamazu commented May 13, 2024

Yes, this would make the test much easier as well.


$suluNode = new SuluNode($node->reveal());

$this->assertSame($nodes, iterator_to_array($suluNode->getSharedSet()));
Copy link
Member

Choose a reason for hiding this comment

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

@mamazu if you want to convert a iterable (array / Traversable) to an array you can use [...$suluNode->getSharedSet()] this works with arrays and traversables.

@mamazu mamazu marked this pull request as ready for review May 13, 2024 14:17
@mamazu
Copy link
Contributor Author

mamazu commented May 13, 2024

I think those should be all instances.

@mamazu mamazu changed the title WIP: Dataprovider fixups Replacing Mocks in dataproviders May 13, 2024
@alexander-schranz alexander-schranz changed the title Replacing Mocks in dataproviders Refactor phpunit dataprovider to be static May 13, 2024
@alexander-schranz alexander-schranz merged commit b0d1f49 into sulu:2.5 May 13, 2024
8 checks passed
@alexander-schranz
Copy link
Member

@mamazu Thank you. Already merged also to 2.6

@mamazu mamazu deleted the dataprovider_fixups branch May 13, 2024 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Affecting the end developer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants