/** * @param string $job * @param array $config * @param Helper $helper */ public function __construct($job, array $config, Helper $helper = null) { $this->job = $job; $this->config = $config + ['recipients' => null, 'mailer' => null, 'maxRuntime' => null, 'smtpHost' => null, 'smtpPort' => null, 'smtpUsername' => null, 'smtpPassword' => null, 'smtpSender' => null, 'smtpSenderName' => null, 'smtpSecurity' => null, 'runAs' => null, 'environment' => null, 'runOnHost' => null, 'output' => null, 'dateFormat' => null, 'enabled' => null, 'haltDir' => null, 'debug' => null]; $this->helper = $helper ?: new Helper(); $this->tmpDir = $this->helper->getTempDir(); }
/** * @param string $job * @param array $config * @param Helper $helper */ public function __construct($job, array $config, Helper $helper = null) { $this->job = $job; $this->config = $config; $this->helper = $helper; if ($this->helper === null) { $this->helper = new Helper(); } $this->tmpDir = $this->helper->getTempDir(); }
/** * @covers ::getTempDir */ public function testGetTempDir() { $valid = [sys_get_temp_dir(), getcwd()]; foreach (['TMP', 'TEMP', 'TMPDIR'] as $key) { if (!empty($_SERVER[$key])) { $valid[] = $_SERVER[$key]; } } $actual = $this->helper->getTempDir(); $this->assertContains($actual, $valid); }
/** * @covers Jobby\Helper::getTempDir */ public function testGetTempDir() { $valid = array(sys_get_temp_dir(), getcwd()); foreach (array("TMP", "TEMP", "TMPDIR") as $key) { if (!empty($_SERVER[$key])) { $valid[] = $_SERVER[$key]; } } $actual = $this->helper->getTempDir(); $this->assertContains($actual, $valid); }