Best Atoum code snippet using data.testAddData
ResultControllerOld.php
Source:ResultControllerOld.php
...25 }26 public function store(Request $request){27 $this->examAddData = array();28 $this->examUpdateData = array();29 $this->testAddData = array();30 $this->testUpdateData = array();31 $this->projectAddData = array();32 $this->projectUpdateData = array();33 $this->coCurricularAddData = array();34 $this->coCurricularUpdateData = array();35 $this->resultMetaAddData = array();36 $this->resultMetaUpdateData = array();37 38 if(isset($_POST['upload']) && isset($_FILES)){ 39 40 $path = $_FILES["file"]["tmp_name"];41 $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();42 $spreadsheet = $reader->load($path);43 44 $sheetData = $spreadsheet->getActiveSheet()->toArray(); 45 $length = count($sheetData);46 $examType = trim($sheetData[2][1]);47 $classGroup = trim($sheetData[3][1]);48 49 if($request->class != $classGroup){50 return redirect()->back()->with('error','Please select right class group');51 }52 $session = HelperService::getCurrentSession()->id;53 if($classGroup=='Pre-Primary'){54 for($count=7;$count<$length;$count++){55 $this->storePrePrimaryResult($sheetData[$count],$examType,$session);56 } 57 }elseif ($classGroup=='Primary'){58 for($count=7;$count<$length;$count++){59 $this->storePrimaryResult($sheetData[$count],$examType,$session);60 }61 }elseif ($classGroup=='Middle'){62 for($count=7;$count<$length;$count++){63 $this->storeMiddleResult($sheetData[$count],$examType,$session);64 }65 }66 67 try{68 DB::beginTransaction();69 if(!empty($this->examAddData)){70 ExamMarks::insert($this->examAddData);71 }72 if(!empty($this->coCurricularAddData)){73 CoCurricularSubjectsGrades::insert($this->coCurricularAddData);74 }75 if(!empty($this->resultMetaAddData)){76 ResultMetaData::insert($this->resultMetaAddData);77 }78 if(!empty($this->testAddData)){79 TestMarks::insert($this->testAddData);80 }81 if(!empty($this->projectAddData)){82 ProjectMarks::insert($this->projectAddData);83 }84 DB::commit();85 return redirect()->back()->with('success','Result uploaded successfully');86 }catch(\Exception $exception){87 info('error occured in result uploading with error message '.$exception->getMessage()); 88 DB::rollback();89 return redirect()->back()->with('error','Please try again');90 }91 }92 return view('result.upload-result');93 }94 protected function storePrePrimaryResult($studentResultInformation,$examType,$session){95 $numberOfSubjects = 3;96 $scholarNumber = trim($studentResultInformation[0]);97 // $session = trim($studentResultInformation[1]);98 $hindiMarks = trim($studentResultInformation[2]);99 $englishMarks = trim($studentResultInformation[3]);100 $mathsMarks = trim($studentResultInformation[4]);101 $maxMarksPerSubject = trim($studentResultInformation[5]);102 $drawingGrade = trim($studentResultInformation[6]);103 $healthGrade = trim($studentResultInformation[7]);104 $gamesGrade = trim($studentResultInformation[8]);105 $literaryGrade = trim($studentResultInformation[9]);106 $scientificGrade = trim($studentResultInformation[10]);107 $culturalGrade = trim($studentResultInformation[11]);108 $creativityGrade = trim($studentResultInformation[12]);109 $coOperationGrade = trim($studentResultInformation[13]);110 $punctualityGrade = trim($studentResultInformation[14]);111 $cleanlinessGrade = trim($studentResultInformation[15]);112 $disciplineGrade = trim($studentResultInformation[16]);113 $regularityGrade = trim($studentResultInformation[17]);114 $aptitudeGrade = trim($studentResultInformation[18]);115 $truthnessGrade = trim($studentResultInformation[19]);116 $evsAwarenessGrade = trim($studentResultInformation[20]);117 $leadershipGrade = trim($studentResultInformation[21]);118 $honestyGrade = trim($studentResultInformation[22]);119 $totalDays = trim($studentResultInformation[23]);120 $daysPresent = trim($studentResultInformation[24]);121 if(!empty($scholarNumber) && !empty($session) && !empty($hindiMarks) && !empty($englishMarks) && !empty($mathsMarks) && !empty($maxMarksPerSubject) && !empty($totalDays) && !empty($daysPresent)){122 for ($j=0; $j < $numberOfSubjects ; $j++) {123 $examMarks = new ExamMarks();124 $examMarks->session = $session;125 $examMarks->scholar_number = $scholarNumber;126 $examMarks->exam_type = $examType;127 $examMarks->subject_id = $j+1;128 $examMarks->marks = trim($studentResultInformation[$j+2])=='AB'?NULL:trim($studentResultInformation[$j+2]);129 $examMarks->max_marks = $maxMarksPerSubject;130 $this->examAddData[] = $examMarks->attributesToArray();131 }132 $coCurricularSubjects = array(133 'DRAWING' => $drawingGrade,134 'HEALTH' => $healthGrade,135 'GAMES' => $gamesGrade,136 'LITERARY' => $literaryGrade,137 'SCIENTIFIC' => $scientificGrade,138 'CULTURAL' => $culturalGrade,139 'CREATIVITY' => $creativityGrade,140 'CO_OPERATION' => $coOperationGrade,141 'PUNCTUALITY' => $punctualityGrade,142 'CLEANLINESS' => $cleanlinessGrade,143 'DISCIPLINE' => $disciplineGrade,144 'REGULARITY' => $regularityGrade,145 'APTITUDE' => $aptitudeGrade,146 'TRUTHNESS' => $truthnessGrade,147 'EVS_AWARENESS' => $evsAwarenessGrade,148 'LEADERSHIP' => $leadershipGrade,149 'HONESTY' => $honestyGrade150 );151 $coCurricularSubjectsGrades = new CoCurricularSubjectsGrades();152 $coCurricularSubjectsGrades->session = $session;153 $coCurricularSubjectsGrades->scholar_number = $scholarNumber;154 $coCurricularSubjectsGrades->exam_type = $examType;155 $coCurricularSubjectsGrades->grades = json_encode($coCurricularSubjects);156 $this->coCurricularAddData[] = $coCurricularSubjectsGrades->attributesToArray();157 $totalMarks = $maxMarksPerSubject * $numberOfSubjects;158 $total = $hindiMarks + $englishMarks + $mathsMarks;159 $percentage = ($total/$totalMarks) * 100;160 $resultMetaData = new ResultMetaData();161 $resultMetaData->session = $session;162 $resultMetaData->scholar_number = $scholarNumber;163 $resultMetaData->exam_type = $examType;164 $resultMetaData->present_days = $daysPresent;165 $resultMetaData->total_days = $totalDays;166 $resultMetaData->result_total = $total; 167 $resultMetaData->total_marks = $totalMarks; 168 $resultMetaData->result_percentage = $percentage; 169 $resultMetaData->created_at = date('Y-m-d H:i:s'); 170 $resultMetaData->updated_at = date('Y-m-d H:i:s'); 171 $this->resultMetaAddData[] = $resultMetaData->attributesToArray();172 /*$totalMarks = $maxMarksPerSubject * $numberOfSubjects;173 $total = ($hindiMarks=='AB'?0:$hindiMarks) + ($englishMarks=='AB'?0:$englishMarks) + ($mathsMarks=='AB'?0:$mathsMarks);174 $percentage = ($total/$totalMarks) * 100;175 $result = Result::where('scholar_number',$scholarNumber)->where('session',$session)->first();176 177 if(!empty($result)){178 $marks = $result->marks;179 $marks[$examType] = array(180 'hindi_marks' => $hindiMarks,181 'english_marks' => $englishMarks,182 'maths_marks' => $mathsMarks,183 'co_curricular_subjects' => array(184 'DRAWING' => 'A',185 'HEALTH' => 'A',186 'APTITUDE' => 'B',187 'HONESTY' => 'A',188 'CREATIVITY' => 'B'189 ),190 'total' => 10,191 'days_attended' => 10,192 'total_days' => 20,193 'id' => $result->id194 );195 $this->resultUpdateData[] = $marks;196 }else{197 $marks = array(198 $examType => array(199 'hindi_marks' => $hindiMarks,200 'english_marks' => $englishMarks,201 'maths_marks' => $mathsMarks,202 'max_marks_per_subject' => $maxMarksPerSubject,203 'co_curricular_subjects' => array(204 'DRAWING' => $drawingGrade,205 'HEALTH' => $healthGrade,206 'GAMES' => $gamesGrade,207 'LITERARY' => $literaryGrade,208 'SCIENTIFIC' => $scientificGrade,209 'CULTURAL' => $culturalGrade,210 'CREATIVITY' => $creativityGrade,211 'CO_OPERATION' => $coOperationGrade,212 'PUNCTUALITY' => $punctualityGrade,213 'CLEANLINESS' => $cleanlinessGrade,214 'DISCIPLINE' => $disciplineGrade,215 'REGULARITY' => $regularityGrade,216 'APTITUDE' => $aptitudeGrade,217 'TRUTHNESS' => $truthnessGrade,218 'EVS_AWARENESS' => $evsAwarenessGrade,219 'LEADERSHIP' => $leadershipGrade,220 'HONESTY' => $honestyGrade221 ),222 'total_marks' => $total,223 'days_attended' => $daysPresent,224 'total_days' => $totalDays225 ) 226 );227 $result = new Result();228 $result->session = $session;229 $result->scholar_number= $scholarNumber;230 $result->marks= json_encode($marks);231 $result->created_at= date('Y-m-d H:i:s');232 $result->updated_at= date('Y-m-d H:i:s');233 234 $this->resultAddData[] = $result->attributesToArray();235 } */ 236 237 }238 }239 protected function storePrimaryResult($studentResultInformation,$examType,$session){240 $numberOfSubjects = 4;241 $scholarNumber = trim($studentResultInformation[0]);242 // $session = trim($studentResultInformation[1]);243 $hindiMarks = trim($studentResultInformation[2]);244 $englishMarks = trim($studentResultInformation[3]);245 $mathsMarks = trim($studentResultInformation[4]);246 $evsMarks = trim($studentResultInformation[5]);247 248 249 $maxMarksPerSubject = trim($studentResultInformation[6]);250 $drawingGrade = trim($studentResultInformation[7]);251 $healthGrade = trim($studentResultInformation[8]);252 $gamesGrade = trim($studentResultInformation[9]);253 $literaryGrade = trim($studentResultInformation[10]);254 $scientificGrade = trim($studentResultInformation[11]);255 $culturalGrade = trim($studentResultInformation[12]);256 $creativityGrade = trim($studentResultInformation[13]);257 $coOperationGrade = trim($studentResultInformation[14]);258 $punctualityGrade = trim($studentResultInformation[15]);259 $cleanlinessGrade = trim($studentResultInformation[16]);260 $disciplineGrade = trim($studentResultInformation[17]);261 $regularityGrade = trim($studentResultInformation[18]);262 $aptitudeGrade = trim($studentResultInformation[19]);263 $truthnessGrade = trim($studentResultInformation[20]);264 $evsAwarenessGrade = trim($studentResultInformation[21]);265 $leadershipGrade = trim($studentResultInformation[22]);266 $honestyGrade = trim($studentResultInformation[23]);267 $hindiTestMarks = trim($studentResultInformation[24]);268 $englishTestMarks = trim($studentResultInformation[25]);269 $mathsTestMarks = trim($studentResultInformation[26]);270 $evsTestMarks = trim($studentResultInformation[27]);271 $maxTestMarks = trim($studentResultInformation[28]);272 $totalDays = trim($studentResultInformation[29]);273 $daysPresent = trim($studentResultInformation[30]); 274 if(!empty($scholarNumber) && !empty($session) && !empty($hindiMarks) && !empty($englishMarks) && !empty($mathsMarks) && !empty($evsMarks) && !empty($maxMarksPerSubject) && !empty($totalDays) && !empty($daysPresent)){275 $examMarks = new ExamMarks();276 $examMarks->session = $session;277 $examMarks->scholar_number = $scholarNumber;278 $examMarks->exam_type = $examType;279 $examMarks->subject_id = 1;280 $examMarks->marks = $hindiMarks;281 $examMarks->max_marks = $maxMarksPerSubject;282 $this->examAddData[] = $examMarks->attributesToArray();283 $examMarks = new ExamMarks();284 $examMarks->session = $session;285 $examMarks->scholar_number = $scholarNumber;286 $examMarks->exam_type = $examType;287 $examMarks->subject_id = 2;288 $examMarks->marks = $englishMarks;289 $examMarks->max_marks = $maxMarksPerSubject;290 $this->examAddData[] = $examMarks->attributesToArray();291 $examMarks = new ExamMarks();292 $examMarks->session = $session;293 $examMarks->scholar_number = $scholarNumber;294 $examMarks->exam_type = $examType;295 $examMarks->subject_id = 3;296 $examMarks->marks = $mathsMarks;297 $examMarks->max_marks = $maxMarksPerSubject;298 $this->examAddData[] = $examMarks->attributesToArray();299 $examMarks = new ExamMarks();300 $examMarks->session = $session;301 $examMarks->scholar_number = $scholarNumber;302 $examMarks->exam_type = $examType;303 $examMarks->subject_id = 7;304 $examMarks->marks = $evsMarks;305 $examMarks->max_marks = $maxMarksPerSubject;306 $this->examAddData[] = $examMarks->attributesToArray();307 if($examType=='annual'){308 309 $testMarks = new TestMarks();310 $testMarks->session = $session;311 $testMarks->scholar_number = $scholarNumber;312 $testMarks->subject_id = 1;313 $testMarks->marks = $hindiTestMarks;314 $testMarks->max_marks = $maxTestMarks;315 $this->testAddData[] = $testMarks->attributesToArray();316 $testMarks = new TestMarks();317 $testMarks->session = $session;318 $testMarks->scholar_number = $scholarNumber;319 $testMarks->subject_id = 2;320 $testMarks->marks = $englishTestMarks;321 $testMarks->max_marks = $maxTestMarks;322 $this->testAddData[] = $testMarks->attributesToArray();323 $testMarks = new TestMarks();324 $testMarks->session = $session;325 $testMarks->scholar_number = $scholarNumber;326 $testMarks->subject_id = 3;327 $testMarks->marks = $mathsTestMarks;328 $testMarks->max_marks = $maxTestMarks;329 $this->testAddData[] = $testMarks->attributesToArray();330 $testMarks = new TestMarks();331 $testMarks->session = $session;332 $testMarks->scholar_number = $scholarNumber;333 $testMarks->subject_id = 7;334 $testMarks->marks = $evsTestMarks;335 $testMarks->max_marks = $maxTestMarks;336 $this->testAddData[] = $testMarks->attributesToArray();337 }338 339 $coCurricularSubjects = array(340 'DRAWING' => $drawingGrade,341 'HEALTH' => $healthGrade,342 'GAMES' => $gamesGrade,343 'LITERARY' => $literaryGrade,344 'SCIENTIFIC' => $scientificGrade,345 'CULTURAL' => $culturalGrade,346 'CREATIVITY' => $creativityGrade,347 'CO_OPERATION' => $coOperationGrade,348 'PUNCTUALITY' => $punctualityGrade,349 'CLEANLINESS' => $cleanlinessGrade,350 'DISCIPLINE' => $disciplineGrade,351 'REGULARITY' => $regularityGrade,352 'APTITUDE' => $aptitudeGrade,353 'TRUTHNESS' => $truthnessGrade,354 'EVS_AWARENESS' => $evsAwarenessGrade,355 'LEADERSHIP' => $leadershipGrade,356 'HONESTY' => $honestyGrade357 );358 $coCurricularSubjectsGrades = new CoCurricularSubjectsGrades();359 $coCurricularSubjectsGrades->session = $session;360 $coCurricularSubjectsGrades->scholar_number = $scholarNumber;361 $coCurricularSubjectsGrades->exam_type = $examType;362 $coCurricularSubjectsGrades->grades = json_encode($coCurricularSubjects);363 $this->coCurricularAddData[] = $coCurricularSubjectsGrades->attributesToArray();364 $totalMarks = $maxMarksPerSubject * $numberOfSubjects;365 $total = $hindiMarks + $englishMarks + $mathsMarks + $evsMarks;366 $percentage = ($total/$totalMarks) * 100;367 $resultMetaData = new ResultMetaData();368 $resultMetaData->session = $session;369 $resultMetaData->scholar_number = $scholarNumber;370 $resultMetaData->exam_type = $examType;371 $resultMetaData->present_days = $daysPresent;372 $resultMetaData->total_days = $totalDays;373 $resultMetaData->result_total = $total; 374 $resultMetaData->total_marks = $totalMarks; 375 $resultMetaData->result_percentage = $percentage; 376 $resultMetaData->created_at = date('Y-m-d H:i:s'); 377 $resultMetaData->updated_at = date('Y-m-d H:i:s'); 378 $this->resultMetaAddData[] = $resultMetaData->attributesToArray();379 }380 }381 protected function storeMiddleResult($studentResultInformation,$examType,$session){382 $numberOfSubjects = 6;383 $scholarNumber = trim($studentResultInformation[0]);384 // $session = trim($studentResultInformation[1]);385 $hindiMarks = trim($studentResultInformation[2]);386 $englishMarks = trim($studentResultInformation[3]);387 $mathsMarks = trim($studentResultInformation[4]);388 $sanskritMarks = trim($studentResultInformation[5]);389 $scienceMarks = trim($studentResultInformation[6]);390 $socialMarks = trim($studentResultInformation[7]);391 $maxMarksPerSubject = trim($studentResultInformation[8]);392 $drawingGrade = trim($studentResultInformation[9]);393 $healthGrade = trim($studentResultInformation[10]);394 $gamesGrade = trim($studentResultInformation[11]);395 $literaryGrade = trim($studentResultInformation[12]);396 $scientificGrade = trim($studentResultInformation[13]);397 $culturalGrade = trim($studentResultInformation[14]);398 $creativityGrade = trim($studentResultInformation[15]);399 $coOperationGrade = trim($studentResultInformation[16]);400 $punctualityGrade = trim($studentResultInformation[17]);401 $cleanlinessGrade = trim($studentResultInformation[18]);402 $disciplineGrade = trim($studentResultInformation[19]);403 $regularityGrade = trim($studentResultInformation[20]);404 $aptitudeGrade = trim($studentResultInformation[21]);405 $truthnessGrade = trim($studentResultInformation[22]);406 $evsAwarenessGrade = trim($studentResultInformation[23]);407 $leadershipGrade = trim($studentResultInformation[24]);408 $honestyGrade = trim($studentResultInformation[25]);409 $hindiTestMarks = trim($studentResultInformation[26]);410 $englishTestMarks = trim($studentResultInformation[27]);411 $mathsTestMarks = trim($studentResultInformation[28]);412 $sanskritTestMarks = trim($studentResultInformation[29]);413 $scienceTestMarks = trim($studentResultInformation[30]);414 $socialTestMarks = trim($studentResultInformation[31]);415 $maxTestMarks = trim($studentResultInformation[32]);416 $hindiProjectMarks = trim($studentResultInformation[33]);417 $englishProjectMarks = trim($studentResultInformation[34]);418 $mathsProjectMarks = trim($studentResultInformation[35]);419 $sanskritProjectMarks = trim($studentResultInformation[36]);420 $scienceProjectMarks = trim($studentResultInformation[37]);421 $socialProjectMarks = trim($studentResultInformation[38]);422 $maxProjectMarks = trim($studentResultInformation[39]);423 $totalDays = trim($studentResultInformation[40]);424 $daysPresent = trim($studentResultInformation[41]);425 if(!empty($scholarNumber) && !empty($session) && !empty($hindiMarks) && !empty($englishMarks) && !empty($mathsMarks) && !empty($sanskritMarks) && !empty($scienceMarks) && !empty($socialMarks) && !empty($maxMarksPerSubject) && !empty($totalDays) && !empty($daysPresent)){426 $examMarks = new ExamMarks();427 $examMarks->session = $session;428 $examMarks->scholar_number = $scholarNumber;429 $examMarks->exam_type = $examType;430 $examMarks->subject_id = 1;431 $examMarks->marks = $hindiMarks;432 $examMarks->max_marks = $maxMarksPerSubject;433 $this->examAddData[] = $examMarks->attributesToArray();434 $examMarks = new ExamMarks();435 $examMarks->session = $session;436 $examMarks->scholar_number = $scholarNumber;437 $examMarks->exam_type = $examType;438 $examMarks->subject_id = 2;439 $examMarks->marks = $englishMarks;440 $examMarks->max_marks = $maxMarksPerSubject;441 $this->examAddData[] = $examMarks->attributesToArray();442 $examMarks = new ExamMarks();443 $examMarks->session = $session;444 $examMarks->scholar_number = $scholarNumber;445 $examMarks->exam_type = $examType;446 $examMarks->subject_id = 3;447 $examMarks->marks = $mathsMarks;448 $examMarks->max_marks = $maxMarksPerSubject;449 $this->examAddData[] = $examMarks->attributesToArray();450 $examMarks = new ExamMarks();451 $examMarks->session = $session;452 $examMarks->scholar_number = $scholarNumber;453 $examMarks->exam_type = $examType;454 $examMarks->subject_id = 4;455 $examMarks->marks = $sanskritMarks;456 $examMarks->max_marks = $maxMarksPerSubject;457 $this->examAddData[] = $examMarks->attributesToArray();458 $examMarks = new ExamMarks();459 $examMarks->session = $session;460 $examMarks->scholar_number = $scholarNumber;461 $examMarks->exam_type = $examType;462 $examMarks->subject_id = 5;463 $examMarks->marks = $scienceMarks;464 $examMarks->max_marks = $maxMarksPerSubject;465 $this->examAddData[] = $examMarks->attributesToArray();466 $examMarks = new ExamMarks();467 $examMarks->session = $session;468 $examMarks->scholar_number = $scholarNumber;469 $examMarks->exam_type = $examType;470 $examMarks->subject_id = 6;471 $examMarks->marks = $socialMarks;472 $examMarks->max_marks = $maxMarksPerSubject;473 $this->examAddData[] = $examMarks->attributesToArray();474 if($examType=='annual'){475 $testMarks = new TestMarks();476 $testMarks->session = $session;477 $testMarks->scholar_number = $scholarNumber;478 $testMarks->subject_id = 1;479 $testMarks->marks = $hindiTestMarks;480 $testMarks->max_marks = $maxTestMarks;481 $this->testAddData[] = $testMarks->attributesToArray();482 $testMarks = new TestMarks();483 $testMarks->session = $session;484 $testMarks->scholar_number = $scholarNumber;485 $testMarks->subject_id = 2;486 $testMarks->marks = $englishTestMarks;487 $testMarks->max_marks = $maxTestMarks;488 $this->testAddData[] = $testMarks->attributesToArray();489 $testMarks = new TestMarks();490 $testMarks->session = $session;491 $testMarks->scholar_number = $scholarNumber;492 $testMarks->subject_id = 3;493 $testMarks->marks = $mathsTestMarks;494 $testMarks->max_marks = $maxTestMarks;495 $this->testAddData[] = $testMarks->attributesToArray();496 $testMarks = new TestMarks();497 $testMarks->session = $session;498 $testMarks->scholar_number = $scholarNumber;499 $testMarks->subject_id = 4;500 $testMarks->marks = $sanskritTestMarks;501 $testMarks->max_marks = $maxTestMarks;502 $this->testAddData[] = $testMarks->attributesToArray();503 $testMarks = new TestMarks();504 $testMarks->session = $session;505 $testMarks->scholar_number = $scholarNumber;506 $testMarks->subject_id = 5;507 $testMarks->marks = $scienceTestMarks;508 $testMarks->max_marks = $maxTestMarks;509 $this->testAddData[] = $testMarks->attributesToArray();510 $testMarks = new TestMarks();511 $testMarks->session = $session;512 $testMarks->scholar_number = $scholarNumber;513 $testMarks->subject_id = 6;514 $testMarks->marks = $socialTestMarks;515 $testMarks->max_marks = $maxTestMarks;516 $this->testAddData[] = $testMarks->attributesToArray();517 $projectMarks = new ProjectMarks();518 $projectMarks->session = $session;519 $projectMarks->scholar_number = $scholarNumber;520 $projectMarks->subject_id = 1;521 $projectMarks->marks = $hindiProjectMarks;522 $projectMarks->max_marks = $maxProjectMarks;523 $this->projectAddData[] = $projectMarks->attributesToArray();524 $projectMarks = new ProjectMarks();525 $projectMarks->session = $session;526 $projectMarks->scholar_number = $scholarNumber;527 $projectMarks->subject_id = 2;528 $projectMarks->marks = $englishProjectMarks;529 $projectMarks->max_marks = $maxProjectMarks;530 $this->projectAddData[] = $projectMarks->attributesToArray();...
firestoreTest.php
Source:firestoreTest.php
...43 {44 $output = $this->runFirestoreCommand('initialize-project-id');45 $this->assertContains('Created Cloud Firestore client with project ID:', $output);46 }47 public function testAddData()48 {49 $output = $this->runFirestoreCommand('add-data');50 $this->assertContains('Added data to the lovelace document in the users collection.', $output);51 $this->assertContains('Added data to the aturing document in the users collection.', $output);52 }53 /**54 * @depends testAddData55 */56 public function testRetrieveAllDocuments()57 {58 $output = $this->runFirestoreCommand('retrieve-all-documents');59 $this->assertContains('User:', $output);60 $this->assertContains('First: Ada', $output);61 $this->assertContains('Last: Lovelace', $output);62 $this->assertContains('Born: 1815', $output);63 $this->assertContains('First: Alan', $output);64 $this->assertContains('Middle: Mathison', $output);65 $this->assertContains('Last: Turing', $output);66 $this->assertContains('Born: 1912', $output);67 $this->assertContains('Retrieved and printed out all documents from the users collection.', $output);68 }69 /**70 * @depends testAddData71 */72 public function testSetDocument()73 {74 $output = $this->runFirestoreCommand('set-document');75 $this->assertContains('Set data for the LA document in the cities collection.', $output);76 }77 /**78 * @depends testAddData79 */80 public function testAddDocDataTypes()81 {82 $output = $this->runFirestoreCommand('add-doc-data-types');83 $this->assertContains('Set multiple data-type data for the one document in the data collection.', $output);84 }85 /**86 * @depends testAddData87 */88 public function testSetRequiresId()89 {90 $output = $this->runFirestoreCommand('set-requires-id');91 $this->assertContains('Added document with ID: new-city-id', $output);92 }93 /**94 * @depends testAddData95 */96 public function testAddDocDataWithAutoId()97 {98 $output = $this->runFirestoreCommand('add-doc-data-with-auto-id');99 $this->assertContains('Added document with ID:', $output);100 }101 /**102 * @depends testAddData103 */104 public function testAddDocDataAfterAutoId()105 {106 $output = $this->runFirestoreCommand('add-doc-data-after-auto-id');107 $this->assertContains('Added document with ID:', $output);108 }109 public function testQueryCreateExamples()110 {111 $output = $this->runFirestoreCommand('query-create-examples');112 $this->assertContains('Added example cities data to the cities collection.', $output);113 }114 /**115 * @depends testQueryCreateExamples116 */...
PHPtemplatesTest.php
Source:PHPtemplatesTest.php
...40 * Test Data Getter and Setter.41 *42 * @return void43 */44 public function testAddData()45 {46 parent::testAddData();47 $myView = ViewFactory::getView($this->renderer, false);48 $myView->addData('testData',49 array(50 'data1' => 1,51 'data2' => array(52 'data3' => 353 )54 )55 );56 57 $this->assertEquals(1, $myView->getData('testData/data1'));58 $this->assertEquals(3,$myView->getData('testData/data2/data3'));59 $this->assertNull($myView->getData('/testData/data4'));60 }...
testAddData
Using AI Code Generation
1require_once 'data.php';2$data = new data();3$data->testAddData();4require_once 'data.php';5$data = new data();6$data->testAddData();7require_once 'data.php';8$data = new data();9$data->testAddData();10require_once 'data.php';11$data = new data();12$data->testAddData();13require_once 'data.php';14$data = new data();15$data->testAddData();16require_once 'data.php';17$data = new data();18$data->testAddData();19require_once 'data.php';20$data = new data();21$data->testAddData();22require_once 'data.php';23$data = new data();24$data->testAddData();25require_once 'data.php';26$data = new data();27$data->testAddData();28require_once 'data.php';29$data = new data();30$data->testAddData();31require_once 'data.php';32$data = new data();33$data->testAddData();34require_once 'data.php';35$data = new data();36$data->testAddData();37require_once 'data.php';38$data = new data();39$data->testAddData();40require_once 'data.php';41$data = new data();42$data->testAddData();
testAddData
Using AI Code Generation
1$objData = new data();2$objData->testAddData();3$objData = new data();4$objData->testAddData();5$objData = new data();6$objData->testAddData();7$objData = new data();8$objData->testAddData();9$objData = new data();10$objData->testAddData();11$objData = new data();12$objData->testAddData();13$objData = new data();14$objData->testAddData();15$objData = new data();16$objData->testAddData();17$objData = new data();18$objData->testAddData();19$objData = new data();20$objData->testAddData();21$objData = new data();22$objData->testAddData();23$objData = new data();24$objData->testAddData();25$objData = new data();26$objData->testAddData();27$objData = new data();28$objData->testAddData();29$objData = new data();30$objData->testAddData();31$objData = new data();32$objData->testAddData();
testAddData
Using AI Code Generation
1require_once("data.php");2$data = new data();3$data->testAddData();4require_once("data.php");5$data = new data();6$data->testGetData();7require_once("data.php");8$data = new data();9$data->testUpdateData();10require_once("data.php");11$data = new data();12$data->testDeleteData();13require_once("data.php");14$data = new data();15$data->testGetAllData();16require_once("data.php");17$data = new data();18$data->testGetAllData();19require_once("data.php");20$data = new data();21$data->testGetAllData();22require_once("data.php");23$data = new data();24$data->testGetAllData();25require_once("data.php");26$data = new data();27$data->testGetAllData();28require_once("data.php");29$data = new data();30$data->testGetAllData();31require_once("data.php");32$data = new data();33$data->testGetAllData();34require_once("data.php");35$data = new data();36$data->testGetAllData();37require_once("data.php");38$data = new data();39$data->testGetAllData();40require_once("data.php");41$data = new data();
testAddData
Using AI Code Generation
1include_once("data.php");2$obj = new Data();3$obj->testAddData();4include_once("data.php");5$obj = new Data();6$obj->testAddData();7require_once("data.php");8$obj = new Data();9$obj->testAddData();10require_once("data.php");11$obj = new Data();12$obj->testAddData();13Difference between include() and include_once() function14Difference between require() and require_once() function15include() Function16include_once() Function17require() Function18require_once() Function19PHP include() Function
testAddData
Using AI Code Generation
1include("data.php");2$obj = new data();3$obj->testAddData();4include("data.php");5$obj = new data();6$obj->testAddData();
testAddData
Using AI Code Generation
1require_once("data.php");2$data = new Data();3$data->testAddData();4{5 public function testAddData()6 {7 echo "testAddData";8 }9}
testAddData
Using AI Code Generation
1require_once 'data.php';2$data = new Data();3$data->testAddData();4class Data {5 public function testAddData() {6 $data = array(
testAddData
Using AI Code Generation
1require_once('data.php');2$data = new Data();3$data->testAddData();4class Data {5 public function testAddData() {6 $conn = mysqli_connect("localhost", "root", "", "test");7 if (!$conn) {8 die("Connection failed: " . mysqli_connect_error());9 }10 $sql = "INSERT INTO `test` (`name`, `age`) VALUES ('test', '20')";11 if (mysqli_query($conn, $sql)) {12 echo "New record created successfully";13 } else {14 echo "Error: " . $sql . "<br>" . mysqli_error($conn);15 }16 mysqli_close($conn);17 }18}19Warning: mysqli_connect(): (HY000/2002): No connection could be made because the target machine actively refused it. in C:\xampp\htdocs\test\1.php on line 720$conn = mysqli_connect("localhost", "root", "", "test");21if (!$conn) {22 die("Connection failed: " . mysqli_connect_error());23}24Warning: mysqli_connect(): (HY000/2002): No connection could be made because the target machine actively refused it. in C:\xampp\htdocs\test\1.php on line 725$host = 'localhost';26$db = 'test';27$user = 'root';28$pass = '';29$charset = 'utf8mb4';30$dsn = "mysql:host=$host;dbname=$db;charset=$charset";31];
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Execute automation tests with testAddData on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.
Test now for FreeGet 100 minutes of automation test minutes FREE!!