/** * 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); Helper::createDirectory(TESTS_REPO_PATH_1); Helper::initEmptyGitRepository(TESTS_REPO_PATH_1); for ($i = 0; $i < 5; $i++) { $file = sprintf('file_%d.txt', $i); $path = TESTS_REPO_PATH_1 . '/' . $file; file_put_contents($path, sprintf('File %d', $i)); Helper::executeGit(TESTS_REPO_PATH_1, sprintf('add %s', escapeshellarg($file))); } Helper::executeGit(TESTS_REPO_PATH_1, sprintf('commit --message=%s', escapeshellarg('Initial commit'))); clearstatcache(); }
/** * 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::initEmptyGitRepository($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::executeGit($repository, sprintf('add %s', escapeshellarg($file))); } Helper::executeGit($repository, sprintf('commit --message=%s', escapeshellarg('Initial commit'))); } clearstatcache(); $binary = new Binary(GIT_BINARY); StreamWrapper::register('git', $binary); StreamWrapper::getRepositoryRegistry()->addRepositories(array('repo1' => Repository::open(TESTS_REPO_PATH_1, $binary, false), 'repo2' => Repository::open(TESTS_REPO_PATH_2, $binary, false))); }
/** * 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); Helper::createDirectory(TESTS_REPO_PATH_1); Helper::initEmptyGitRepository(TESTS_REPO_PATH_1); $path = TESTS_REPO_PATH_1 . '/test.txt'; file_put_contents($path, 'File 1'); Helper::executeGit(TESTS_REPO_PATH_1, sprintf('add %s', escapeshellarg($path))); Helper::executeGit(TESTS_REPO_PATH_1, sprintf('commit --message=%s', escapeshellarg('Commit 1'))); $path = TESTS_REPO_PATH_1 . '/directory'; Helper::createDirectory($path); file_put_contents($path . '/test.txt', 'Directory File 1'); Helper::executeGit(TESTS_REPO_PATH_1, sprintf('add %s', escapeshellarg($path))); Helper::executeGit(TESTS_REPO_PATH_1, sprintf('commit --message=%s', escapeshellarg('Commit 2'))); $path = TESTS_REPO_PATH_1 . '/test.txt'; file_put_contents($path, 'File 1 New'); Helper::executeGit(TESTS_REPO_PATH_1, sprintf('add %s', escapeshellarg($path))); Helper::executeGit(TESTS_REPO_PATH_1, sprintf('commit --message=%s', escapeshellarg('Commit 3'))); clearstatcache(); StreamWrapper::register('git', new Binary(GIT_BINARY)); }
/** * 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); Helper::createDirectory(TESTS_REPO_PATH_1); Helper::initEmptyGitRepository(TESTS_REPO_PATH_1); for ($i = 0; $i < 5; $i++) { $file = sprintf('file_%d.txt', $i); $path = TESTS_REPO_PATH_1 . '/' . $file; file_put_contents($path, sprintf('File %d', $i)); Helper::executeGit(TESTS_REPO_PATH_1, sprintf('add %s', escapeshellarg($file))); } for ($i = 0; $i < 5; $i++) { $dir = sprintf('dir_%d', $i); $path = TESTS_REPO_PATH_1 . '/' . $dir; Helper::createDirectory($path); file_put_contents($path . '/file.txt', sprintf('Directory %d File', $i)); Helper::executeGit(TESTS_REPO_PATH_1, sprintf('add %s', escapeshellarg($path))); } Helper::executeGit(TESTS_REPO_PATH_1, sprintf('commit --message=%s', escapeshellarg('Initial commit'))); clearstatcache(); StreamWrapper::register('git', new Binary(GIT_BINARY)); }