public function testWaitTime() { $specIDs = Specimen::where('specimen_status_id', '!=', Specimen::NOT_COLLECTED)->lists('id'); if (count($specIDs) == 0) { $this->assertTrue(false); } foreach ($specIDs as $id) { $test = Specimen::find($id)->test()->first(); $this->assertTrue($test->getWaitTime() >= 0); } }
/** * Refer action * * @return View */ public function referAction() { //Validate $rules = array('referral-status' => 'required', 'facility_id' => 'required|non_zero_key', 'person', 'contacts'); $validator = Validator::make(Input::all(), $rules); $specimenId = Input::get('specimen_id'); if ($validator->fails()) { return Redirect::route('test.refer', array($specimenId))->withInput()->withErrors($validator); } //Insert into referral table $referral = new Referral(); $referral->status = Input::get('referral-status'); $referral->facility_id = Input::get('facility_id'); $referral->person = Input::get('person'); $referral->contacts = Input::get('contacts'); $referral->user_id = Auth::user()->id; //Update specimen referral status $specimen = Specimen::find($specimenId); DB::transaction(function () use($referral, $specimen) { $referral->save(); $specimen->referral_id = $referral->id; $specimen->save(); }); //Start test Input::merge(array('id' => $specimen->test->id)); //Add the testID to the Input $this->start(); //Return view $url = Session::get('SOURCE_URL'); return Redirect::to($url)->with('message', trans('messages.specimen-successful-refer'))->with('activeTest', array($specimen->test->id)); }
</tbody> @elseif($selectedReport == 2) <!-- Specimens Registry Report--> <thead> <tr> <th>{{Lang::choice('messages.specimen-number',1)}}</th> <th>{{Lang::choice('messages.specimen-type',1)}}</th> <th>{{Lang::choice('messages.patient-number',1)}}</th> <th>{{Lang::choice('messages.patient',1)}}</th> <th>{{Lang::choice('messages.registration-date',1)}}</th> </tr> </thead> <tbody> @forelse($reportData as $row) <?php $specimen = Specimen::find($row->id); ?> <tr> <td>{{$specimen->id}}</td> <td>{{$specimen->specimenType->name}}</td> <td>{{$specimen->test->visit->patient->patient_number}}</td> <td>{{$specimen->test->visit->patient->name}}</td> <td>{{$specimen->time_accepted}}</td> </tr> @empty <tr> <td colspan='6'>{{Lang::choice('messages.no-data-found',1)}}</td> </tr> @endforelse </tbody>
public function testIsNotReferred() { $specimen = Specimen::find(1); $this->assertEquals($specimen->isReferred(), false); }