public function setUp() { parent::setUp(); $this->request = m::mock('\\Illuminate\\Http\\Request'); $this->themes = new Themes(); self::$files->shouldReceive('exists')->andReturn(false); $this->lastWeek = Carbon::today()->subWeek()->format('Y-m-d'); $this->yesterday = Carbon::yesterday()->format('Y-m-d'); $this->today = Carbon::today()->format('Y-m-d'); $this->tomorrow = Carbon::tomorrow()->format('Y-m-d'); $this->nextWeek = Carbon::today()->addWeek()->format('Y-m-d'); }
/** * Define the application's command schedule. * * @param \Illuminate\Console\Scheduling\Schedule $schedule * * @return void */ protected function schedule(Schedule $schedule) { $schedule->command('inspire')->hourly(); // 进入维护模式 $schedule->command('down')->evenInMaintenanceMode()->dailyAt('23:00'); //->when(function () {return true;});// // 更新用户等级 $schedule->call(function () { $registrations = Registration::where('state', 0)->where(function ($query) { $query->where('registration_date', Carbon::yesterday()->toDateString()); })->get(); foreach ($registrations as $registration) { $user = $registration->user; $user->credit_level -= 1; $user->save(); } })->evenInMaintenanceMode()->daily(); // // 重置rest_num $schedule->call(function () { $doctor_schedules = DocSchedule::where('state', 0)->where(function ($query) { $week = [1 => 'monday', 2 => 'tuesday', 3 => 'wednesday', 4 => 'thursday', 5 => 'friday', 6 => 'saturday', 7 => 'sunday']; $query->where('doctoring_date', $week[Carbon::today()->dayOfWeek]); })->get(); foreach ($doctor_schedules as $doctor_schedule) { $doctor_schedule->rest_num = $doctor_schedule->total_num; $doctor_schedule->save(); } })->evenInMaintenanceMode()->dailyAt('3:00'); // // 离开维护模式 $schedule->command('up')->evenInMaintenanceMode()->dailyAt('7:00'); // }
/** @test */ public function conferences_dont_accept_proposals_outside_of_the_call_for_papers() { $conference = Factory::create('conference', ['cfp_starts_at' => Carbon::tomorrow(), 'cfp_ends_at' => Carbon::tomorrow()->addDay()]); $this->assertFalse($conference->isCurrentlyAcceptingProposals()); $conference = Factory::create('conference', ['cfp_starts_at' => Carbon::yesterday()->subDay(), 'cfp_ends_at' => Carbon::yesterday()]); $this->assertFalse($conference->isCurrentlyAcceptingProposals()); }
/** * @return array */ private function getDateRange() { if (is_array($this->dateRange)) { return $this->dateRange; } switch (strtolower($this->dateRange)) { case 'today': return [$this->carbon->today(), $this->carbon->tomorrow()]; case 'yesterday': return [$this->carbon->yesterday(), $this->carbon->today()]; case 'thisweek': return [$this->carbon->today()->dayOfWeek === 0 ? $this->carbon->today() : $this->carbon->today()->previous(0), $this->carbon->tomorrow()]; case 'lastweek': return [$this->carbon->today()->dayOfWeek === 0 ? $this->carbon->today()->previous(0) : $this->carbon->today()->previous(0)->previous(), $this->carbon->today()->previous(6)->addDay()]; case 'thismonth': return [$this->carbon->today()->startOfMonth(), $this->carbon->tomorrow()]; case 'lastmonth': return [$this->carbon->today()->subMonth()->startOfMonth(), $this->carbon->today()->subMonth()->endOfMonth()]; } }
public function initDateFilterGroup($workspace, $extra = null) { if ($extra == null) { return null; } if ($workspace) { $beginDate = $workspace->W_DATE_BEGIN; $endDate = $workspace->W_DATE_END; } else { $beginDate = Carbon::yesterday(); $endDate = Carbon::now(); } foreach ($extra as $id => $item) { switch ($item['id']) { case 'date_begin': $item['value'] = $beginDate; break; case 'date_end': $item['value'] = $endDate; break; default: break; } $extra[$id] = $item; } return $extra; }
public function index() { //using function from the Trait currentDate. $targetDay = $this->getCurrentDate(); //retrieving data for the next 3 days prior and after the currentDate $dateDayAfter = Carbon::tomorrow(); $dateDayBefore = Carbon::yesterday(); $dateDayAfter2 = Carbon::tomorrow()->addDay(); $dateDayAfter3 = Carbon::tomorrow()->addDays(2); $weekBeforeObject = Carbon::yesterday()->subDays(6); $weekAfterObject = Carbon::tomorrow()->addDays(6); $dateDayBefore2 = Carbon::yesterday()->subDay(); $dateDayBefore3 = Carbon::yesterday()->subDays(2); //putting the data in the array using the function inside the controller $dayAfter = $this->dateObjectToArray($dateDayAfter); $dayBefore = $this->dateObjectToArray($dateDayBefore); $dayAfter2 = $this->dateObjectToArray($dateDayAfter2); $dayAfter3 = $this->dateObjectToArray($dateDayAfter3); $dayBefore2 = $this->dateObjectToArray($dateDayBefore2); $dayBefore3 = $this->dateObjectToArray($dateDayBefore3); $weekBefore = $this->dateObjectToArray($weekBeforeObject); $weekAfter = $this->dateObjectToArray($weekAfterObject); $data = ['thisDay' => '', 'thisWeek' => "class = active ", 'thisMonth' => '', 'id' => 'thisWeek']; // $listdata = $this->listRepository->getLists(); return view('main-tabs.thisWeek', $data)->with('targetDay', $targetDay)->with('dayBefore', $dayBefore)->with('dayAfter', $dayAfter)->with('dayAfter2', $dayAfter2)->with('dayAfter3', $dayAfter3)->with('dayBefore2', $dayBefore2)->with('dayBefore3', $dayBefore3)->with('weekYearBefore', $weekBefore['currentYear'])->with('weekYearAfter', $weekAfter['currentYear'])->with('weekMonthBefore', $weekBefore['currentMonth'])->with('weekMonthAfter', $weekAfter['currentMonth'])->with('weekDayBefore', $weekBefore['currentDay'])->with('weekDayAfter', $weekAfter['currentDay']); }
/** * Run the command */ public function fire() { if (!\Config::get('coanda::coanda.daily_digest_enabled')) { $this->error('Daily digest emails are disabled.'); return; } $offset = 0; $limit = 50; $from = \Carbon\Carbon::yesterday()->subDays(30); $to = \Carbon\Carbon::yesterday(); $digest_data = ['summary_figures' => $this->history_repository->getDigestSummaryFigures(), 'history_list' => $this->history_repository->getAllPaginatedByTimePeriod($from->format('y-m-d') . ' 00:00:00', $to->format('y-m-d') . ' 23:59:59', 20), 'from' => $from, 'to' => $to]; while (true) { $subscribers = $this->history_repository->getDigestSubscribers($limit, $offset); if ($subscribers->count() == 0) { $this->info('All done.'); return; } foreach ($subscribers as $subscriber) { if ($subscriber->email) { $email = $subscriber->email; \Mail::send('coanda::admin.modules.history.emails.dailydigest', $digest_data, function ($message) use($email) { $message->subject(\Config::get('coanda::coanda.daily_digest_subject')); $message->from(\Config::get('coanda::coanda.site_admin_email'), \Config::get('coanda::coanda.site_name')); $message->to($email); }); $this->info('Sent digest email to: ' . $email); } } $offset += $limit; } }
/** * Execute the console command. * @return mixed */ public function handle() { $client = new Client(); //Call to EMS API to get the employee details $date = Carbon::yesterday()->format('Y-m-d'); //$date = '2016-03-03'; $ems_data = $client->get(env(APP_HOST) . "/" . EMS_API_PATH . 'employee_list/' . $date); if ($ems_data->getStatusCode() == STATUS_OK) { $data = json_decode($ems_data->getBody()->getContents()); foreach ($data as $key => $ems) { $staff = Staff::whereEmail($ems->employee_email_id)->first(); if (!empty($staff)) { //Find JIRA hours $worklog = Timelog::whereStaffId($staff->id)->whereStarted($date)->sum('time_spent'); $actual_jira_hours = gmdate('H:i:s', $worklog); $actual_ems_hours = $ems->actual_hours; //Comparing EMS and JIRA hours if ($actual_jira_hours != NULL && $actual_jira_hours != '00:00:00' && $actual_ems_hours != NULL && $actual_ems_hours != '00:00:00') { $diffrence = $actual_ems_hours - $actual_jira_hours; //IF difference is greater then 1 hour, then update EMS // Call back to EMS to mark employee as half absent $client->get(env(APP_HOST) . "/" . EMS_API_PATH . 'update_employee_timesheet/' . $ems->emp_id . '/' . $date . ($diffrence > ONE && $diffrence < FOUR) ? '/half' : '/full'); } } } } }
public function index() { //getting the date today, and finding the corresponding list to it. $dateToday = $this->getCurrentDate(); $dateObjectYesterday = Carbon::yesterday(); $dateObjectTomorrow = Carbon::tomorrow(); $dateArrayYesterday = $this->dateObjectToArray($dateObjectYesterday); $dateArrayTomorrow = $this->dateObjectToArray($dateObjectTomorrow); $dayBefore = $dateArrayYesterday['currentDay'] . "/" . $dateArrayYesterday['currentMonth'] . "/" . $dateArrayYesterday['currentYear']; $dayAfter = $dateArrayTomorrow['currentDay'] . "/" . $dateArrayTomorrow['currentMonth'] . "/" . $dateArrayTomorrow['currentYear']; //checks if a lists exists for a corresponnding date. If there is no list, returns a null value. $currentList = $this->listRepository->getSpecificList($dateToday['currentDay'] . "/" . $dateToday['currentMonth'] . "/" . $dateToday['currentYear']); if (!empty($currentList)) { $currentListID = $currentList->id; $logsData = $this->logRepository->getSpecificLogsByList($currentListID); if ($logsData->isEmpty()) { $logsData = null; } } else { $logsData = null; } $data = ['thisDay' => "class = active ", 'thisWeek' => '', 'thisMonth' => '', 'id' => 'thisDay']; $dayName = $dateToday['currentDayName']; $monthName = $dateToday['currentMonthName']; $day = $dateToday['currentDay']; $year = $dateToday['currentYear']; return view('main-tabs.thisDay', $data)->with('logsData', $logsData)->with('dayBefore', $dayBefore)->with('dayAfter', $dayAfter)->with('dayName', $dayName)->with('monthName', $monthName)->with('day', $day)->with('year', $year); }
public function testGetExecutionTime() { $job = new Job(); $this->assertEquals('N/A', $job->getExecutionTime()); $job->started_at = Carbon::yesterday(); $job->completed_at = Carbon::yesterday()->addMinutes(5); $this->assertEquals('5 minutes', $job->getExecutionTime()); }
/** * @param $dateEnd * @return static */ public static function getDateEnd($dateEnd) { if (!is_null($dateEnd)) { $dateEndCarbon = Carbon::createFromFormat("Y-m-d", $dateEnd); } else { $dateEndCarbon = Carbon::yesterday(); } return $dateEndCarbon; }
public function scopeUpcoming($query) { $events = EventOccurrence::all()->filter(function ($events) { return Carbon::Parse($events['date']) > Carbon::yesterday(); })->map(function ($value, $key) { return $value['id']; }); return $query->whereIn('id', $events); }
public function testParseWithTestValueSet() { $notNow = Carbon::yesterday(); Carbon::setTestNow($notNow); $this->assertEquals($notNow, Carbon::parse()); $this->assertEquals($notNow, Carbon::parse(null)); $this->assertEquals($notNow, Carbon::parse('')); $this->assertEquals($notNow, Carbon::parse('now')); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { /* $dt = Carbon::create(2015, 12, 1, 0); $dt->addWeekdays(10); echo $dt->subDay(1);*/ if (Carbon::yesterday()->isWeekend()) { echo 'Party!'; } }
public function seedDiscounts() { $expired = Factory::create(new Discount(), ['start_at' => null, 'end_at' => Carbon::yesterday()]); $running = Factory::create(new Discount(), ['start_at' => Carbon::yesterday(), 'end_at' => Carbon::tomorrow()]); $running->products()->sync([1, 2, 3]); $running->save(); $upcoming = Factory::create(new Discount(), ['start_at' => Carbon::tomorrow(), 'end_at' => null]); $upcoming->categories()->sync([5]); $upcoming->save(); }
public function testPushWithPast() { $impersonator = new Impersonator(); /** @var JobScheduler $scheduler */ $scheduler = $impersonator->make(JobScheduler::class); $job = new Job(); $job->task = 'test.test'; $job->state = JobState::IDLE; $this->setExpectedException(InvalidArgumentException::class); $scheduler->push($job, Carbon::yesterday()); }
public function test_it_refreshs_expired_token() { // Add expires_in column to Token Table // updated_at will always be updated when saving! $newUpdateTimeStamp = \Carbon\Carbon::yesterday(); $client = app()->make(Client::class); $user = $this->user(); $imgurToken = $this->imgurToken($user); $imgurToken->update(['updated_at' => $newUpdateTimeStamp]); $client->setUser($user); $this->assertNotEquals($newUpdateTimeStamp, $client->getUser()->imgurToken->updated_at); }
/** * Tests the update tournament method. */ public function testUpdateTournamentUpdateSuccess() { $name = 'testing name update'; $beginDate = \Carbon\Carbon::yesterday(); $finishDate = \Carbon\Carbon::tomorrow(); $has_ended = true; $tournament = Factory::create('App\\Models\\Tournament'); $tournament = $this->repository->updateTournament(Administrator::find($tournament->created_by), $tournament->name, $beginDate, $finishDate, $has_ended); $this->assertEquals($tournament->begin, $beginDate); $this->assertEquals($tournament->finish, $finishDate); $this->assertEquals($tournament->has_ended, $has_ended); }
/** * @test */ public function it_can_show_the_total_calories_for_yesterday() { $this->logInUser(); $date = Carbon::yesterday()->format('Y-m-d'); $response = $this->call('GET', '/api/calories/' . $date); $content = json_decode($response->getContent(), true); // dd($content); $this->assertArrayHasKey('forTheDay', $content); $this->assertArrayHasKey('averageFor7Days', $content); $this->assertEquals(60, $content['forTheDay']); $this->assertEquals(90, $content['averageFor7Days']); $this->assertEquals(Response::HTTP_OK, $response->getStatusCode()); }
/** @test */ public function it_should_get_all_threads_with_new_messages() { $user = User::create(['name' => 'John Doe', 'email' => '*****@*****.**', 'notify' => 'y']); $thread = $this->faktory->create('thread'); $user_1 = $this->faktory->build('participant', ['user_id' => $user->id, 'last_read' => Carbon::yesterday()]); $user_2 = $this->faktory->build('participant', ['user_id' => 2]); $thread->participants()->saveMany([$user_1, $user_2]); $message_1 = $this->faktory->build('message', ['user_id' => 2]); $thread->messages()->saveMany([$message_1]); $thread2 = $this->faktory->create('thread'); $user_1b = $this->faktory->build('participant', ['user_id' => 3, 'last_read' => Carbon::yesterday()]); $user_2b = $this->faktory->build('participant', ['user_id' => 2]); $thread2->participants()->saveMany([$user_1b, $user_2b]); $message_1b = $this->faktory->build('message', ['user_id' => 2]); $thread2->messages()->saveMany([$message_1b]); $threads = $user->threadsWithNewMessages(); $this->assertEquals(1, $threads[0]); $this->assertEquals(1, $user->newMessagesCount()); }
public function testStatsWithUpdatesThisWeek() { // given $user = factory(App\Models\User::class)->create(); $book = factory(App\Models\Book::class)->create(); $assignment = factory(App\Models\BookAssignment::class)->create(['user_id' => $user->id, 'book_id' => $book->id]); $update = factory(App\Models\AssignmentUpdate::class)->create(['assignment_id' => $assignment->id, 'created_at' => Carbon::yesterday()]); // when Artisan::call('stats:update', ['userId' => $user->id]); // then $stats = Cache::get('stats_' . $user->id); $this->assertEquals($stats['yearly']['num_pages_read'], 100); $this->assertEquals($stats['monthly']['num_pages_read'], 100); $this->assertEquals($stats['weekly']['num_pages_read'], 100); $this->assertEquals($stats['yearly']['books_read'], 0); $this->assertEquals($stats['monthly']['books_read'], 0); $this->assertEquals($stats['weekly']['books_read'], 0); $this->assertNull($stats['daily']); }
/** * @test * @return void */ public function it_gets_the_timers_for_a_day() { $date = Carbon::yesterday(); $response = $this->call('GET', '/api/timers?date=' . $date->copy()->format('Y-m-d')); $content = json_decode($response->getContent(), true); // dd($content); $this->checkTimerKeysExist($content[0]); $this->assertEquals(75, $content[0]['durationInMinutesForDay']); $this->assertEquals(180, $content[1]['durationInMinutesForDay']); $this->assertEquals(60, $content[2]['durationInMinutesForDay']); $this->assertEquals(510, $content[3]['durationInMinutesForDay']); $this->assertEquals(75, $content[4]['durationInMinutesForDay']); $this->assertEquals(180, $content[5]['durationInMinutesForDay']); $this->assertEquals(60, $content[6]['durationInMinutesForDay']); $this->assertEquals(510, $content[7]['durationInMinutesForDay']); //Todo: check the values are correct $this->assertContains($date->copy()->format('Y-m-d'), $content[0]['start']); // $this->assertEquals($date->copy()->format('Y-m-d'), $content[0]['startDate']); $this->assertEquals(200, $response->getStatusCode()); }
public function test_selecting_discount_statuses() { $expired1 = Factory::create(new Discount(), ['start_at' => null, 'end_at' => Carbon::yesterday()]); $expired2 = Factory::create(new Discount(), ['start_at' => Carbon::now()->subDays(5), 'end_at' => Carbon::yesterday()]); $running1 = Factory::create(new Discount(), ['start_at' => null, 'end_at' => null]); $running2 = Factory::create(new Discount(), ['start_at' => Carbon::yesterday(), 'end_at' => null]); $running3 = Factory::create(new Discount(), ['start_at' => null, 'end_at' => Carbon::tomorrow()]); $running4 = Factory::create(new Discount(), ['start_at' => Carbon::yesterday(), 'end_at' => Carbon::tomorrow()]); $upcoming1 = Factory::create(new Discount(), ['start_at' => Carbon::tomorrow(), 'end_at' => null]); $upcoming2 = Factory::create(new Discount(), ['start_at' => Carbon::tomorrow(), 'end_at' => Carbon::now()->addDays(5)]); $discounts = Discount::selectStatus()->get(); $this->assertEquals(-1, $discounts->where('id', $expired1->id)->first()->status); $this->assertEquals(-1, $discounts->where('id', $expired2->id)->first()->status); $this->assertEquals(0, $discounts->where('id', $running1->id)->first()->status); $this->assertEquals(0, $discounts->where('id', $running2->id)->first()->status); $this->assertEquals(0, $discounts->where('id', $running3->id)->first()->status); $this->assertEquals(0, $discounts->where('id', $running4->id)->first()->status); $this->assertEquals(1, $discounts->where('id', $upcoming1->id)->first()->status); $this->assertEquals(1, $discounts->where('id', $upcoming2->id)->first()->status); }
public function scopeSort($query, $input) { if (array_key_exists("sortForm", $input)) { if ($input['sortForm'] === 'price_down') { $query->orderBy('price', 'desc'); } elseif ($input['sortForm'] === 'price_up') { $query->orderBy('price', 'asc'); } elseif ($input['sortForm'] === 'date') { $query->orderBy('created_at', 'desc'); } } if (array_key_exists("sortFormDate", $input)) { if ($input['sortFormDate'] === 'all_time') { $query->orderBy('created_at', 'desc'); } elseif ($input['sortFormDate'] === 'three_days') { $query->where('created_at', '>=', Carbon::yesterday()); } elseif ($input['sortFormDate'] === 'week') { $query->where('created_at', '>=', Carbon::now()->subWeek()); } } }
/** * @test */ public function day_shift_times() { $now = Carbon::now()->setTime(16, 0, 0); $yesterday = Carbon::yesterday()->setTime(16, 0, 0); $now_calculator = new ShiftTimeCalculator(); $yesterday_calculator = new ShiftTimeCalculator($yesterday); $now_day_shift_start = $now->copy()->setTime(6, 0, 0); $now_day_shift_end = $now->copy()->setTime(18, 0, 0); $yesterday_day_shift_start = $yesterday->copy()->setTime(6, 0, 0); $yesterday_day_shift_end = $yesterday->copy()->setTime(18, 0, 0); //Check Start Times $this->assertEquals($now_day_shift_start, $now_calculator->day_shift_start_time, "Now Day Shift Start Time"); $this->assertEquals($yesterday_day_shift_start, $yesterday_calculator->day_shift_start_time, "Yesterday Day\n Shift Start Time"); //Check End Times $this->assertEquals($now_day_shift_end, $now_calculator->day_shift_end_time, "Now Day Shift End Time"); $this->assertEquals($yesterday_day_shift_end, $yesterday_calculator->day_shift_end_time, "Yesterday Day Shift End\n Time"); //Check Current Start / End time $this->assertEquals($now_day_shift_start, $now_calculator->current_shift_start_time, "Now Current Shift Start\n Time"); $this->assertEquals($yesterday_day_shift_start, $yesterday_calculator->current_shift_start_time, "Yesterday\n Current\n Shift Start\n Time"); $this->assertEquals($now_day_shift_end, $now_calculator->current_shift_end_time, "Now Current Shift End Time"); $this->assertEquals($yesterday_day_shift_end, $yesterday_calculator->current_shift_end_time, "Yesterday Current\n Shift End\n Time"); }
static function get_cheapest_upcoming_schedules_to_tour($tour) { $schedules = $tour->schedules; if (!$schedules) { return null; } //////////////////////// // Upcoming schedules // //////////////////////// $upcoming_schedules = array_where($schedules, function ($k, $v) { if (!$v->departure_until) { return \Carbon\Carbon::yesterday()->lt(\Carbon\Carbon::parse($v->departure)); } else { return \Carbon\Carbon::yesterday()->lt(\Carbon\Carbon::parse($v->departure_until)); } }); //////////////////////////////// // Sort By Cheapest Schedules // //////////////////////////////// $cheapest_upcoming_schedules = array_sort($upcoming_schedules, function ($upcoming_schedule) { if (!$upcoming_schedule->promos) { return $upcoming_schedule->price; } else { $current_promo = array_where($upcoming_schedule->promos, function ($k, $v) { return \Carbon\Carbon::yesterday()->gte(\Carbon\Carbon::createFromFormat('Y-m-d', $v->since)) && \Carbon\Carbon::yesterday()->lte(\Carbon\Carbon::createFromFormat('Y-m-d', $v->until)); }); if (head($current_promo)->price) { return min(head($current_promo)->price, $upcoming_schedule->price); } else { return $upcoming_schedule->price; } } }); /////////////////// // Return result // /////////////////// return $cheapest_upcoming_schedules; }
public function test_has_expiration_and_has_ended_methods() { $running1 = Factory::make(new Discount(), ['end_at' => null]); $running2 = Factory::make(new Discount(), ['end_at' => Carbon::tomorrow()]); $ended = Factory::make(new Discount(), ['end_at' => Carbon::yesterday()]); $this->assertFalse($running1->hasEnded()); $this->assertFalse($running2->hasEnded()); $this->assertTrue($ended->hasEnded()); $this->assertFalse($running1->hasExpiration()); $this->assertTrue($running2->hasExpiration()); }
/** * Count total Contracts * * @param string $date * @return contract */ public function countContractTotal($date = '') { switch ($date) { case 'today': $dateFormat = $this->carbon->today()->toDateString(); break; case 'yesterday': $dateFormat = $this->carbon->yesterday()->toDateString(); break; case 'this_month': $dateFormat = [$this->carbon->firstOfMonth()->toDateString(), $this->carbon->now()->toDateString()]; break; case 'last_month': $dateFormat = [$this->carbon->now()->subMonth(1)->firstOfMonth()->toDateString(), $this->carbon->now()->subMonth(1)->endOfMonth()->toDateString()]; break; default: $dateFormat = ''; break; } return $this->contract->countTotal($dateFormat); }
/** * */ private function giveANotBeforeValueToSomeItems() { $dateTime = Carbon::yesterday()->subDays(1); $items = Item::orderBy('id', 'desc')->whereNull('parent_id')->limit(3)->get(); foreach ($items as $index => $item) { $dateTime->addDay(1); $item->not_before = $dateTime->copy()->format('Y-m-d H:i:s'); if ($index === 2) { //Make it a recurring item $item->recurring_unit = 'minute'; $item->recurring_frequency = 1; } $item->save(); } }
/** * Tests if the update match on the repo * works correctly. */ public function testUpdateMatchUpdateSuccess() { $match = Factory::create('App\\Models\\Match'); $newPlayer = Factory::create('App\\Models\\Player'); $newSecondPlayer = Factory::create('App\\Models\\Player'); $winner = $newPlayer; $ended = true; $newBegin = \Carbon\Carbon::yesterday(); $newFinish = \Carbon\Carbon::tomorrow(); $match = $this->repository->updateMatch(Administrator::find($match->created_by), $match->id, $newPlayer, $newSecondPlayer, $winner, $newBegin, $newFinish, $ended); $this->assertEquals($match->firstPlayer->id, $newPlayer->id); $this->assertEquals($match->secondPlayer->id, $newSecondPlayer->id); $this->assertEquals($match->winner, $winner->id); $this->assertEquals($match->begin, $newBegin); $this->assertEquals($match->finish, $newFinish); $this->assertEquals($match->has_ended, $ended); }