Inheritance: extends Model_User
Example #1
0
 public function testHooks()
 {
     $this->markTestSkipped('TODO: reimplement field hooks');
     $p = new Persistence();
     $c = new Model_Client($p);
     $c->getElement('name')->addHook('normalize', function ($o, $f, &$v) {
         $v = trim($v);
     });
     $c->getElement('name')->addHook('get', function ($o, $f, &$v) {
         $v .= '123';
     });
     $c['name'] = '  jo hn ';
     $this->assertEquals(['name' => 'jo hn'], $c->data);
     $this->assertEquals('jo hn123', $c['name']);
 }