[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/calendar/storage/__tests__/ -> PhabricatorCalendarHolidayTestCase.php (source)

   1  <?php
   2  
   3  final class PhabricatorCalendarHolidayTestCase extends PhabricatorTestCase {
   4  
   5    protected function getPhabricatorTestCaseConfiguration() {
   6      return array(
   7        self::PHABRICATOR_TESTCONFIG_BUILD_STORAGE_FIXTURES => true,
   8      );
   9    }
  10  
  11    protected function willRunTests() {
  12      parent::willRunTests();
  13      id(new PhabricatorCalendarHoliday())
  14        ->setDay('2012-01-02')
  15        ->setName('International Testing Day')
  16        ->save();
  17    }
  18  
  19    public function testNthBusinessDay() {
  20      $map = array(
  21        array('2011-12-30', 1, '2012-01-03'),
  22        array('2012-01-01', 1, '2012-01-03'),
  23        array('2012-01-01', 0, '2012-01-01'),
  24        array('2012-01-01', -1, '2011-12-30'),
  25        array('2012-01-04', -1, '2012-01-03'),
  26      );
  27      foreach ($map as $val) {
  28        list($date, $n, $expect) = $val;
  29        $actual = PhabricatorCalendarHoliday::getNthBusinessDay(
  30          strtotime($date),
  31          $n);
  32        $this->assertEqual(
  33          $expect,
  34          date('Y-m-d', $actual),
  35          "{$n} business days since '{$date}'");
  36      }
  37    }
  38  
  39  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1