destructr/tests/HarnessDriver.php

70 lines
1.6 KiB
PHP
Raw Permalink Normal View History

2018-08-17 17:32:10 +00:00
<?php
/* Destructr | https://github.com/jobyone/destructr | MIT License */
2018-08-17 22:32:26 +00:00
namespace Destructr;
2018-08-17 17:32:10 +00:00
class HarnessDriver extends Drivers\AbstractDriver
2018-08-17 17:32:10 +00:00
{
const EXTENSIBLE_VIRTUAL_COLUMNS = true;
public $last_select;
public $last_insert;
public $last_update;
public $last_delete;
2019-03-13 16:04:00 +00:00
public function __construct(string $dsn=null, string $username=null, string $password=null, array $options=null)
2018-08-17 17:32:10 +00:00
{
}
public function pdo(\PDO $pdo=null) : ?\PDO {
2019-03-13 16:04:00 +00:00
return null;
}
public function prepareEnvironment(string $table, array $schema) : bool
2018-08-17 17:32:10 +00:00
{
//TODO: add tests for this too
return false;
}
public function select(string $table, Search $search, array $params) : array
{
$this->last_select = [
'table' => $table,
'search' => $search,
'params' => $params
];
return [];
}
public function insert(string $table, DSOInterface $dso) : bool
{
$this->dsn = 'inserting';
$this->last_insert = [
'table' => $table,
'dso' => $dso
];
return true;
}
public function update(string $table, DSOInterface $dso) : bool
{
$this->last_update = [
'table' => $table,
'dso' => $dso
];
return true;
}
public function delete(string $table, DSOInterface $dso) : bool
{
$this->last_delete = [
'table' => $table,
'dso' => $dso
];
return true;
}
public function errorInfo()
{
return [];
}
}