Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save svpernova09/3e268c9b414a26aaff207ce90150c91c to your computer and use it in GitHub Desktop.
Save svpernova09/3e268c9b414a26aaff207ce90150c91c to your computer and use it in GitHub Desktop.
<?php
namespace Tests\Unit;
use PHPUnit\Framework\TestCase;
class ShouldSendEmailTest extends TestCase
{
/**
* A basic unit test example.
*
* @return void
*/
public function test_should_send_email_method()
{
$class = new Foo();
#$email_send_time = Source your send time
#$timezone - # Set your timezone on send time
$this->assertTrue($class->shouldSendEmail($email_send_time, $timezone));
}
}
class Foo {
public function shouldSendEmail($email_send_time, $timezone) {
// $email_send_time = $location->settings->automatic_email_send_time;
// $timezone = $location->timezone;
$send_at = Carbon::createFromTimeString($email_send_time, $timezone);
$now = Carbon::now('UTC');
$utc_send = $send_at->setTimezone('UTC');
if ($utc_send->equalTo($now)) {
return true;
} else {
return false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment