lithium\tests\cases\data\model\RelationshipTest::testBelongsToForeignKey PHP Method

testBelongsToForeignKey() public method

    public function testBelongsToForeignKey()
    {
        $config = array('from' => $this->_image, 'to' => $this->_gallery, 'type' => 'belongsTo', 'fieldName' => 'gallery');
        $relation = new Relationship($config + array('key' => 'gallery_id'));
        $expected = array('gallery_id' => 5);
        $this->assertEqual($expected, $relation->foreignKey(array('id' => 5)));
        $relation = new Relationship($config + array('key' => array('gallery_id' => 'id')));
        $this->assertEqual($expected, $relation->foreignKey(array('id' => 5)));
    }