Exemplo n.º 1
0
    /**
     * @test
     */
    public function shouldReplaceKeyIfExist()
    {
        $this->manipulatorStub->contents = <<<CRON
headers
# KEY key1
value 1
# END
no key
# KEY key2
# must be replaced
# END
# KEY key3
foo
# END

CRON;
        $cron = new Cron();
        $cron->comment('replace');
        $this->updater->updateWith($cron, 'key2');
        $expectedCron = <<<CRON
headers
# KEY key1
value 1
# END
no key
# KEY key2
#replace
# END
# KEY key3
foo
# END

CRON;
        $this->assertEquals($expectedCron, $this->manipulatorStub->contents);
    }
Exemplo n.º 2
0
 /**
  * Create and configure Cron
  *
  * @return CronFormatter
  */
 private function createCronConfiguration()
 {
     $cron = new CronFormatter();
     $configurator = new ArrayHeaderConfigurator($cron->header());
     $configurator->configureFrom($this->config);
     return $cron;
 }
Exemplo n.º 3
0
 private function wrapInKey(Cron $cron, $key)
 {
     return PHP_EOL . $this->beginKey($key) . PHP_EOL . trim($cron->format()) . PHP_EOL . self::KEY_END;
 }