Ad

Click On A Button That Only Contains An Icon With PHP Unit And Laravel 5.2

- 1 answer

For my acceptance test

$this->visit("/tournaments")
        ->see($this->tournaments)
        ->click(MyLinkWithIcon);
...

<a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="http://laravel.dev:8000/article/delete" class="btn btn-primary btn-xs pull-right"><b><i class="icon-minus22 mr-5"></i></b></a>

I don't know what to put as click parameter so that it detects that I clicked the font awesome icon link that delete my article.

Any idea???

Ad

Answer

Give your link an id and use that as your parameter:

<a id="icon_button" target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="http://laravel.dev:8000/article/delete" class="btn btn-primary btn-xs pull-right"><b><i class="icon-minus22 mr-5"></i></b></a>


$this->visit("/tournaments")
    ->see($this->tournaments)
    ->click('icon_button');
Ad
source: stackoverflow.com
Ad