Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing GitController #159

Open
samuelfrench opened this issue Mar 17, 2014 · 3 comments
Open

Testing GitController #159

samuelfrench opened this issue Mar 17, 2014 · 3 comments

Comments

@samuelfrench
Copy link
Contributor

@cdwainscott Not sure if you're still working right now... but can you send me any unit tests you have so far and any other relevant information I need to run them so I can start testing with PHPUnit instead of just using network monitor.

Thanks.

@samuelfrench
Copy link
Contributor Author

@cdwainscott Also, in response to your text message. You need to edit the gitcommands model, in the model folder. Change line 35 from $this->wrapper = new GitWrapper(); to $this->wrapper = new GitWrapper('C:\Git\bin\git.exe'); (Make sure it's actually in that directory on you're particular computer.) Also, I have not verified this, but I was told that you cannot have any spaces in the file path to the git executable.

@cdwainscott
Copy link

i emailed you my testing files

@samuelfrench
Copy link
Contributor Author

David's tests


<?php

class RoutesTest extends TestCase {

    /**
     * Tests routes for TeamworkEnglewoodGit program
     * @return void
     */

    public function setUp()
    {
        parent::setUp();

        $user = 'testuser';
        $project = 'testRepo';
        //FileSystem::sshKeyGen($user);
        //$fs = new FileSystem($user, $project);
        //mkDir( $fs->getPath(), Config::get('filesystem.permissions.directory'), true);
    }

    public function testBasic()
    {
        $crawler = $this->client->request('GET', '/');

        $this->assertTrue($this->client->getResponse()->isOk());
    }

    public function testLogin()
    {
        $crawler = $this->client->request('GET', 'login');

        $this->assertTrue($this->client->getResponse()->isOk());
    }

    public function testEditor()
    {
        $crawler = $this->client->request('GET', 'user/{user}/project/{project}/editor');

        $this->assertTrue($this->client->getResponse()->isOk());
    }

    public function testProjects($user='testuser')//only works if user is hardcoded in. how do i pass in tests
    {
        $crawler = $this->client->request('GET', 'user/'.$user.'/projects');

        $this->assertTrue($this->client->getResponse()->isOk());
    }

    /* public function testGitClone($user='testuser',$project='testRepo')
    {
        $crawler = $this->client->request('POST', '/user/'.$user.'/project/'.$project.'/git-clone');

        $this->assertTrue($this->client->getResponse()->isOk());
    } */

    public function testGitStatus($user='testuser',$project='testRepo')
    {
        $crawler = $this->client->request('GET', '/user/'.$user.'/project/'.$project.'/git-status');

        $this->assertTrue($this->client->getResponse()->isOk());
    }

    public function testGitRm($user='testuser',$project='testRepo')
    {
        $crawler = $this->client->request('DELETE', '/user/'.$user.'/project/'.$project.'/git-rm');

        $this->assertTrue($this->client->getResponse()->isOk());
    }

    public function testGitAdd($user='testuser',$project='testRepo')
    {
        $crawler = $this->client->request('POST', '/user/'.$user.'/project/'.$project.'/git-add');

        $this->assertTrue($this->client->getResponse()->isOk());
    }

    public function testGitCommit($user='testuser',$project='testRepo')
    {
        $crawler = $this->client->request('POST', '/user/'.$user.'/project/'.$project.'/git-commit');

        $this->assertTrue($this->client->getResponse()->isOk());
    }

    public function testGitPush($user='testuser',$project='testRepo')
    {
        $crawler = $this->client->request('POST', '/user/'.$user.'/project/'.$project.'/git-push');

        $this->assertTrue($this->client->getResponse()->isOk());
    }

    public function testGitPull($user='testuser',$project='testRepo')
    {
        $crawler = $this->client->request('POST', '/user/'.$user.'/project/'.$project.'/git-pull');

        $this->assertTrue($this->client->getResponse()->isOk());
    }

    public function testGitRemoteDelete($user='testuser',$project='testRepo')
    {
        $crawler = $this->client->request('DELETE', '/user/'.$user.'/project/'.$project.'/git-remote');

        $this->assertTrue($this->client->getResponse()->isOk());
    }

    public function testGitAddRemote($user='testuser',$project='testRepo')
    {
        $crawler = $this->client->request('POST', '/user/'.$user.'/project/'.$project.'/git-remote');

        $this->assertTrue($this->client->getResponse()->isOk());
    }    

    public function testGit($user='testuser',$project='testRepo')
    {
        $crawler = $this->client->request('POST', '/user/'.$user.'/project/'.$project.'/git');

        $this->assertTrue($this->client->getResponse()->isOk());
    } 

    public function testMkdirPost($user='testuser',$project='testRepo')//fail!!!
    {
        $crawler = $this->client->request('POST', '/user/'.$user.'/project/'.$project.'/mkdir');

        $this->assertTrue($this->client->getResponse()->isOk());
    }
     public function testCopyPost($user='testuser',$project='testRepo')
    {
        $crawler = $this->client->request('POST', '/user/'.$user.'/project/'.$project.'/copy');

        $this->assertTrue($this->client->getResponse()->isOk());
    }

    public function testIndexPost($user='testuser',$project='testRepo')
    {
        $crawler = $this->client->request('POST', '/user/'.$user.'/project/'.$project.'/files');

        $this->assertTrue($this->client->getResponse()->isOk());
    }

     public function testMovePost($user='testuser',$project='testRepo')
    {
        $crawler = $this->client->request('POST', '/user/'.$user.'/project/'.$project.'/move');

        $this->assertTrue($this->client->getResponse()->isOk());
    }



    /*
    Route::pattern('file', '.*');
    Route::resource('user.project.file', 'FileController');
    */
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants