PHP Classes
elePHPant
Icontem

File: test/bootstrap.php

Recommend this page to a friend!
  Classes of Victor Bolshov  >  Tiny PHP ORM Framework  >  test/bootstrap.php  >  Download  
File: test/bootstrap.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Tiny PHP ORM Framework
Map objects to databases using composed queries
Author: By
Last change: Heaviliy refactored & improved EntityGenerator; removed custom autoloader; added stored configurations for entity generator
Added phpunit as dev dependency; upgraded to phpunit 6; added phpunit.xml
Date: 1 year ago
Size: 832 bytes
 

Contents

Class file image Download
<?php

include_once __DIR__ . "/../vendor/autoload.php";

/**
 * @return \tinyorm\Db
 */
function get_test_connection() {
    return new \
tinyorm\Db(
       
"mysql:host=localhost;dbname=test;",
       
"root",
       
"",
        [
            \
PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION
       
]
    );
}

$connection = get_test_connection();
$connection->exec("DROP TABLE IF EXISTS test");
$connection->exec("DROP TABLE IF EXISTS test2");
$connection->exec("CREATE TABLE test (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c_varchar varchar(10), c_int int, c_unique varchar(10) unique, INDEX c_int (c_int)) ENGINE INNODB");
$connection->exec("CREATE TABLE test2 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c_varchar varchar(10), c_int int, c_unique varchar(10) unique, INDEX c_int (c_int)) ENGINE INNODB");

unset(
$connection);