public function test_many_many_one_side() { $model = $this->model->create($this->get_fixture("user1")); $props = new ExampleOneWayProperty(); $prop1 = $props->create(array("name" => "Property 1")); $prop2 = $props->create(array("name" => "Property 2")); $prop3 = $props->create(array("name" => "Property 3")); $model->oneWayProperties = $prop1; $model->oneWayProperties = $prop2; $model->oneWayProperties = $prop3; $prop2->delete(); $counter = 0; foreach ($model->oneWayProperties as $property) { $counter++; } $this->assertEqual($counter, 2); $this->assertEqual($model->oneWayProperties->count(), 2); $rand_sql = new WaxModel(); $rand_sql->query('delete from example_one_way_property where name = "Property 3"'); $counter = 0; foreach ($model->oneWayProperties as $property) { $counter++; } $this->assertEqual($counter, 1); $this->assertEqual($model->oneWayProperties->count(), 1); }