private function deleteWorkspace($params)
 {
     $backend = $params['backend'];
     $id = $params['id'];
     $server = $this->factory->getServer($backend);
     $tokenInfo = $this->storageApi->verifyToken();
     $account = $server->getActiveAccount($id, $tokenInfo["id"]);
     if ($account) {
         $server->removeAccount($account);
         $account->setActive(false);
         $server->getEntityManager()->persist($account);
         $server->getEntityManager()->flush();
         $this->logger->info(ucfirst($backend) . " credentials {$id} ({$account->getUser()}@{$account->getHostname()}) deleted.");
         return ['status' => 'ok'];
     } else {
         return ['status' => 'warning', 'message' => 'Credentials not found.'];
     }
 }
 public function testAddDead()
 {
     $command = $this->application->find('provisioning:add-docker-server');
     $commandTester = new CommandTester($command);
     $commandTester->execute(['key' => ECS_AWS_KEY, 'region' => ECS_AWS_REGION, 'cluster' => 'non-existing-cluster', '--secret' => ECS_AWS_SECRET]);
     $this->assertEquals(0, $commandTester->getStatusCode());
     /** @var StorageApiService $storageApi */
     $storageApi = $this->getSapiServiceStub();
     $logger = new Logger('null');
     $logger->pushHandler(new NullHandler());
     $serverFactory = new ServerFactory($this->doctrine, $storageApi, $logger);
     /** @var Docker $server */
     $server = $serverFactory->getServer('docker');
     $servers = $server->getServers(['cluster' => 'non-existing-cluster']);
     $this->assertCount(1, $servers);
     $this->assertEquals(ECS_AWS_KEY, $servers[0]->getKey());
     $this->assertEquals(ECS_AWS_REGION, $servers[0]->getRegion());
     $this->assertEquals('non-existing-cluster', $servers[0]->getCluster());
     $this->assertFalse($servers[0]->isAlive());
     try {
         $server->getAvailableServer($storageApi->getClient()->verifyToken());
         $this->fail("No active servers must raise an exception.");
     } catch (NoActiveServerException $e) {
     }
 }