function testGetProfilesbyEidFound() { //arrange $Profiles = new ProfileInfo(); //act $Result = $Profiles->where('eid', 'eid98')->get(); //assert $this->assertEquals(3, $Result->count()); }
/** * This function retrieves a profile given a ICCID * * The function receives as inputs SMSR-Id (Mandatory), eid and ICCID (Optional) * It searched for the profile in the profileinfo Model. When no Iccid is supplied, all profiles are collected * The function returns a HTTP response object. This response object contains the profile or error codes. * * @param string $eid * @param string $iccid * */ public function getProfile($SmsrId, $Eid, $Iccid = null) { $ProfileInfo = new ProfileInfo(); if ($SmsrId == 'all') { if ($Eid == 'all') { if ($Iccid == null) { //return all profiles in base $Result = $ProfileInfo->all(); } else { //return Profile with id from all smsr and all eis $Result = $ProfileInfo->find($Iccid); } } else { if ($Iccid == null) { //return all Profiles with id for a specific EIS on any SMSR $Result = $ProfileInfo->where('eid', $Eid)->get(); } else { //return a specific profile from a specific EIS on any SMSR $Result = $ProfileInfo->where('eid', $Eid)->find($Iccid); } } } else { if ($Eid == 'all') { if ($Iccid == null) { //return all profiles in base $Result = $ProfileInfo->all(); } else { //return profile with iccid from all smsr and all eis $Result = $ProfileInfo->find($Iccid); } } else { if ($Iccid == null) { //return all profiles for a specific EIS on any SMSR $Result = $ProfileInfo->where('eid', $Eid)->get(); } else { //return a specific profile from a specific EIS on any SMSR $Result = $ProfileInfo->where('eid', $Eid)->find($Iccid); } } } return response()->json($Result); }