/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. */ protected function setUp() { Helper::removeDirectory(TESTS_TMP_PATH); Helper::createDirectory(TESTS_TMP_PATH); $repositories = array(TESTS_REPO_PATH_1, TESTS_REPO_PATH_2, TESTS_REPO_PATH_3); foreach ($repositories as $n => $repository) { Helper::createDirectory($repository); Helper::initEmptySvnRepository($repository); for ($i = 0; $i < 5; $i++) { $file = sprintf('file_%d.txt', $i); $path = $repository . '/' . $file; file_put_contents($path, sprintf('Repository %d - File %d', $n + 1, $i + 1)); Helper::executeSvn($repository, sprintf('add %s', escapeshellarg($file))); } Helper::executeSvn($repository, sprintf('commit --message=%s', escapeshellarg('Initial commit'))); } clearstatcache(); $binary = new Binary(SVN_BINARY); StreamWrapper::register('svn', $binary); StreamWrapper::getRepositoryRegistry()->addRepositories(array('repo1' => Repository::open(TESTS_REPO_PATH_1, $binary), 'repo2' => Repository::open(TESTS_REPO_PATH_2, $binary))); }
/** * * @return Repository */ protected function getRepository() { return Repository::open(TESTS_REPO_PATH_1, new Binary(SVN_BINARY)); }
/** * @param string $path * @return Repository */ protected function getRepository($path) { return Repository::open($path, new Binary(SVN_BINARY)); }
/** * Creates a new Repository instance for the given path * * @param string $path The path * @return RepositoryInterface */ protected function createRepositoryForPath($path) { return Repository::open($path, $this->svn); }