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

feat: add #[WithStory] attribute #728

Merged
merged 4 commits into from
Dec 4, 2024

Conversation

nikophil
Copy link
Member

@nikophil nikophil commented Dec 2, 2024

fixes #430

  • feat: introduce WithStory attribute
  • feat: apply WithStory attribute at class level
  • feat: allow WithStory attribute on parent class

I think that only an attribute related to stories is useful, I don't see any practical usage of an attribute related to factories

TODO:

  • story service should work
  • only load story once if it is added to a class? Maybe this will be conditioned by a boolean won't be made

@nikophil nikophil changed the title feat/with story attribute feat: introduce story attribute Dec 2, 2024
@nikophil nikophil marked this pull request as draft December 2, 2024 13:45
@nikophil nikophil force-pushed the feat/with-story-attribute branch 6 times, most recently from 0f80faa to dd93952 Compare December 2, 2024 19:19
@kbond
Copy link
Member

kbond commented Dec 2, 2024

only load story once if it is added to a class? Maybe this will be conditioned by a boolean

So this would only load the story before the first test in a class?

@nikophil
Copy link
Member Author

nikophil commented Dec 3, 2024

That's what I have in mind, but I'm afraid it's would be too much complicated, we have to hack into dama and reset database for this, but I'll give this a chance in another PR

@nikophil nikophil marked this pull request as ready for review December 3, 2024 06:45
@kbond
Copy link
Member

kbond commented Dec 3, 2024

This is soooo cool, I love it!

but I'm afraid it's would be too much complicated,

Yeah, this feels complex and I'm worried about breaking test isolation. Kind of a sub-global state...

@nikophil
Copy link
Member Author

nikophil commented Dec 3, 2024

This is soooo cool, I love it!

super nice ❤️
sadly, if you're still not using PHPUnit 10, you won't be able to use this feature 😕

Yeah, this feels complex and I'm worried about breaking test isolation. Kind of a sub-global state...

yes I think I won't even try, I've checked how dama works and it would require some ugly stuff to make this work.

BTW, the PR is RFR now, I've added some docs as well.

@nikophil nikophil force-pushed the feat/with-story-attribute branch from e08cd21 to 5cc3170 Compare December 4, 2024 06:38
docs/index.rst Outdated Show resolved Hide resolved
@nikophil nikophil force-pushed the feat/with-story-attribute branch from 5cc3170 to 61b07ae Compare December 4, 2024 12:23
@nikophil nikophil requested a review from kbond December 4, 2024 12:23
docs/index.rst Outdated Show resolved Hide resolved
docs/index.rst Show resolved Hide resolved
@kbond
Copy link
Member

kbond commented Dec 4, 2024

Can you move the versionadded/warnings to directly below the subtitle? I feel like people might get excited about the feature and start using without reading below. :)

@nikophil nikophil force-pushed the feat/with-story-attribute branch 2 times, most recently from 56cf744 to 60979ee Compare December 4, 2024 12:44
@kbond kbond changed the title feat: introduce story attribute feat: add #[WithStory] attribute Dec 4, 2024
@nikophil nikophil force-pushed the feat/with-story-attribute branch from 60979ee to b2d99fd Compare December 4, 2024 12:59
@nikophil nikophil force-pushed the feat/with-story-attribute branch from b2d99fd to baa1fd4 Compare December 4, 2024 13:07
@nikophil nikophil merged commit 0867ad6 into zenstruck:2.x Dec 4, 2024
38 checks passed
@nikophil nikophil deleted the feat/with-story-attribute branch December 4, 2024 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Add #[WithStory] attribute
2 participants