atk4\data\tests\JoinSQLTest::testJoinSaving3 PHP Method

testJoinSaving3() public method

public testJoinSaving3 ( )
    public function testJoinSaving3()
    {
        $a = ['user' => ['_' => ['id' => 1, 'name' => 'John', 'test_id' => 0]], 'contact' => ['_' => ['id' => 1, 'contact_phone' => '+123']]];
        $db = new Persistence_SQL($this->db->connection);
        $m_u = new Model($db, 'user');
        $this->setDB($a);
        $m_u->addField('name');
        $j = $m_u->join('contact', 'test_id');
        $j->addField('contact_phone');
        $m_u['name'] = 'John';
        $m_u['contact_phone'] = '+123';
        $m_u->save();
        $this->assertEquals(['user' => [1 => ['id' => 1, 'test_id' => 1, 'name' => 'John']], 'contact' => [1 => ['id' => 1, 'contact_phone' => '+123']]], $this->getDB('user,contact'));
    }