示例#1
0
 public function testCopyObjectProperties()
 {
     // prefilled object
     $from_object_a = new stdClass();
     $from_object_a->attribute_string = 'value_of_attr_a';
     $from_object_a->attribute_int = 9;
     $from_object_a->attribute_bool = true;
     $from_object_a->attribute_array = array('key' => 'value');
     // empty target object
     $to_object_b = new stdClass();
     $this->form->copyObjectProperties($from_object_a, $to_object_b);
     $this->assertIdentical($from_object_a, $to_object_b);
     $this->assertTrue($to_object_b->attribute_string, 'value_of_attr_a');
     $this->assertTrue($to_object_b->attribute_int, 9);
     $this->assertTrue($to_object_b->attribute_bool, true);
     $this->assertTrue($to_object_b->attribute_array['key'], 'value');
 }