Skip to content

Instantly share code, notes, and snippets.

@brgmn
Created February 24, 2015 09:10
Show Gist options
  • Save brgmn/a77f6ffadfd363e0ec5e to your computer and use it in GitHub Desktop.
Save brgmn/a77f6ffadfd363e0ec5e to your computer and use it in GitHub Desktop.
Fake a low MySQL wait_timeout setting and force a exception
public function testCommand() {
$site = $this->siteRepository->findAll()->getFirst();
/** @var Connection $connection */
$connection = $this->entityManager->getConnection();
$connection->exec('SET SESSION wait_timeout=1;');
$this->outputLine('Set wait_timeout for mysql session to one second and wait two seconds now');
sleep(2);
$domain = new Domain();
$domain->setSite($site);
$domain->setHostPattern('katze2.de');
$this->domainRepository->add($domain);
$this->persistenceManager->persistAll();
$this->outputLine('Persistet.');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment