GitWrapper\Test\GitWorkingCopyTest::setUp PHP Method

setUp() public method

Creates and initializes the local repository used for testing.
public setUp ( )
    public function setUp()
    {
        parent::setUp();
        // Create the local repository.
        $this->wrapper->init(self::REPO_DIR, array('bare' => true));
        // Clone the local repository.
        $directory = 'build/test/wc_init';
        $git = $this->wrapper->clone('file://' . realpath(self::REPO_DIR), $directory);
        $git->config('user.email', self::CONFIG_EMAIL);
        $git->config('user.name', self::CONFIG_NAME);
        // Create the initial structure.
        file_put_contents($directory . '/change.me', "unchanged\n");
        $this->filesystem->touch($directory . '/move.me');
        $this->filesystem->mkdir($directory . '/a.directory', 0755);
        $this->filesystem->touch($directory . '/a.directory/remove.me');
        // Initial commit.
        $git->add('*')->commit('Initial commit.')->push('origin', 'master', array('u' => true));
        // Create a branch, add a file.
        $branch = 'test-branch';
        file_put_contents($directory . '/branch.txt', "{$branch}\n");
        $git->checkoutNewBranch($branch)->add('branch.txt')->commit('Committed testing branch.')->push('origin', $branch, array('u' => true));
        // Create a tag of the branch.
        $git->tag('test-tag')->pushTags();
        $this->filesystem->remove($directory);
    }