Advertisement
Guest User

Untitled

a guest
Jul 30th, 2014
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. There was 1 error:
  2.  
  3. 1) CaremonkMainSiteBundleTestsControllerSecurityControllerFunctionalTest::testIndex
  4. InvalidArgumentException: The current node list is empty.
  5.  
  6. $form = $crawler->selectButton('login')->form();
  7.  
  8. ///////////////////////////////////////////////////////////////////////////////
  9. ///////////////////////////////////////////////////////////////////////////////
  10. Functional Test
  11. <?php
  12.  
  13. namespace CaremonkMainSiteBundleTestsController;
  14.  
  15. use SymfonyBundleFrameworkBundleTestWebTestCase;
  16.  
  17. class SecurityControllerFunctionalTest extends WebTestCase
  18. {
  19. public function testIndex()
  20. {
  21. $client = static::createClient();
  22.  
  23. $crawler = $client->request('GET', '/login');
  24.  
  25. $form = $crawler->selectButton('login')->form();
  26. $form['username'] = 'testActive';
  27. $form['password'] = 'passwordActive';
  28. }
  29. }
  30.  
  31.  
  32. //////////////////////////////////////////////////////////////////////////
  33. //////////////////////////////////////////////////////////////////////////
  34. Twig view
  35.  
  36.  
  37. {# src/Acme/SecurityBundle/Resources/views/Security/login.html.twig #}
  38. {% if error %}
  39. <div>{{ error.message }}</div>
  40. {% endif %}
  41.  
  42. <form action="{{ path('caremonk_mainsite_login_check') }}" method="post">
  43. <label for="username">Username:</label>
  44. <input type="text" id="username" name="_username" value="{{ last_username }}" />
  45.  
  46. <label for="password">Password:</label>
  47. <input type="password" id="password" name="_password" />
  48.  
  49. {#
  50. If you want to control the URL the user is redirected to on success (more details below)
  51. <input type="hidden" name="_target_path" value="/account" />
  52. #}
  53.  
  54. <button type="submit">login</button>
  55. </form>
  56.  
  57. $form = $crawler->selectButton('submit my form please')->form();
  58.  
  59. $client = new Client();
  60. $crawler = $client->request('GET', '/login');
  61.  
  62. $client = new Client();
  63. $crawler = $client->request('GET', 'http://site.dev/app_dev.php/login');
  64.  
  65. $crawler->filter('form[name=yourAwesomeFormName]')->form();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement