public function sqlite(UnitTester $I)
{
$I->wantToTest("Model validation by using SQLite as RDBMS");
/** @var \Phalcon\Di\FactoryDefault $di */
$di = Di::getDefault();
$connection = $di->getShared('db');
$di->remove('db');
$di->setShared('db', function () {
$connection = new Sqlite(['dbname' => TEST_DB_SQLITE_NAME]);
/** @var \PDO $pdo */
$pdo = $connection->getInternalHandler();
$pdo->sqliteCreateFunction('now', function () {
return date('Y-m-d H:i:s');
});
return $connection;
});
Di::setDefault($di);
$this->success($I);
$this->presenceOf($I);
$this->email($I);
$this->emailWithDot($I);
$this->exclusionIn($I);
$this->inclusionIn($I);
$this->uniqueness1($I);
$this->uniqueness2($I);
$this->regex($I);
$this->tooLong($I);
$this->tooShort($I);
$di->remove('db');
$di->setShared('db', $connection);
}