0

I am starting with phpUnit. Therefore i have questions. Let's say i want to test if link is valid an i will be redirected to another site.

$crawler = $client->request('GET', '/client/list');
$link = $crawler->selectLink('sometext')->link();
$lista = $client->click($link);
$this->assertEquals(1, $lista->filter('h1:contains("Contact")')->count());

However what i would like to do is to select link with specific href. Something like this.

$crawler = $client->request('GET', '/client/list');
$link = $crawler->selectLink('a[href="url"]')->link();
$lista = $client->click($link);
$this->assertEquals(1, $lista->filter('h1:contains("Contact")')->count());

Is it possible? The second question is much more general. I dont know what to test in functional testing. I want my tests to be repetitive. Should i test forms, or routing? Could someone tell me what are your practices?

S1arl
  • 55
  • 7
  • 1
    Possible duplicate of [Symfony DomCrawler: Find element with specific attribute value](http://stackoverflow.com/questions/16300958/symfony-domcrawler-find-element-with-specific-attribute-value) – Aleksander Wons May 25 '16 at 07:25
  • 1
    As for your second question SO is not a place for it. There is no one good answer for such question and any answer would be too broad for SO. – Aleksander Wons May 25 '16 at 07:26

0 Answers0