php - How can i test all scenarios of firstname and lastname -
i have function must test scenarios of firstname :
1-first scenarios if firstname empty . 2-second scenarios if firstname contains 1 character. 3-third scenrarios if firstname have 2 character. 4-four scenarios if firstname have 3 character. 5-other scenarios ...
so here function :
<?php $loginuser = $thirdpartycode .'_'. substr($firstname, 0, 1) .''. substr($lastname, 0, 1); echo 'login user generatedlogin:'. $loginuser; // $usercheck = new admin_model_dbtable_user(); // $iduser=$usercheck->checkuser($loginuser); $firstnamex = 0; $firstnamey = 1; $lastnamex = 0; $lastnamey = 1; $max = 4; { ++$firstnamey; ++$lastnamey; if (empty($firstname)) { $loginuser = $thirdpartycode .'_'. substr($lastname, $lastnamex, $lastnamey); } else { if (strlen($firstname) < $max) { $firstnamex = 0; $firstnamey = 1; $loginuser = $thirdpartycode .'_'. substr($firstname, $firstnamex, $firstnamey) . '' . substr($lastname, $lastnamex, $lastnamey); } $loginuser = $thirdpartycode .'_'. substr($firstname, $firstnamex, $firstnamey) . '' . substr($lastname, $lastnamex, $lastnamey); } $usercheck = new admin_model_dbtable_user(); $iduser = $usercheck->checkuser($loginuser); if (($firstnamey == $max) && ($lastnamey == $max)) break; } while ($iduser > 0); error_log('login user generatedlogin:'. $loginuser); return $loginuser;
please can script , tell me can update take scenarios.
Comments
Post a Comment