Beispiel #1
0
 private function inputBusyDays($busy_days, $user_name)
 {
     $taken = [];
     foreach ($busy_days as $day) {
         // Find unique reasons
         $randi = rand(0, count($this->reasons) - 1);
         while (isset($taken[$randi])) {
             $randi = rand(0, count($this->reasons) - 1);
         }
         $taken[$randi] = true;
         $appointment = new \App\Appointment();
         $appointment->day = $day;
         $appointment->user_id = \App\User::where('name', '=', $user_name)->first()->id;
         $appointment->reason = $this->reasons[$randi];
         $appointment->save();
     }
 }
 public function testDestroyAppointment()
 {
     Session::start();
     $newAppointment = new \App\Appointment();
     $newAppointment->name = 'Martin Fowler';
     $newAppointment->phoneNumber = '6692216251';
     $newAppointment->when = '2015-07-24T18:00:00.000Z';
     $newAppointment->notificationTime = '2015-07-24T17:45:00.000Z';
     $newAppointment->timezoneOffset = '300';
     $newAppointment->save();
     $idToDelete = $newAppointment->id;
     $appointments = \App\Appointment::where(['name' => 'Martin Fowler'])->get();
     $this->assertCount(1, $appointments);
     $this->call('DELETE', '/appointment/' . $idToDelete, ['_token' => csrf_token()]);
     $appointments = \App\Appointment::where(['name' => 'Martin Fowler'])->get();
     $this->assertCount(0, $appointments);
 }