Introduce test optimization

- Add static connection for whole tests
- Introduce ExtendedPDO class to enable nested transactions
- Add rollback logic for tests to ensure reliability and increase speed
This commit is contained in:
Philipp Holzer 2019-07-27 14:37:24 +02:00
parent 07aaf292ec
commit 37d03bbeae
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
5 changed files with 246 additions and 50 deletions

View file

@ -21,29 +21,29 @@ use Psr\Log\LoggerInterface;
*/
class Database
{
private $connected = false;
protected $connected = false;
/**
* @var ConfigCache
*/
private $configCache;
protected $configCache;
/**
* @var Profiler
*/
private $profiler;
protected $profiler;
/**
* @var LoggerInterface
*/
private $logger;
private $server_info = '';
protected $logger;
protected $server_info = '';
/** @var PDO|mysqli */
private $connection;
private $driver;
protected $connection;
protected $driver;
private $error = false;
private $errorno = 0;
private $affected_rows = 0;
private $in_transaction = false;
private $in_retrial = false;
protected $in_transaction = false;
protected $in_retrial = false;
private $relation = [];
public function __construct(ConfigCache $configCache, Profiler $profiler, LoggerInterface $logger, array $server = [])
@ -1070,7 +1070,7 @@ class Database
return true;
}
private function performCommit()
protected function performCommit()
{
switch ($this->driver) {
case 'pdo':