/** * Test id conversions from user+choicids to graphids */ public function test_setupids() { $ratings = array(); $ratings[1] = new stdClass(); $ratings[1]->userid = 3; $ratings[1]->choiceid = 1; $ratings[1]->rating = 5; $ratings[2] = new stdClass(); $ratings[2]->userid = 3; $ratings[2]->choiceid = 2; $ratings[2]->rating = 3; $ratings[3] = new stdClass(); $ratings[3]->userid = 2; $ratings[3]->choiceid = 1; $ratings[3]->rating = 5; $ratings[4] = new stdClass(); $ratings[4]->userid = 2; $ratings[4]->choiceid = 2; $ratings[4]->rating = 2; $usercount = 2; list($fromuserid, $touserid, $fromchoiceid, $tochoiceid) = solver_edmonds_karp::setup_id_conversions($usercount, $ratings); $this->assertEquals(array(3 => 1, 2 => 2), $fromuserid); $this->assertEquals(array(1 => 3, 2 => 2), $touserid); $this->assertEquals(array(1 => 3, 2 => 4), $fromchoiceid); $this->assertEquals(array(3 => 1, 4 => 2), $tochoiceid); }