Skip to content

[TwigComponent][Docs] add explicit string cast on string assertions #2507

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

Conversation

Valmonzo
Copy link
Contributor

@Valmonzo Valmonzo commented Jan 17, 2025

Q A
Bug fix? no
New feature? no
Issues
License MIT

Following the examples from the documentation, I realized that if we use the TestLiveComponent::render method in assertStringContainsString and if we use strict types, then it throw an error because we try to assert a RenderedComponent object instead of a string.

I think that explicitly adding the cast can help.

@carsonbot carsonbot added docs Improvements or additions to documentation TwigComponent Status: Needs Review Needs to be reviewed labels Jan 17, 2025
@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Jan 17, 2025
@Kocal
Copy link
Member

Kocal commented Jan 17, 2025

Indeed, it's a good documentation improvement that will help with silly mistakes. Thanks @Valmonzo

@Kocal Kocal merged commit dc6e6e4 into symfony:2.x Jan 17, 2025
2 checks passed
@Valmonzo Valmonzo deleted the twigcomponent/add-string-cast-on-rendredcomponent branch January 17, 2025 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation Status: Reviewed Has been reviewed by a maintainer TwigComponent
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants