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?

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.