MyBuilder\Cronos\Formatter\Cron::comment PHP Метод

comment() публичный Метод

public comment ( string $comment ) : Cron
$comment string
Результат Cron
    public function comment($comment)
    {
        $this->lines[] = new Comment($comment);
        return $this;
    }

Usage Example

Пример #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);
    }