Added tests (84,19% of coverance) to release first stable ASAP
[activemongo.git] / tests / Models.php
blob1464f789caa7b40b222c599f2788a0523445acab
1 <?php
3 class Dummy extends ActiveMongo
7 class Model1 extends ActiveMongo
9 public $a;
10 public $b;
12 static $validates_presence_of = array(
13 'a'
16 function setup()
18 $this->addIndex(array('a' => 1));
23 class Model2 extends ActiveMongo
25 public $M1;
26 public $a;
28 static $validates_presence_of = array(
29 'M1',
32 function M1_filter($obj)
34 if (!$obj InstanceOf MongoID) {
35 throw new ActiveMongo_FilterException("Invalid M1 value");
39 function update_refs($m1)
41 /* reset just in case */
42 $this->reset();
43 $this->where('M1', $m1['_id']);
44 $this->Update(array('a' => $m1['a']));
49 class Model3 extends ActiveMongo
51 public $int;
52 public $str;
54 static $validates_presence_of = array(
55 'int'