Home » Php » Call a function via arrow operator

Call a function via arrow operator

Posted by: admin October 26, 2017 Leave a comment

Questions:

I have this code and I don’t understand very well how $ext->click() works. Should be the same if I use $I->click($ext) and if is not, why?
$ext store the 0 position of $elements array. This is what the $ext have inside http://take.ms/pmoAj

$I = new AcceptanceTester($scenario);
$I->wantTo('get the index');
$I->am('Tester');
$I->wantTo('Add a new contact');
$I->lookForwardTo('Create a new contact in Alegra');

 //Tester

 $I->amGoingTo('Login into my account');
 $I->amOnPage('/user/login');
 $I->see('ingresa');
 $I->fillfield('#email','[email protected]');
 $I->fillfield('#password','20197850');
 $I->click('#submit');
 $I->see('Inicio');
 $I->amOnPage('/invoice');
 $I->waitForElement('#gridInvoices .action-icons');
  $index = $I->grabMultiple('#gridInvoices .action-icons img:nth-
  child(6)','class');
 $numero = count($index);
 $buscar = array_search('voidInvoice',$index);

if($buscar == false){
   trigger_error('No hay botones del tipo anular facturas');
 }else{
   $elements = $I->getElements('#gridInvoices #gridview-1047-table tbody tr 
  .action-icons img:nth-child(6)');
   $ext = $elements[$buscar];
   $ext->click();
    $I->wait(10);
}
Answers: