This commit is contained in:
parent
7488435668
commit
ad21df553d
@ -30,46 +30,17 @@
|
|||||||
* @since 1.0
|
* @since 1.0
|
||||||
* @version $Revision$
|
* @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 {
|
class Doctrine_EventListener_TestCase extends Doctrine_UnitTestCase {
|
||||||
private $logger;
|
private $logger;
|
||||||
|
|
||||||
|
|
||||||
|
public function prepareData()
|
||||||
|
{ }
|
||||||
|
public function prepareTables() {
|
||||||
|
$this->tables = array('EventListenerTest');
|
||||||
|
parent::prepareTables();
|
||||||
|
}
|
||||||
|
|
||||||
public function testSetListener() {
|
public function testSetListener() {
|
||||||
$this->logger = new Doctrine_EventListener_TestLogger();
|
$this->logger = new Doctrine_EventListener_TestLogger();
|
||||||
|
|
||||||
@ -82,6 +53,7 @@ class Doctrine_EventListener_TestCase extends Doctrine_UnitTestCase {
|
|||||||
|
|
||||||
$this->assertEqual($e->getTable()->getListener(), $this->logger);
|
$this->assertEqual($e->getTable()->getListener(), $this->logger);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
public function testOnLoad() {
|
public function testOnLoad() {
|
||||||
$this->logger->clear();
|
$this->logger->clear();
|
||||||
$this->assertEqual($this->connection->getTable('EventListenerTest')->getListener(), $this->logger);
|
$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());
|
$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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ class Doctrine_UnitTestCase extends UnitTestCase
|
|||||||
|
|
||||||
} catch(Doctrine_Manager_Exception $e) {
|
} catch(Doctrine_Manager_Exception $e) {
|
||||||
if($this->driverName == 'main') {
|
if($this->driverName == 'main') {
|
||||||
$this->dbh = array('sqlite::memory:');
|
$this->dbh = new PDO('sqlite::memory:');
|
||||||
} else {
|
} else {
|
||||||
$this->dbh = $this->adapter = new Doctrine_Adapter_Mock($this->driverName);
|
$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';
|
$users[7]->Phonenumber[0]->phonenumber = '111 567 333';
|
||||||
|
|
||||||
$this->users = $users;
|
$this->users = $users;
|
||||||
$this->connection->flush();
|
$this->users->save();
|
||||||
}
|
}
|
||||||
public function getConnection()
|
public function getConnection()
|
||||||
{
|
{
|
||||||
|
@ -72,7 +72,7 @@ $test = new GroupTest('Doctrine Framework Unit Tests');
|
|||||||
|
|
||||||
$test->addTestCase(new Doctrine_Ticket330_TestCase());
|
$test->addTestCase(new Doctrine_Ticket330_TestCase());
|
||||||
*/
|
*/
|
||||||
/** */
|
/**
|
||||||
// Connection drivers (not yet fully tested)
|
// Connection drivers (not yet fully tested)
|
||||||
$test->addTestCase(new Doctrine_Connection_Pgsql_TestCase());
|
$test->addTestCase(new Doctrine_Connection_Pgsql_TestCase());
|
||||||
$test->addTestCase(new Doctrine_Connection_Oracle_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());
|
$test->addTestCase(new Doctrine_Expression_Sqlite_TestCase());
|
||||||
|
|
||||||
// Core
|
// Core
|
||||||
|
*/
|
||||||
$test->addTestCase(new Doctrine_Access_TestCase());
|
$test->addTestCase(new Doctrine_Access_TestCase());
|
||||||
//$test->addTestCase(new Doctrine_Configurable_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_Subquery_TestCase());
|
||||||
|
|
||||||
|
$test->addTestCase(new Doctrine_Query_Driver_TestCase());
|
||||||
|
|
||||||
|
$test->addTestCase(new Doctrine_Record_Hook_TestCase());
|
||||||
|
|
||||||
$test->addTestCase(new Doctrine_Query_AggregateValue_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_MultipleAggregateValue_TestCase());
|
||||||
|
|
||||||
$test->addTestCase(new Doctrine_Query_TestCase());
|
$test->addTestCase(new Doctrine_Query_TestCase());
|
||||||
/**
|
/** */
|
||||||
//$test->addTestCase(new Doctrine_IntegrityAction_TestCase());
|
//$test->addTestCase(new Doctrine_IntegrityAction_TestCase());
|
||||||
*/
|
|
||||||
//$test->addTestCase(new Doctrine_AuditLog_TestCase());
|
//$test->addTestCase(new Doctrine_AuditLog_TestCase());
|
||||||
|
|
||||||
// Cache tests
|
// Cache tests
|
||||||
|
Loading…
Reference in New Issue
Block a user