Пример #1
0
    /**
     * 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];
    }
 /**
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage The "$fields_hash" variable can't be empty.
  */
 public function testTouchPathWithoutFields()
 {
     $this->repositoryFiller->touchPath('/path/', 100, array());
 }