コード例 #1
0
 public function spawnUser()
 {
     $user = factory(App\User::class)->create();
     $user->name = 'FoodHistoryTest';
     $user->email = '*****@*****.**';
     $user->password = '******';
     $user->gender = 'female';
     $ageTemp = new \Carbon\Carbon();
     $ageTemp->addYear(-23);
     $user->bdate = $ageTemp->toDateString();
     $user->daily_calories = 1500;
     return $user;
 }
コード例 #2
0
 public function testCreateAndUpdateInvoice()
 {
     // Given an invoice data
     $data = factory(App\Invoice::class)->make()->toArray();
     // Create an invoice with the data
     $invoice = $this->invoiceRepository->createInvoice($data['user_id'], $data);
     // Verify the invoice in database
     $this->seeInDatabase('invoices', ['id' => $invoice->id, 'user_id' => $data['user_id']]);
     // Given a new due date
     $dueDate = new Carbon\Carbon('next month');
     // Update invoice with the new due date
     $invoice = $this->invoiceRepository->updateInvoice($invoice->id, ['due_date' => $dueDate]);
     // Verify the change in database
     $this->seeInDatabase('invoices', ['id' => $invoice->id, 'due_date' => $dueDate->toDateString()]);
 }
コード例 #3
0
 public function spawnUser()
 {
     $user = new App\User();
     $user->name = 'Test';
     $user->email = '*****@*****.**';
     $user->password = '******';
     $user->gender = 'female';
     $user->weight = '110';
     $user->height = '60';
     $ageTemp = new \Carbon\Carbon();
     $ageTemp->addYear(-23);
     $user->bdate = $ageTemp->toDateString();
     return $user;
 }