コード例 #1
0
ファイル: ConfigTest.php プロジェクト: t4web/cron
 public function testBuildDefaultConfig()
 {
     $rawConfig = ['jobs' => [['id' => 'cron-job1', 'command' => 'index.php application cron-job1', 'schedule' => '* * * * *'], ['id' => 'cron-job2', 'command' => 'index.php application cron-job2', 'schedule' => '* * * * *']]];
     $defaultlogDirectory = getcwd() . '/data';
     $filesystem = $this->prophesize(FileSystem::class);
     $filesystem->isWritable($defaultlogDirectory)->willReturn(true);
     $config = new Config($rawConfig, $filesystem->reveal());
     $this->assertEquals($defaultlogDirectory, $config->getLogDirectory());
     $this->assertEquals('php', $config->getPhpPath());
     $this->assertEquals(getcwd() . '/public/', $config->getScriptPath());
     $this->assertEquals($rawConfig['jobs'], $config->getJobs());
     $this->assertNull($config->getTimeout());
 }
コード例 #2
0
ファイル: TextFile.php プロジェクト: t4web/cron
 /**
  * TextFile constructor.
  *
  * @param FileSystem $fileSystem
  * @param Config     $config
  */
 public function __construct(FileSystem $fileSystem, Config $config)
 {
     $this->fileSystem = $fileSystem;
     $this->logDirectory = $config->getLogDirectory();
 }