Пример #1
0
 /**
  * Test state functionality.
  *
  * @return void
  */
 public function testState()
 {
     $tmp = sys_get_temp_dir() . '/';
     $date = '2016-07-12';
     $manager = new StateManager($tmp);
     $manager->saveState('foo', 'bar', $date);
     $this->assertEquals(['foo', 'bar', $date], $manager->loadState());
     $this->assertTrue(file_exists($tmp . 'last_state.txt'));
     $manager->clearState();
     $this->assertFalse(file_exists($tmp . 'last_state.txt'));
 }
Пример #2
0
 /**
  * Set date range configuration (support method for constructor).
  *
  * @param array $settings Configuration
  *
  * @return void
  */
 protected function storeDateSettings($settings)
 {
     // Set up start/end dates:
     $from = empty($settings['from']) ? $this->stateManager->loadDate() : $settings['from'];
     $until = empty($settings['until']) ? null : $settings['until'];
     $this->setStartDate($from);
     $this->setEndDate($until);
 }