public function testGetsAllReservationsWithReminderDateOfThisMinute() { $seriesId = 123; $instanceId = 456; $referenceNumber = 'refnum1'; $startDate = Date::Now()->AddDays(1)->ToDatabase(); $endDate = Date::Now()->AddDays(2)->ToDatabase(); $title = 'reservation title'; $description = 'reservation description'; $resourceName = 'resource name'; $emailAddress = '*****@*****.**'; $fname = 'first'; $lname = 'last'; $timezone = 'America/Chicago'; $reminder_minutes = 100; $now = Date::Now(); $language = 'en_us'; $row1 = new ReminderNoticeRow($seriesId, $instanceId, $referenceNumber, $startDate, $endDate, $title, $description, $resourceName, $emailAddress, $fname, $lname, $timezone, $reminder_minutes, $language); $row2 = new ReminderNoticeRow(); $rows = array_merge($row1->Rows(), $row2->Rows()); $this->db->SetRows($rows); $reminderNotices = $this->repository->GetReminderNotices($now, ReservationReminderType::Start); $expectedCommand = new GetReminderNoticesCommand($now->ToTheMinute(), ReservationReminderType::Start); $this->assertEquals(2, count($reminderNotices)); $this->assertEquals($expectedCommand, $this->db->_LastCommand); $expectedReminderNotice = ReminderNotice::FromRow($rows[0]); $this->assertEquals($expectedReminderNotice, $reminderNotices[0]); }
/** @test */ public function should_reset_password_and_return_user() { $reminder = new Reminder($this->fixture['id'], $this->fixture['email'], $this->fixture['code']); $this->reminders->shouldReceive('findReminderByEmailAndCode')->andReturn($reminder); $this->users->shouldReceive('userOfEmail')->andReturn($this->user); $this->hasher->shouldReceive('hash')->andReturn(new HashedPassword('qwerty123')); $this->users->shouldReceive('update'); $this->reminders->shouldReceive('deleteReminderByCode'); $user = $this->service->reset('*****@*****.**', 'qwerty123', 'abc123'); $this->assertInstanceOf('Cribbb\\Domain\\Model\\Identity\\User', $user); }
/** @test */ public function should_reset_password_and_return_user() { $reminder = m::mock('Cribbb\\Domain\\Model\\Identity\\Reminder'); $reminder->shouldReceive('isValid')->andReturn(true); $this->reminders->shouldReceive('findReminderByEmailAndCode')->andReturn($reminder); $user = m::mock('Cribbb\\Domain\\Model\\Identity\\User'); $this->users->shouldReceive('userOfEmail')->once()->andReturn($user); $user->shouldReceive('resetPassword')->once(); $this->users->shouldReceive('update')->once(); $this->reminders->shouldReceive('deleteReminderByCode')->once(); $user = $this->service->reset('*****@*****.**', 'password', 'abc123'); $this->assertInstanceOf('Cribbb\\Domain\\Model\\Identity\\User', $user); }
This script must be executed every minute for to enable Reservation Reminders functionality * * * * * php -f /home/mydomain/public_html/booked/Jobs/sendreminders.php * * * * * /path/to/php -f /home/mydomain/public_html/booked/Jobs/sendreminders.php */ define('ROOT_DIR', dirname(__FILE__) . '/../'); //define('ROOT_DIR', __DIR__ . '/../'); require_once ROOT_DIR . 'Domain/Access/namespace.php'; require_once ROOT_DIR . 'Domain/Reminder.php'; require_once ROOT_DIR . 'lib/Email/Messages/ReminderEmail.php'; require_once ROOT_DIR . 'Jobs/JobCop.php'; Log::Debug('Running sendreminders.php'); JobCop::EnsureCommandLine(); try { $repository = new ReminderRepository(); $now = Date::Now(); $startNotices = $repository->GetReminderNotices($now, ReservationReminderType::Start); Log::Debug('Found %s start reminders', count($startNotices)); foreach ($startNotices as $notice) { ServiceLocator::GetEmailService()->Send(new ReminderStartEmail($notice)); } $endNotices = $repository->GetReminderNotices(Date::Now(), ReservationReminderType::End); Log::Debug('Found %s end reminders', count($endNotices)); foreach ($endNotices as $notice) { ServiceLocator::GetEmailService()->Send(new ReminderEndEmail($notice)); } } catch (Exception $ex) { Log::Error('Error running sendreminders.php: %s', $ex); } Log::Debug('Finished running sendreminders.php');
public static function SendItOut(Reminder $reminder) { $message = $reminder->Message(); $subject = "Automatic Reminder from Booked Scheduler"; /* replace 'username' and 'password' with your GoogleVoice sign-in */ $gv = new GoogleVoice("username", "password"); $addresses = explode(',', str_replace(' ', '', $reminder->Address())); foreach ($addresses as $address) { var_dump($address); if (ctype_digit($address)) { $gv->sms($address, $message); } else { mail($address, $subject, $message); } } $repository = new ReminderRepository(); $repository->DeleteReminder($reminder->ReminderID()); return; }