StubConnection.php in Drupal 9
File
core/tests/Drupal/Tests/Core/Database/Stub/StubConnection.php
View source
<?php
namespace Drupal\Tests\Core\Database\Stub;
use Drupal\Core\Database\Connection;
use Drupal\Core\Database\Log;
use Drupal\Core\Database\StatementWrapper;
class StubConnection extends Connection {
protected $statementClass = NULL;
protected $statementWrapperClass = StatementWrapper::class;
public $driver = 'stub';
public function __construct(\PDO $connection, array $connection_options, $identifier_quotes = [
'',
'',
], $statement_class = NULL) {
$this->identifierQuotes = $identifier_quotes;
if ($statement_class) {
$this->statementClass = $statement_class;
$this->statementWrapperClass = NULL;
}
parent::__construct($connection, $connection_options);
}
public function queryRange($query, $from, $count, array $args = [], array $options = []) {
return NULL;
}
public function queryTemporary($query, array $args = [], array $options = []) {
@trigger_error('Connection::queryTemporary() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. There is no replacement. See https://www.drupal.org/node/3211781', E_USER_DEPRECATED);
return '';
}
public function driver() {
return $this->driver;
}
public function databaseType() {
return 'stub';
}
public function createDatabase($database) {
}
public function mapConditionOperator($operator) {
return NULL;
}
public function nextId($existing_id = 0) {
return 0;
}
public function testLogCaller() {
return (new Log())
->findCaller();
}
}
Classes
Name |
Description |
StubConnection |
A stub of the abstract Connection class for testing purposes. |