Example #1
0
 /**
  * @test
  * @covers Cocur\Watchman\Watchman::deleteWatch()
  * @covers Cocur\Watchman\Watchman::runProcess()
  */
 public function deleteWatchCausesError()
 {
     $process = $this->getProcessMock();
     $process->shouldReceive('run')->once();
     $process->shouldReceive('stop')->once();
     $process->shouldReceive('isSuccessful')->once()->andReturn(true);
     $process->shouldReceive('getOutput')->once()->andReturn($this->getFixtures('watch-del-error.json'));
     $factory = $this->getProcessFactoryMock();
     $factory->shouldReceive('create')->with('watchman watch-del /var/www/foo')->once()->andReturn($process);
     $this->watchman->setProcessFactory($factory);
     try {
         $this->watchman->deleteWatch('/var/www/foo');
         $this->assertTrue(false);
     } catch (\RuntimeException $e) {
         $this->assertTrue(true);
         $this->assertEquals('unable to resolve root /var/www/foo/: directory /var/www/foo is not watched', $e->getMessage());
     }
 }