public function testJoinLoading()
{
$a = ['user' => [1 => ['id' => 1, 'name' => 'John', 'contact_id' => 1], 2 => ['id' => 2, 'name' => 'Peter', 'contact_id' => 1], 3 => ['id' => 3, 'name' => 'Joe', 'contact_id' => 2]], 'contact' => [1 => ['id' => 1, 'contact_phone' => '+123'], 2 => ['id' => 2, 'contact_phone' => '+321']]];
$this->setDB($a);
$db = new Persistence_SQL($this->db->connection);
$m_u = new Model($db, 'user');
$m_u->addField('name');
$j = $m_u->join('contact');
$j->addField('contact_phone');
$m_u->load(1);
$this->assertEquals(['name' => 'John', 'contact_id' => 1, 'contact_phone' => '+123', 'id' => 1], $m_u->get());
$m_u->load(3);
$this->assertEquals(['name' => 'Joe', 'contact_id' => 2, 'contact_phone' => '+321', 'id' => 3], $m_u->get());
$m_u->tryLoad(4);
$this->assertEquals(['name' => null, 'contact_id' => null, 'contact_phone' => null, 'id' => null], $m_u->get());
}