lithium\tests\cases\data\source\DatabaseTest::testRelationshipGeneration PHP Method

testRelationshipGeneration() public method

    public function testRelationshipGeneration()
    {
        $comment = 'lithium\\tests\\mocks\\data\\model\\MockDatabaseComment';
        $hasMany = $this->_db->relationship($this->_model, 'hasMany', 'Comments', array('to' => $comment));
        $this->assertEqual(array('id' => 'mock_database_post_id'), $hasMany->key());
        $this->assertEqual('comments', $hasMany->fieldName());
        $belongsTo = $this->_db->relationship($comment, 'belongsTo', 'Posts', array('to' => $this->_model));
        $this->assertEqual(array('post_id' => 'id'), $belongsTo->key());
        $this->assertEqual('post', $belongsTo->fieldName());
    }
DatabaseTest