public function testMovePathsIntoProject() { $path_id = $this->repositoryFiller->addPath('/path1/', '', '', 100); $this->repositoryFiller->addPath('/path2/', '', '', 100); $this->assertTableContent('Paths', array(array('Id' => '1', 'Path' => '/path1/', 'PathNestingLevel' => '1', 'PathHash' => '3304870543', 'RefName' => '', 'ProjectPath' => '', 'RevisionAdded' => '100', 'RevisionDeleted' => null, 'RevisionLastSeen' => '100'), array('Id' => '2', 'Path' => '/path2/', 'PathNestingLevel' => '1', 'PathHash' => '4023451980', 'RefName' => '', 'ProjectPath' => '', 'RevisionAdded' => '100', 'RevisionDeleted' => null, 'RevisionLastSeen' => '100'))); $this->repositoryFiller->movePathsIntoProject(array($path_id), '/project/'); $this->assertTableContent('Paths', array(array('Id' => '1', 'Path' => '/path1/', 'PathNestingLevel' => '1', 'PathHash' => '3304870543', 'RefName' => '', 'ProjectPath' => '/project/', 'RevisionAdded' => '100', 'RevisionDeleted' => null, 'RevisionLastSeen' => '100'), array('Id' => '2', 'Path' => '/path2/', 'PathNestingLevel' => '1', 'PathHash' => '4023451980', 'RefName' => '', 'ProjectPath' => '', 'RevisionAdded' => '100', 'RevisionDeleted' => null, 'RevisionLastSeen' => '100'))); }
/** * 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]; }