<?php /** @package SQLSolution_Test */
/**
* The base class for tests that check the SQLSolution_General class
*
* @package SQLSolution_Test
* @author Daniel Convissor <hide@address.com>
* @copyright The Analysis and Solutions Company, 2001-2011
* @license http://www.analysisandsolutions.com/software/license.htm Simple Public License
* @link http://www.analysisandsolutions.com/software/sql/sql.htm
*/
abstract class SQLSolution_Test_General extends PHPUnit_Extensions_OutputTestCase {
/**
* The SQL Solution class being tested
* @var object
*/
protected $sql;
/**
* PHPUnit's method for setting needed properties, etc, before each test
*/
protected function setUp() {
$this->sql = new SQLSolution_MySQLiUser;
if (empty($this->sql->SQLDbName)) {
die("ERROR: The test suite requires a database connection.\n"
. "Set connection info in " . get_class($this->sql) . ".\n"
. "See README.markdown for more information.\n\n");
}
$this->sql->SQLQueryString = 'CREATE TABLE sqlsolution (first INTEGER, second INTEGER)';
$this->sql->RunQuery(__FILE__, __LINE__);
$this->sql->SQLQueryString = 'INSERT INTO sqlsolution (first, second) VALUES (11, 111)';
$this->sql->RunQuery(__FILE__, __LINE__);
$this->sql->SQLQueryString = 'INSERT INTO sqlsolution (first, second) VALUES (22, 222)';
$this->sql->RunQuery(__FILE__, __LINE__);
$this->sql->SQLQueryString = 'INSERT INTO sqlsolution (first, second) VALUES (33, 333)';
$this->sql->RunQuery(__FILE__, __LINE__);
}
/**
* PHPUnit's method for unsetting needed properties, etc, after each test
*/
protected function tearDown() {
$this->sql->ReleaseRecordSet(__FILE__, __LINE__);
$this->sql->SQLQueryString = 'DROP TABLE sqlsolution';
$this->sql->RunQuery(__FILE__, __LINE__);
$this->sql->Disconnect(__FILE__, __LINE__);
$this->sql = null;
}
}