コード例 #1
0
 function test_count_related()
 {
     $e1 = EE_Event::new_instance(array('EVT_name' => '1'));
     $e1->save();
     $this->assertNotEquals($e1->ID(), 0);
     $e2 = EE_Event::new_instance(array('EVT_name' => '2'));
     $e2->save();
     $this->assertNotEquals($e2->ID(), 0);
     $e3 = EE_Event::new_instance(array('EVT_name' => '3'));
     $e3->save();
     $v = EE_Venue::new_instance(array('VNU_name' => 'v1'));
     $v->save();
     $v->_add_relation_to($e1, 'Event');
     $v->_add_relation_to($e2, 'Event');
     $this->assertEquals($v->count_related('Event'), 2);
 }
 /**
  * used by factory to create venue object
  *
  * @since 4.3.0
  *
  * @param array $args Incoming field values to set on the new object
  *
  * @return EE_Venue|false
  */
 public function create_object($args)
 {
     $venue = EE_Venue::new_instance($args);
     $venID = $venue->save();
     return $venID ? $venue : false;
 }