<?php

class ModelBaseTest extends PHPUnit_Framework_TestCase
{
	public function testModelCreation()
	{
		list($server, $mysqlConfig) = require("test/config.php");
		$dbh = new PDO($mysqlConfig[4][0], $mysqlConfig[1], $mysqlConfig[2]);
		$dbh->exec("DROP DATABASE ".$mysqlConfig[4][1]);
		$dbh->exec("CREATE DATABASE ".$mysqlConfig[4][1]);
		\Entity\ModelBase::init($mysqlConfig);
		$context = new \Tools\Context($server, false);
		\Entity\ModelBase::setup();
	}

	public function testInstallFailure()
	{
		list($server, $mysqlConfig) = require("test/config.php");
		$dbh = new PDO($mysqlConfig[4][0], $mysqlConfig[1], $mysqlConfig[2]);
		$dbh->exec("DROP DATABASE ".$mysqlConfig[4][1]);
		\Entity\ModelBase::init($mysqlConfig);
		$context = new \Tools\Context($server, false);
		$this->assertFalse(\Entity\ModelBase::setup());
	}

	public function testSelects()
	{
		//TODO
	}
}

