public function test_associated_uniqueness() { $Property = new Property(); $PropertyType = new PropertyType(); $this->assertTrue($RanchoMaria =& $Property->create(array('description' => 'Rancho Maria'))); $this->assertTrue($Rancho =& $PropertyType->create(array('description' => 'Rancho'))); $Rancho->property->load(); $this->assertEqual($Rancho->property->count(), 0); $Rancho->property->add($RanchoMaria); $this->assertEqual($Rancho->property->count(), 1); $this->assertTrue($RanchoMaria =& $Property->findFirstBy('description', 'Rancho Maria')); $this->assertTrue($Rancho =& $PropertyType->findFirstBy('description', 'Rancho', array('include' => 'properties'))); $Rancho->property->add($RanchoMaria); $this->assertEqual($Rancho->property->count(), 1); $Rancho->set('description', 'Rancho Type'); $this->assertTrue($Rancho->save()); $this->assertTrue($Rancho =& $PropertyType->findFirstBy('description', 'Rancho Type', array('include' => 'properties'))); $this->assertEqual($Rancho->property->count(), 1); }