Connection.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace Drupal\Driver\Database\fake;
  3. use Drupal\Core\Database\Connection as CoreConnection;
  4. use Drupal\Core\Database\StatementEmpty;
  5. /**
  6. * A fake Connection class for testing purposes.
  7. */
  8. class Connection extends CoreConnection {
  9. /**
  10. * Public property so we can test driver loading mechanism.
  11. *
  12. * @var string
  13. * @see driver().
  14. */
  15. public $driver = 'fake';
  16. /**
  17. * {@inheritdoc}
  18. */
  19. public function queryRange($query, $from, $count, array $args = [], array $options = []) {
  20. return new StatementEmpty();
  21. }
  22. /**
  23. * {@inheritdoc}
  24. */
  25. public function queryTemporary($query, array $args = [], array $options = []) {
  26. return '';
  27. }
  28. /**
  29. * {@inheritdoc}
  30. */
  31. public function driver() {
  32. return $this->driver;
  33. }
  34. /**
  35. * {@inheritdoc}
  36. */
  37. public function databaseType() {
  38. return 'fake';
  39. }
  40. /**
  41. * {@inheritdoc}
  42. */
  43. public function createDatabase($database) {
  44. return;
  45. }
  46. /**
  47. * {@inheritdoc}
  48. */
  49. public function mapConditionOperator($operator) {
  50. return NULL;
  51. }
  52. /**
  53. * {@inheritdoc}
  54. */
  55. public function nextId($existing_id = 0) {
  56. return 0;
  57. }
  58. }