Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- There was 1 error:
- 1) CaremonkMainSiteBundleTestsControllerSecurityControllerFunctionalTest::testIndex
- InvalidArgumentException: The current node list is empty.
- $form = $crawler->selectButton('login')->form();
- ///////////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////////
- Functional Test
- <?php
- namespace CaremonkMainSiteBundleTestsController;
- use SymfonyBundleFrameworkBundleTestWebTestCase;
- class SecurityControllerFunctionalTest extends WebTestCase
- {
- public function testIndex()
- {
- $client = static::createClient();
- $crawler = $client->request('GET', '/login');
- $form = $crawler->selectButton('login')->form();
- $form['username'] = 'testActive';
- $form['password'] = 'passwordActive';
- }
- }
- //////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////
- Twig view
- {# src/Acme/SecurityBundle/Resources/views/Security/login.html.twig #}
- {% if error %}
- <div>{{ error.message }}</div>
- {% endif %}
- <form action="{{ path('caremonk_mainsite_login_check') }}" method="post">
- <label for="username">Username:</label>
- <input type="text" id="username" name="_username" value="{{ last_username }}" />
- <label for="password">Password:</label>
- <input type="password" id="password" name="_password" />
- {#
- If you want to control the URL the user is redirected to on success (more details below)
- <input type="hidden" name="_target_path" value="/account" />
- #}
- <button type="submit">login</button>
- </form>
- $form = $crawler->selectButton('submit my form please')->form();
- $client = new Client();
- $crawler = $client->request('GET', '/login');
- $client = new Client();
- $crawler = $client->request('GET', 'http://site.dev/app_dev.php/login');
- $crawler->filter('form[name=yourAwesomeFormName]')->form();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement