f06a35b974
This PR was squashed before being merged into the 4.4 branch (closes #31959).
Discussion
----------
[DomCrawler][Feature][DX] Add Form::getName() method
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | None
| License | MIT
| Doc PR | symfony/symfony-docs#11705
The PR adds `Symfony\Component\DomCrawler\Form::getName` method.
The method is actually a syntax sugar but can improve DX when dealing with tests. For example, in the snippet
```php
$client = static::createClient();
$crawler = $client->request('GET', '/post/hello-world');
$form = $crawler->selectButton('submit')->form();
$form['my_form[name]'] = 'Fabien';
$form['my_form[subject]'] = 'Symfony rocks!';
```
the prefix in field name (`my_form`) is form name, which is generated by Symfony automatically. The method, added in the PR helps to get that name in a most obvious way.
Commits
-------
|
||
---|---|---|
.. | ||
Field | ||
Test/Constraint | ||
Tests | ||
.gitignore | ||
AbstractUriElement.php | ||
CHANGELOG.md | ||
composer.json | ||
Crawler.php | ||
Form.php | ||
FormFieldRegistry.php | ||
Image.php | ||
LICENSE | ||
Link.php | ||
phpunit.xml.dist | ||
README.md |
DomCrawler Component
The DomCrawler component eases DOM navigation for HTML and XML documents.