<commit_before><?php

namespace Criterion\Test\Helper;

class RepoHelperTest extends \Criterion\Test\TestCase
{
    public function testShortRepoUrlGithub()
    {
        $repo = 'https://github.com/romhut/criterion';

        $short = \Criterion\Helper\Repo::short($repo);
        $this->assertEquals('romhut/criterion', $short);
    }

    public function testShortRepoUrlBitbucket()
    {
        $repo = 'https://bitbucket.org/romhut/criterion';

        $short = \Criterion\Helper\Repo::short($repo);
        $this->assertEquals('romhut/criterion', $short);
    }

    public function testShortRepoUrlFail()
    {
        $repo = 'https://nonegitsite.com/romhut/criterion';

        $short = \Criterion\Helper\Repo::short($repo);
        $this->assertEquals($repo, $short);
    }

    public function testProvider()
    {
        $repo = 'https://github.com/romhut/criterion';

        $provider = \Criterion\Helper\Repo::provider($repo);
        $this->assertEquals('github', $provider);
    }

    public function testUsername()
    {
        $repo = 'git@github.com:romhut/criterion';

        $username = \Criterion\Helper\Repo::username($repo);
        $this->assertEquals('git', $username);
    }

    public function testFetchCommandRepo()
    {
        $project = new \Criterion\Model\Project(array(
            'source' => 'git@github.com:romhut/criterion'
        ));

        $test = new \Criterion\Model\Test();
        $test->branch = 'master';

        $clone_command = \Criterion\Helper\Repo::fetchCommand($test, $project);

        $expected = 'export GIT_SSH='.ROOT.'/bin/git; export PKEY='.ROOT.'/data/keys/'.$project->id.'; git clone -b master --depth=1 git@github.com:romhut/criterion '.$test->id;
        $this->assertEquals($expected, $clone_command);
    }

    public function testFetchCommandFolder()
    {
        $project = new \Criterion\Model\Project(array(
            'source' => ROOT
        ));

        $test = new \Criterion\Model\Test();
        $test->branch = 'master';

        $fetch_command = \Criterion\Helper\Repo::fetchCommand($test, $project);

        $expected = 'cp -R ' . ROOT . ' ' . $test->id;
        $this->assertEquals($expected, $fetch_command);
    }

    public function testCloneTypeHttps()
    {
        $repo = 'https://github.com/romhut/criterion';
        $provider = \Criterion\Helper\Repo::cloneType($repo);
        $this->assertEquals('https', $provider);
    }

    public function testCloneTypeSSH()
    {
        $repo = '<EMAIL>:romhut/criterion';
        $provider = \Criterion\Helper\Repo::cloneType($repo);
        $this->assertEquals('ssh', $provider);
    }

    public function testProviderFail()
    {
        $repo = 'https://nonegitsite.com/romhut/criterion';

        $provider = \Criterion\Helper\Repo::provider($repo);
        $this->assertEquals(false, $provider);
    }

}
<commit_msg>Fix tests<commit_after><?php

namespace Criterion\Test\Helper;

class RepoHelperTest extends \Criterion\Test\TestCase
{
    public function testShortRepoUrlGithub()
    {
        $repo = 'https://github.com/romhut/criterion';

        $short = \Criterion\Helper\Repo::short($repo);
        $this->assertEquals('romhut/criterion', $short);
    }

    public function testShortRepoUrlBitbucket()
    {
        $repo = 'https://bitbucket.org/romhut/criterion';

        $short = \Criterion\Helper\Repo::short($repo);
        $this->assertEquals('romhut/criterion', $short);
    }

    public function testShortRepoUrlFail()
    {
        $repo = 'https://nonegitsite.com/romhut/criterion';

        $short = \Criterion\Helper\Repo::short($repo);
        $this->assertEquals($repo, $short);
    }

    public function testProvider()
    {
        $repo = 'https://github.com/romhut/criterion';

        $provider = \Criterion\Helper\Repo::provider($repo);
        $this->assertEquals('github', $provider);
    }

    public function testUsername()
    {
        $repo = '<EMAIL>:romhut/criterion';

        $username = \Criterion\Helper\Repo::username($repo);
        $this->assertEquals('git', $username);
    }

    public function testFetchCommandRepo()
    {
        $project = new \Criterion\Model\Project();
        $project->emptyProject('git<EMAIL>:romhut/criterion');

        $test = new \Criterion\Model\Test();
        $test->branch = 'master';

        $clone_command = \Criterion\Helper\Repo::fetchCommand($test, $project);

        $expected = 'export GIT_SSH='.ROOT.'/bin/git; export PKEY='.ROOT.'/data/keys/'.$project->id.'; git clone -b master --depth=1 <EMAIL>:romhut/criterion '.$test->id;
        $this->assertEquals($expected, $clone_command);
    }

    public function testFetchCommandFolder()
    {
        $project = new \Criterion\Model\Project();
        $project->emptyProject(ROOT);

        $test = new \Criterion\Model\Test();
        $test->branch = 'master';

        $fetch_command = \Criterion\Helper\Repo::fetchCommand($test, $project);

        $expected = 'cp -R ' . ROOT . ' ' . $test->id;
        $this->assertEquals($expected, $fetch_command);
    }

    public function testCloneTypeHttps()
    {
        $repo = 'https://github.com/romhut/criterion';
        $provider = \Criterion\Helper\Repo::cloneType($repo);
        $this->assertEquals('https', $provider);
    }

    public function testCloneTypeSSH()
    {
        $repo = 'git@github.com:romhut/criterion';
        $provider = \Criterion\Helper\Repo::cloneType($repo);
        $this->assertEquals('ssh', $provider);
    }

    public function testProviderFail()
    {
        $repo = 'https://nonegitsite.com/romhut/criterion';

        $provider = \Criterion\Helper\Repo::provider($repo);
        $this->assertEquals(false, $provider);
    }

}

{'fraction_non_alphanumeric': 0.16337239811089732, 'fraction_numerical': 0.00034983382893125764, 'mean_word_length': 2.72265625, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 41, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2003442', 'n_tokens_mistral': 1744, 'n_tokens_neox': 1765, 'n_words': 263}