/**
  * Registers a new O2O_Connection
  * @param string $name
  * @param array $from_object_types Object types that can be connected from
  * @param array $to_object_types Object types that can be connected to
  * @param array $args
  * @return O2O_Connection_Taxonomy 
  */
 public function register($name, $from_object_types, $to_object_types, $args = array())
 {
     if (!($connection = self::get_connection($name))) {
         $args = wp_parse_args($args, array('reciprocal' => false));
         if (!class_exists('O2O_Connection_Taxonomy')) {
             require_once __DIR__ . '/connection-types/taxonomy/taxonomy.php';
         }
         $connection = new O2O_Connection_Taxonomy($name, (array) $from_object_types, (array) $to_object_types, $args);
         $connection->init();
         $this->connections[$name] = $connection;
     }
     return $connection;
 }
 /**
  * @covers ::get_connected_from_objects
  * @depends test_set_connected_to_sets_terms
  */
 public function test_get_connected_from_objects()
 {
     $connection = new O2O_Connection_Taxonomy('test', 'post', 'flat_post_type', array('to' => array('sortable' => true)));
     $post_id = wp_insert_post(array('post_title' => 'test post'));
     $post_id2 = wp_insert_post(array('post_title' => 'test post2'));
     $flat_post_id = wp_insert_post(array('post_title' => 'test flat post', 'post_type' => 'flat_post_type'));
     $connection->set_connected_to($post_id, array($flat_post_id));
     $connection->set_connected_to($post_id2, array($flat_post_id));
     $expected = array($post_id, $post_id2);
     sort($expected);
     $result = $connection->get_connected_from_objects($flat_post_id);
     $this->assertInternalType('array', $result);
     sort($result);
     $this->assertEquals($expected, $result);
 }