public function testAddCommitToRef()
 {
     $project_id = $this->repositoryFiller->addProject('/project/');
     $ref_id = $this->repositoryFiller->addRefToProject('trunk', $project_id);
     $this->repositoryFiller->addCommit(100, 'user', 123, 'msg');
     $this->repositoryFiller->addCommitToRef(100, $ref_id);
     $this->assertTableContent('CommitRefs', array(array('Revision' => '100', 'RefId' => $ref_id)));
 }
    /**
     * Creates missing path.
     *
     * @param string  $path         Path.
     * @param string  $ref_name     Ref name.
     * @param string  $project_path Project path.
     * @param integer $revision     Revision.
     * @param string  $action       Action.
     *
     * @return integer
     */
    protected function createMissingPath($path, $ref_name, $project_path, $revision, $action)
    {
        if (!isset($this->_pathsMap[$path])) {
            $this->_pathsMap[$path] = $this->_repositoryFiller->addPath($path, $ref_name, $project_path, $revision);
        } else {
            $sql = 'SELECT RevisionAdded, RevisionDeleted, RevisionLastSeen
					FROM Paths
					WHERE Id = :id';
            $touch_path_data = $this->_databaseCache->getFromCache('Paths', $this->_repositoryFiller->getPathChecksum($path) . '/' . __METHOD__, $sql, array('id' => $this->_pathsMap[$path]));
            $touch_fields = $this->_repositoryFiller->getPathTouchFields($action, $revision, $touch_path_data);
            if ($touch_fields) {
                $touched_paths = $this->_repositoryFiller->touchPath($path, $revision, $touch_fields);
                foreach ($touched_paths as $touched_path_hash => $touched_path_fields_hash) {
                    $path_data = $this->_databaseCache->getFromCache('Paths', $touched_path_hash . '/' . __METHOD__);
                    if ($path_data !== false) {
                        $this->_databaseCache->setIntoCache('Paths', $touched_path_hash . '/' . __METHOD__, $touched_path_fields_hash);
                    }
                }
            }
        }
        return $this->_pathsMap[$path];
    }