1
0
mirror of synced 2024-12-14 15:16:04 +03:00
This commit is contained in:
zYne 2007-06-25 19:25:23 +00:00
parent 7488435668
commit ad21df553d
4 changed files with 59 additions and 56 deletions

View File

@ -30,46 +30,17 @@
* @since 1.0
* @version $Revision$
*/
class EventListenerTest extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn("name", "string", 100);
$this->hasColumn("password", "string", 8);
}
public function setUp() {
//$this->attribute(Doctrine::ATTR_LISTENER, new Doctrine_EventListener_AccessorInvoker());
}
public function getName($name) {
return strtoupper($name);
}
public function setPassword($password) {
return md5($password);
}
}
class Doctrine_EventListener_TestLogger implements Doctrine_Overloadable, Countable {
private $messages = array();
public function __call($m, $a) {
$this->messages[] = $m;
}
public function pop() {
return array_pop($this->messages);
}
public function clear() {
$this->messages = array();
}
public function getAll() {
return $this->messages;
}
public function count() {
return count($this->messages);
}
}
class Doctrine_EventListener_TestCase extends Doctrine_UnitTestCase {
private $logger;
public function prepareData()
{ }
public function prepareTables() {
$this->tables = array('EventListenerTest');
parent::prepareTables();
}
public function testSetListener() {
$this->logger = new Doctrine_EventListener_TestLogger();
@ -82,6 +53,7 @@ class Doctrine_EventListener_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($e->getTable()->getListener(), $this->logger);
}
/**
public function testOnLoad() {
$this->logger->clear();
$this->assertEqual($this->connection->getTable('EventListenerTest')->getListener(), $this->logger);
@ -200,14 +172,41 @@ class Doctrine_EventListener_TestCase extends Doctrine_UnitTestCase {
$this->connection->setListener(new Doctrine_EventListener());
}
public function prepareData() { }
public function prepareTables() {
$this->tables = array('EventListenerTest');
parent::prepareTables();
}
*/
}
?>
class EventListenerTest extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn("name", "string", 100);
$this->hasColumn("password", "string", 8);
}
public function setUp() {
//$this->attribute(Doctrine::ATTR_LISTENER, new Doctrine_EventListener_AccessorInvoker());
}
public function getName($name) {
return strtoupper($name);
}
public function setPassword($password) {
return md5($password);
}
}
class Doctrine_EventListener_TestLogger implements Doctrine_Overloadable, Countable {
private $messages = array();
public function __call($m, $a) {
$this->messages[] = $m;
}
public function pop() {
return array_pop($this->messages);
}
public function clear() {
$this->messages = array();
}
public function getAll() {
return $this->messages;
}
public function count() {
return count($this->messages);
}
}

View File

@ -30,13 +30,13 @@
* @since 1.0
* @version $Revision$
*/
class Doctrine_Table_TestCase extends Doctrine_UnitTestCase
class Doctrine_Table_TestCase extends Doctrine_UnitTestCase
{
public function prepareTables()
{
$this->tables[] = 'FieldNameTest';
parent::prepareTables();
parent::prepareTables();
}
public function testFieldConversion()

View File

@ -130,7 +130,7 @@ class Doctrine_UnitTestCase extends UnitTestCase
} catch(Doctrine_Manager_Exception $e) {
if($this->driverName == 'main') {
$this->dbh = array('sqlite::memory:');
$this->dbh = new PDO('sqlite::memory:');
} else {
$this->dbh = $this->adapter = new Doctrine_Adapter_Mock($this->driverName);
}
@ -243,7 +243,7 @@ class Doctrine_UnitTestCase extends UnitTestCase
$users[7]->Phonenumber[0]->phonenumber = '111 567 333';
$this->users = $users;
$this->connection->flush();
$this->users->save();
}
public function getConnection()
{
@ -278,8 +278,8 @@ class Doctrine_UnitTestCase extends UnitTestCase
if (isset($this->objTable)) {
$this->objTable->clear();
}
$this->init = true;
$this->init = true;
}
}
?>

View File

@ -72,7 +72,7 @@ $test = new GroupTest('Doctrine Framework Unit Tests');
$test->addTestCase(new Doctrine_Ticket330_TestCase());
*/
/** */
/**
// Connection drivers (not yet fully tested)
$test->addTestCase(new Doctrine_Connection_Pgsql_TestCase());
$test->addTestCase(new Doctrine_Connection_Oracle_TestCase());
@ -150,7 +150,7 @@ $test->addTestCase(new Doctrine_Expression_Oracle_TestCase());
$test->addTestCase(new Doctrine_Expression_Sqlite_TestCase());
// Core
*/
$test->addTestCase(new Doctrine_Access_TestCase());
//$test->addTestCase(new Doctrine_Configurable_TestCase());
@ -264,6 +264,10 @@ $test->addTestCase(new Doctrine_Query_Orderby_TestCase());
$test->addTestCase(new Doctrine_Query_Subquery_TestCase());
$test->addTestCase(new Doctrine_Query_Driver_TestCase());
$test->addTestCase(new Doctrine_Record_Hook_TestCase());
$test->addTestCase(new Doctrine_Query_AggregateValue_TestCase());
@ -295,9 +299,9 @@ $test->addTestCase(new Doctrine_Query_JoinCondition_TestCase());
$test->addTestCase(new Doctrine_Query_MultipleAggregateValue_TestCase());
$test->addTestCase(new Doctrine_Query_TestCase());
/**
/** */
//$test->addTestCase(new Doctrine_IntegrityAction_TestCase());
*/
//$test->addTestCase(new Doctrine_AuditLog_TestCase());
// Cache tests