DbalConnectionKernelTest.php in Dbal connection 8
File
tests/src/Kernel/DbalConnectionKernelTest.php
View source
<?php
namespace Drupal\Tests\dbal\Kernel;
use Drupal\KernelTests\KernelTestBase;
class DbalConnectionKernelTest extends KernelTestBase {
public static $modules = [
'system',
'dbal',
];
public function setUp() {
parent::setUp();
$this->container
->get('lock.persistent')
->acquire('dbal_test');
$this->container
->get('lock.persistent')
->release('dbal_test');
}
public function testConnectionFactory() {
$database = $this->container
->get('database');
$connection = $this->container
->get('dbal_connection');
$connection
->insert($database
->getFullQualifiedTableName('semaphore'), [
'name' => 'dbal_test',
'value' => 'dbal_test',
'expire' => time(),
]);
$this
->assertEquals('dbal_test', $database
->select('semaphore', 's')
->condition('name', 'dbal_test')
->fields('s', [
'value',
])
->execute()
->fetchField());
}
}