You are here

public function SmsFrameworkUserActiveHoursServiceTest::testInHoursActiveHoursOff in SMS Framework 8

Same name and namespace in other branches
  1. 2.x modules/sms_user/tests/src/Kernel/SmsFrameworkUserActiveHoursServiceTest.php \Drupal\Tests\sms_user\Kernel\SmsFrameworkUserActiveHoursServiceTest::testInHoursActiveHoursOff()
  2. 2.1.x modules/sms_user/tests/src/Kernel/SmsFrameworkUserActiveHoursServiceTest.php \Drupal\Tests\sms_user\Kernel\SmsFrameworkUserActiveHoursServiceTest::testInHoursActiveHoursOff()

Test if in hours if active hours is disabled and out of active hours.

File

modules/sms_user/tests/src/Kernel/SmsFrameworkUserActiveHoursServiceTest.php, line 60

Class

SmsFrameworkUserActiveHoursServiceTest
Tests active hours service.

Namespace

Drupal\Tests\sms_user\Kernel

Code

public function testInHoursActiveHoursOff() {
  $this
    ->activeHoursStatus(FALSE);
  $this
    ->setActiveHours([
    [
      'start' => '2016-03-13 sunday 9:00',
      'end' => '2016-03-13 sunday 17:00',
    ],
  ]);
  $user = $this
    ->createUser([
    'timezone' => 'America/New_York',
  ]);
  $now = '2016-03-13 Sunday 10pm America/New_York';
  $this
    ->assertTrue($this->activeHoursService
    ->inHours($user, $now));
}