Commit 1c81cb30 authored by doctrine's avatar doctrine

--no commit message

--no commit message
parent 2e5c96df
......@@ -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());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment