/** * Create and configure Cron * * @return CronFormatter */ private function createCronConfiguration() { $cron = new CronFormatter(); $configurator = new ArrayHeaderConfigurator($cron->header()); $configurator->configureFrom($this->config); return $cron; }
/** * @test */ public function shouldAppendKeyIfNotExist() { $this->manipulatorStub->contents = <<<CRON headers # KEY key1 value 1 # END no key CRON; $cron = new Cron(); $cron->header()->setPath('path')->end(); $cron->comment('new content'); $this->updater->updateWith($cron, 'key2'); $expectedCron = <<<CRON headers # KEY key1 value 1 # END no key # KEY key2 PATH=path #new content # END CRON; $this->assertEquals($expectedCron, $this->manipulatorStub->contents); }