protected function _createManager() { if ($this->manager) { return $this->manager; } $content = file_get_contents(dirname(__DIR__) . '/resources/cronfile.txt'); $this->manager = new MockCrontabManager(); $this->manager->setInitialContents($content); $this->manager->crontab = 'php ' . __DIR__ . '/crontab.php'; $this->manager->user = null; return $this->manager; }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { $content = file_get_contents(__DIR__ . '/resources/cronfile.txt'); $manager = new MockCrontabManager(); $manager->setInitialContents($content); $manager->crontab = 'php ' . __DIR__ . '/mock/crontab.php'; $manager->user = null; $this->object = $manager; }
public function testCreateWithGroup() { $content = file_get_contents(__DIR__ . '/resources/cronfile.txt'); $manager = new MockCrontabManager(); $manager->setInitialContents($content); $job = new CronEntry('* * * * * w', $manager, 'q1'); $expected = '* * * * * /usr/bin/w # qn15b0'; $this->assertEquals($expected, $job->render(true)); $job = new CronEntry('* * * * * w', $manager); $expected = '* * * * * /usr/bin/w # oxnujd'; $this->assertEquals($expected, $job->render(true)); }