Verified Commit 595e1cff authored by Dave Long's avatar Dave Long
Browse files

test: #3250999 Remove all code/tests to database drivers living in the...

test: #3250999 Remove all code/tests to database drivers living in the directory DRUPAL_ROOT/drivers

By: daffie
By: arantxio
By: andypost
By: zeeshan_khan
parent b11f868b
Loading
Loading
Loading
Loading
+0 −17
Original line number Diff line number Diff line
<?php

namespace Drupal\Core\Database\Driver\CoreFake;

use Drupal\Driver\Database\fake\Connection as BaseConnection;

/**
 * A connection for testing database drivers.
 */
class Connection extends BaseConnection {

  /**
   * {@inheritdoc}
   */
  public $driver = 'CoreFake';

}
+0 −19
Original line number Diff line number Diff line
<?php

namespace Drupal\Core\Database\Driver\CoreFake\Install;

use Drupal\Core\Database\Install\Tasks as InstallTasks;

/**
 * The database installer structure for the fake database driver.
 */
class Tasks extends InstallTasks {

  /**
   * {@inheritdoc}
   */
  public function name(): string {
    return 'CoreFake';
  }

}
+0 −10
Original line number Diff line number Diff line
<?php

namespace Drupal\Driver\Database\CoreFake;

use Drupal\Core\Database\Driver\CoreFake\Connection as CoreFakeConnection;

/**
 * A test implementation of \Drupal\Core\Database\Connection.
 */
class Connection extends CoreFakeConnection {}
+0 −12
Original line number Diff line number Diff line
<?php

namespace Drupal\Driver\Database\CoreFake\Install;

use Drupal\Core\Database\Driver\CoreFake\Install\Tasks as BaseInstallTasks;

/**
 * The database installer structure for a custom database driver.
 */
class Tasks extends BaseInstallTasks {

}
+0 −159
Original line number Diff line number Diff line
<?php

namespace Drupal\Driver\Database\fake;

use Drupal\Core\Database\Connection as CoreConnection;
use Drupal\Core\Database\ExceptionHandler;
use Drupal\Core\Database\Query\Condition;
use Drupal\Core\Database\Query\Delete;
use Drupal\Core\Database\Query\Insert;
use Drupal\Core\Database\Query\Merge;
use Drupal\Core\Database\Query\Select;
use Drupal\Core\Database\Query\Truncate;
use Drupal\Core\Database\Query\Update;
use Drupal\Core\Database\Query\Upsert;
use Drupal\Core\Database\StatementWrapper;
use Drupal\Core\Database\Transaction;

/**
 * A fake Connection class for testing purposes.
 */
class Connection extends CoreConnection {

  /**
   * {@inheritdoc}
   */
  protected $statementClass = NULL;

  /**
   * {@inheritdoc}
   */
  protected $statementWrapperClass = StatementWrapper::class;

  /**
   * {@inheritdoc}
   */
  protected $identifierQuotes = ['"', '"'];

  /**
   * Public property so we can test driver loading mechanism.
   *
   * @var string
   * @see driver().
   */
  public $driver = 'fake';

  /**
   * {@inheritdoc}
   */
  public function queryRange($query, $from, $count, array $args = [], array $options = []): NULL {
    return NULL;
  }

  /**
   * {@inheritdoc}
   */
  public function driver() {
    return $this->driver;
  }

  /**
   * {@inheritdoc}
   */
  public function databaseType(): string {
    return 'fake';
  }

  /**
   * {@inheritdoc}
   */
  public function createDatabase($database) {}

  /**
   * {@inheritdoc}
   */
  public function mapConditionOperator($operator): NULL {
    return NULL;
  }

  /**
   * {@inheritdoc}
   */
  public function exceptionHandler(): ExceptionHandler {
    return new ExceptionHandler();
  }

  /**
   * {@inheritdoc}
   */
  public function select($table, $alias = NULL, array $options = []): Select {
    return new Select($this, $table, $alias, $options);
  }

  /**
   * {@inheritdoc}
   */
  public function insert($table, array $options = []): Insert {
    return new Insert($this, $table, $options);
  }

  /**
   * {@inheritdoc}
   */
  public function merge($table, array $options = []): Merge {
    return new Merge($this, $table, $options);
  }

  /**
   * {@inheritdoc}
   */
  public function upsert($table, array $options = []): Upsert {
    return new Upsert($this, $table, $options);
  }

  /**
   * {@inheritdoc}
   */
  public function update($table, array $options = []): Update {
    return new Update($this, $table, $options);
  }

  /**
   * {@inheritdoc}
   */
  public function delete($table, array $options = []): Delete {
    return new Delete($this, $table, $options);
  }

  /**
   * {@inheritdoc}
   */
  public function truncate($table, array $options = []): Truncate {
    return new Truncate($this, $table, $options);
  }

  /**
   * {@inheritdoc}
   */
  public function schema() {
    if (empty($this->schema)) {
      $this->schema = new Schema($this);
    }
    return $this->schema;
  }

  /**
   * {@inheritdoc}
   */
  public function condition($conjunction): Condition {
    return new Condition($conjunction, FALSE);
  }

  /**
   * {@inheritdoc}
   */
  public function startTransaction($name = ''): Transaction {
    return new Transaction($this, $name);
  }

}
Loading