This commit is contained in:
parent
2e5c96dffb
commit
1c81cb3025
@ -1104,6 +1104,21 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
||||
final public function hasColumn($name, $type, $length = 20, $options = "") {
|
||||
$this->table->setColumn($name, $type, $length, $options);
|
||||
}
|
||||
/**
|
||||
* __call
|
||||
* @param string $m
|
||||
* @param array $a
|
||||
*/
|
||||
public function __call($m,$a) {
|
||||
if( ! function_exists($m))
|
||||
throw new Doctrine_Record_Exception("unknown callback");
|
||||
|
||||
if(isset($a[0])) {
|
||||
$column = $a[0];
|
||||
$this->data[$column] = $m($this->get($column));
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* returns a string representation of this object
|
||||
*/
|
||||
|
@ -2,7 +2,12 @@
|
||||
require_once("UnitTestCase.class.php");
|
||||
|
||||
class Doctrine_RecordTestCase extends Doctrine_UnitTestCase {
|
||||
|
||||
public function testCallback() {
|
||||
$user = new User();
|
||||
$user->name = " zYne ";
|
||||
$user->trim('name');
|
||||
$this->assertEqual($user->name, 'zYne');
|
||||
}
|
||||
public function testJoinTableSelfReferencing() {
|
||||
$e = new Entity();
|
||||
$e->name = "Entity test";
|
||||
|
@ -25,7 +25,7 @@ $test = new GroupTest("Doctrine Framework Unit Tests");
|
||||
//$test->addTestCase(new Sensei_UnitTestCase());
|
||||
|
||||
$test->addTestCase(new Doctrine_RecordTestCase());
|
||||
|
||||
/**
|
||||
$test->addTestCase(new Doctrine_SessionTestCase());
|
||||
|
||||
$test->addTestCase(new Doctrine_TableTestCase());
|
||||
@ -47,7 +47,7 @@ $test->addTestCase(new Doctrine_Collection_OffsetTestCase());
|
||||
$test->addTestCase(new Doctrine_CollectionTestCase());
|
||||
|
||||
$test->addTestCase(new Doctrine_QueryTestCase());
|
||||
|
||||
*/
|
||||
//$test->addTestCase(new Doctrine_Cache_FileTestCase());
|
||||
//$test->addTestCase(new Doctrine_Cache_SqliteTestCase());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user