1
0
mirror of synced 2024-12-13 14:56:01 +03:00

formatting fix

This commit is contained in:
zYne 2007-06-25 19:07:14 +00:00
parent 1273563b31
commit d58b96041e

View File

@ -30,13 +30,17 @@
* @since 1.0 * @since 1.0
* @version $Revision$ * @version $Revision$
*/ */
class Doctrine_Table_TestCase extends Doctrine_UnitTestCase { class Doctrine_Table_TestCase extends Doctrine_UnitTestCase
public function prepareTables() { {
$this->tables[] = "FieldNameTest";
public function prepareTables()
{
$this->tables[] = 'FieldNameTest';
parent::prepareTables(); parent::prepareTables();
} }
public function testFieldConversion() { public function testFieldConversion()
{
$this->dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_UPPER); $this->dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_UPPER);
$t = new FieldNameTest(); $t = new FieldNameTest();
@ -73,7 +77,7 @@ class Doctrine_Table_TestCase extends Doctrine_UnitTestCase {
$this->connection->clear(); $this->connection->clear();
$t = $this->connection->getTable('FieldNameTest')->find(1); $t = $this->connection->getTable('FieldNameTest')->find(1);
$this->assertEqual($t->someColumn, 'abc'); $this->assertEqual($t->someColumn, 'abc');
$this->assertEqual($t->someEnum, 'php'); $this->assertEqual($t->someEnum, 'php');
$this->assertEqual($t->someInt, 1); $this->assertEqual($t->someInt, 1);
@ -83,14 +87,8 @@ class Doctrine_Table_TestCase extends Doctrine_UnitTestCase {
$this->dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL); $this->dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL);
} }
public function testBind() { public function testGetForeignKey()
$table = $this->connection->getTable("User"); {
}
public function testGetIdentifier() {
$table = $this->connection->getTable("User");
}
public function testGetForeignKey() {
$fk = $this->objTable->getRelation("Group"); $fk = $this->objTable->getRelation("Group");
$this->assertTrue($fk instanceof Doctrine_Relation_Association); $this->assertTrue($fk instanceof Doctrine_Relation_Association);
$this->assertTrue($fk->getTable() instanceof Doctrine_Table); $this->assertTrue($fk->getTable() instanceof Doctrine_Table);
@ -115,29 +113,42 @@ class Doctrine_Table_TestCase extends Doctrine_UnitTestCase {
} }
public function testGetComponentName() { public function testGetComponentName()
{
$this->assertTrue($this->objTable->getComponentName() == "User"); $this->assertTrue($this->objTable->getComponentName() == "User");
} }
public function testGetTableName() {
public function testGetTableName()
{
$this->assertTrue($this->objTable->tableName == "entity"); $this->assertTrue($this->objTable->tableName == "entity");
} }
public function testGetConnection() {
public function testGetConnection()
{
$this->assertTrue($this->objTable->getConnection() instanceof Doctrine_Connection); $this->assertTrue($this->objTable->getConnection() instanceof Doctrine_Connection);
} }
public function testGetData() {
public function testGetData()
{
$this->assertTrue($this->objTable->getData() == array()); $this->assertTrue($this->objTable->getData() == array());
} }
public function testSetSequenceName() {
public function testSetSequenceName()
{
$this->objTable->sequenceName = "test-seq"; $this->objTable->sequenceName = "test-seq";
$this->assertEqual($this->objTable->sequenceName, "test-seq"); $this->assertEqual($this->objTable->sequenceName, "test-seq");
$this->objTable->sequenceName = null; $this->objTable->sequenceName = null;
} }
public function testCreate() {
public function testCreate()
{
$record = $this->objTable->create(); $record = $this->objTable->create();
$this->assertTrue($record instanceof Doctrine_Record); $this->assertTrue($record instanceof Doctrine_Record);
$this->assertTrue($record->state() == Doctrine_Record::STATE_TCLEAN); $this->assertTrue($record->state() == Doctrine_Record::STATE_TCLEAN);
} }
public function testFind() {
public function testFind()
{
$record = $this->objTable->find(4); $record = $this->objTable->find(4);
$this->assertTrue($record instanceof Doctrine_Record); $this->assertTrue($record instanceof Doctrine_Record);
@ -169,17 +180,23 @@ class Doctrine_Table_TestCase extends Doctrine_UnitTestCase {
$this->assertTrue(false); $this->assertTrue(false);
} }
} }
public function testFindAll() {
public function testFindAll()
{
$users = $this->objTable->findAll(); $users = $this->objTable->findAll();
$this->assertEqual($users->count(), 8); $this->assertEqual($users->count(), 8);
$this->assertTrue($users instanceof Doctrine_Collection); $this->assertTrue($users instanceof Doctrine_Collection);
} }
public function testFindByDql() {
public function testFindByDql()
{
$users = $this->objTable->findByDql("name LIKE '%Arnold%'"); $users = $this->objTable->findByDql("name LIKE '%Arnold%'");
$this->assertEqual($users->count(), 1); $this->assertEqual($users->count(), 1);
$this->assertTrue($users instanceof Doctrine_Collection); $this->assertTrue($users instanceof Doctrine_Collection);
} }
public function testGetProxy() {
public function testGetProxy()
{
$user = $this->objTable->getProxy(4); $user = $this->objTable->getProxy(4);
$this->assertTrue($user instanceof Doctrine_Record); $this->assertTrue($user instanceof Doctrine_Record);
@ -189,12 +206,16 @@ class Doctrine_Table_TestCase extends Doctrine_UnitTestCase {
$this->assertTrue($e instanceOf Doctrine_Find_Exception); $this->assertTrue($e instanceOf Doctrine_Find_Exception);
} }
} }
public function testGetColumns() {
public function testGetColumns()
{
$columns = $this->objTable->getColumns(); $columns = $this->objTable->getColumns();
$this->assertTrue(is_array($columns)); $this->assertTrue(is_array($columns));
} }
public function testApplyInheritance() {
public function testApplyInheritance()
{
$this->assertEqual($this->objTable->applyInheritance("id = 3"), "id = 3 AND type = ?"); $this->assertEqual($this->objTable->applyInheritance("id = 3"), "id = 3 AND type = ?");
} }