/**
  * @expectedException \Sms\SynchronizedBundle\Exception\CannotAquireLockException
  * @expectedExceptionMessage test_service_sleep
  */
 public function testFailedFileDriver()
 {
     $fileLock = new File('lock');
     $fileLock->clearLocks();
     $p = new Process('php Tests/FileLockCommand.php test:file -s 5');
     $p->start();
     sleep(1);
     $eventDispatcher = new TestEventDispatcher();
     $decorator = new Decorator(new TestService(), 'test_service');
     $decorator->setEventDispatcher($eventDispatcher);
     $lock = new Lock();
     $lock->setDriver($fileLock)->setMethod('sleep');
     $decorator->addLock($lock);
     try {
         $decorator->sleep(1);
     } catch (\Exception $exception) {
         $p->stop();
         $this->assertArrayHasKey(LockEvent::EVENT_FAILURE_GET_LOCK, $eventDispatcher->getEvents());
         throw $exception;
     }
 }