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

testHasManyForeignKey() public method

    public function testHasManyForeignKey()
    {
        $config = array('from' => $this->_gallery, 'to' => $this->_image, 'type' => 'hasMany', 'fieldName' => 'images');
        $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('id' => 'gallery_id')));
        $this->assertEqual($expected, $relation->foreignKey(array('id' => 5)));
    }