Platformsh\Cli\Tests\GitHelperTest::setUp PHP Method

setUp() public method

public setUp ( )
    public function setUp()
    {
        $this->tempDirSetUp();
        $repository = $this->getRepositoryDir();
        if (!is_dir($repository) && !mkdir($repository, 0755, true)) {
            throw new \Exception("Failed to create directories.");
        }
        $this->gitHelper = new GitHelper();
        $this->gitHelper->init($repository, true);
        $this->gitHelper->setDefaultRepositoryDir($repository);
        chdir($repository);
        // Ensure we are on the master branch.
        $this->gitHelper->checkOut('master');
        // Add required Git config before committing.
        shell_exec('git config user.email [email protected]');
        shell_exec('git config user.name "Test"');
        shell_exec('git config commit.gpgsign false');
        // Make a dummy commit so that there is a HEAD.
        touch($repository . '/README.txt');
        shell_exec('git add -A && git commit -qm "Initial commit"');
    }