Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Testing] Add docs for new WebTestCase assertions#11271

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
wouterj merged 1 commit intosymfony:masterfromPierstoval:assertions
Apr 7, 2019
Merged

[Testing] Add docs for new WebTestCase assertions#11271

wouterj merged 1 commit intosymfony:masterfromPierstoval:assertions
Apr 7, 2019

Conversation

@Pierstoval
Copy link
Contributor

@PierstovalPierstoval changed the titleAdd basics of new WebTestCase assertions[Testing] Add docs for new WebTestCase assertionsApr 1, 2019
@Pierstoval
Copy link
ContributorAuthor

Should I add examples for every assertion? To me they all seem self-explanatory, but I could be more exhaustive with examples 😄

@Pierstoval
Copy link
ContributorAuthor

Also, to reference this page in a better way in the docs (so it can be easily accessible), I may need some advices and tips on where I could add links to this new page 👍

@OskarStark
Copy link
Contributor

Hey Alex, thank you for this nice new feature and the documentation so far.

To be honest I am not sure if replacing the explicit example with the shortcuts is the right way.
I think the user should what is done internally. An idea could be to write it that way:

$this->assertGreaterThan(0,$crawler->filter('html:contains("Hello World")')->count()    );// or use a shortcut$this->assertSelectorTextContains('html','Hello World');

Not sure we should add so manyversionadded directive (I mean for every new method one). I am for grouping them under a sub-headline. and add only oneversionadded.

What do you think @symfony/team-symfony-docs ?

Copy link
Contributor

@OskarStarkOskarStark left a comment

Choose a reason for hiding this comment

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

I left some thoughts which could improve the docs a bit. 💭
You should not change everything before we heard some other thoughts from the docs-team.

friendly ping @symfony/team-symfony-docs ❤️

..note::

These assertions will not work with `symfony/panther`_ as they use the
``Request`` and ``Response`` objects coming from the ``HttpFoundation``
Copy link
Member

Choose a reason for hiding this comment

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

I would remove the explanation about why they don't work with Panther (nobody cares). Wouldn't it be possible to make them work?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe not adding it directly here, but adding a Troubleshooting headline at the end and explain the panther case sounds helpful to me.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

To make them work we should make all assertions compatible with bothHttpFoundation andBrowserKit classes (especiallyRequest andResponse), and make sure theBrowser class used is also compatible with Panther.

Copy link
Member

Choose a reason for hiding this comment

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

... which is quite possible, right? I suppose you meant "constraints" and not "assertions" here.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Yep, I wasn't originally planning to use constraints, but since you updated the PR with it, we can make them compatible with both classes indeed 😄

@Pierstoval
Copy link
ContributorAuthor

Thanks for the review! I'm a bit busy this week but I'll fix everything as soon as possible 👍

OskarStark reacted with thumbs up emoji

@Pierstoval
Copy link
ContributorAuthor

I fixed many of your reviews, and I think we should also plan to make the assertions compatible with Panther for more flexibility 👍

OskarStark and andreybolonin reacted with heart emoji

Copy link
Contributor

@OskarStarkOskarStark left a comment

Choose a reason for hiding this comment

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

I left some minor comments!

@Pierstoval
Copy link
ContributorAuthor

Pierstoval commentedApr 3, 2019
edited
Loading

@OskarStark Implemented your reviews 😉

OskarStark reacted with hooray emoji

@Pierstoval
Copy link
ContributorAuthor

About the Panther compatibility, I think we should update Panther itself first, because ofthese lines throwing an exception ongetRequest() andgetResponse().

dbrumann reacted with thumbs up emoji

testing.rst Outdated

This assertion will internally call ``$crawler->filter('html')``, which allows
you to use CSS selectors to filter any HTML element in the page and check for
its existence, attributes, text, etc.
Copy link
Member

Choose a reason for hiding this comment

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

As the new method is much nicer than the previous one, let's update the code example directly using this assertion. We can then reduce this.. versionadded:: directive to "The WebTestCase assertions were introduced in Symfony 4.3." and add the.. seealso:: directive below it.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I just added what you suggested, what do you think? 🙂

Response
~~~~~~~~

- ``assertResponseIsSuccessful()``
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it is usefull to have the full signature here or transform them all to:method:`` links?

Copy link
Contributor

Choose a reason for hiding this comment

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

We decided to not do this because Symfony API isn’t available anymore.

Yesterday I talked to@Nyholm,@dmaicher and@xabbuh about fixing this by unsung github. MaBe you can talk to each other directly

Copy link
Member

Choose a reason for hiding this comment

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

We cannot link to a specific method when using GitHub, so that's a bit sad. For class, it will be a good solution though. We must discuss whether it's usefull to link functions, or just like to the class on github directly

Copy link
Contributor

Choose a reason for hiding this comment

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

in a PR github seems to have this method information. Otherwiese we could have a proxy wich calculates the needed line number on demand for the github url

@HeahDudeHeahDude added this to the4.3 milestoneApr 6, 2019
@wouterjwouterj added the ⭐️ EU-FOSSA Hackathonhttps://symfony.com/blog/the-symfony-and-api-platform-hackathon-is-coming labelApr 7, 2019
@wouterj
Copy link
Member

wouterj commentedApr 7, 2019
edited
Loading

Great! Thanks for documenting this feature! (and by this merge, your PR has become part of the EUFOSSA hackathon as well 😃 )

OskarStark and Pierstoval reacted with heart emoji

@wouterjwouterj merged commit3b1a1a1 intosymfony:masterApr 7, 2019
wouterj added a commit that referenced this pull requestApr 7, 2019
…rstoval)This PR was merged into the master branch.Discussion----------[Testing] Add docs for new WebTestCase assertionsFixes#11266 , as ofsymfony/symfony#30813Commits-------3b1a1a1 Add docs of new WebTestCase assertions
@PierstovalPierstoval deleted the assertions branchApril 7, 2019 14:02
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot requested changes

@wouterjwouterjwouterj left review comments

@OskarStarkOskarStarkOskarStark approved these changes

Assignees

No one assigned

Labels

⭐️ EU-FOSSA Hackathonhttps://symfony.com/blog/the-symfony-and-api-platform-hackathon-is-comingPHPUnitBridgeStatus: Reviewed

Projects

None yet

Milestone

4.3

Development

Successfully merging this pull request may close these issues.

6 participants

@Pierstoval@OskarStark@wouterj@fabpot@HeahDude@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp