Login   Register  
PHP Classes
elePHPant
Icontem

File: unit_tests/Database/Abstract.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Victor Bolshov  >  Naf Database Tools  >  unit_tests/Database/Abstract.php  >  Download  
File: unit_tests/Database/Abstract.php
Role: Unit test script
Content type: text/plain
Description: Helper class for unit-tests
Class: Naf Database Tools
Store and retrieve objects in databases using PDO
Author: By
Last change: minor change
Date: 7 years ago
Size: 522 bytes
 

Contents

Class file image Download
<?php

abstract class AbstractDbTest extends UnitTestCase {
    
/**
     * @var PDO
     */
    
protected $connection;
    
    function 
__construct()
    {
        
parent::__construct();
        
        
$c = new Naf_UnitTestDbConnection();
        
$this->connection $c->getConnection();
        
Naf_Table::setDefaultConnection($this->connection);
    }
    
    function 
setUp()
    {
        
$this->connection->query("CREATE TABLE test (id INTEGER PRIMARY KEY, name varchar(255))");
    }
    function 
tearDown()
    {
        
$this->connection->query("DROP TABLE test");
    }
}