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;
 }
 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));
 }
 public function test_command()
 {
     $this->object->user = null;
     $this->object->crontab = '/usr/bin/crontab';
     $expected = '/usr/bin/crontab';
     $actual = $this->object->__mock_command();
     $this->assertEquals($expected, $actual);
     $this->object->user = '******';
     $expected = 'sudo -u some-user /usr/bin/crontab';
     $actual = $this->object->__mock_command();
     $this->assertEquals($expected, $actual);
 }