示例#1
0
 public static function setUpBeforeClass()
 {
     InterfaceTest::$process = proc_open("java \"-Dwebdriver.chrome.driver=res/chromedriver.exe\" -jar res/selenium-server-standalone-2.48.2.jar", [["pipe", "r"], ["pipe", "w"]], $pipe);
     if (InterfaceTest::$process === false) {
         throw new Exception("Failed to start selenium server");
     }
     //loads a verified user 'testuser' with blid '4833' and email 'email@email.com` and password 'asdf'
     TestManager::loadBasicDummyData();
     InterfaceTest::$webDriver = RemoteWebDriver::create("http://localhost:4444/wd/hub", DesiredCapabilities::chrome());
 }
示例#2
0
 public static function setUpBeforeClass()
 {
     if (getenv('TMP')) {
         self::$tmpdir = getenv('TMP');
     } elseif (getenv('TMPDIR')) {
         self::$tmpdir = getenv('TMPDIR');
     } else {
         self::$tmpdir = '/tmp';
     }
     self::$tmpdir .= '/gitlist_' . md5(time() . mt_rand()) . '/';
     $fs = new Filesystem();
     $fs->mkdir(self::$tmpdir);
     if (!is_writable(self::$tmpdir)) {
         $this->markTestSkipped('There are no write permissions in order to create test repositories.');
     }
     $options['path'] = getenv('GIT_CLIENT') ?: '/usr/bin/git';
     $options['hidden'] = array(self::$tmpdir . '/hiddenrepo');
     $git = new Client($options);
     // GitTest repository fixture
     $git->createRepository(self::$tmpdir . 'GitTest');
     $repository = $git->getRepository(self::$tmpdir . 'GitTest');
     file_put_contents(self::$tmpdir . 'GitTest/README.md', "## GitTest\nGitTest is a *test* repository!");
     file_put_contents(self::$tmpdir . 'GitTest/test.php', "<?php\necho 'Hello World'; // This is a test");
     $repository->setConfig('user.name', 'Luke Skywalker');
     $repository->setConfig('user.email', '*****@*****.**');
     $repository->addAll();
     $repository->commit("Initial commit");
     $repository->createBranch('issue12');
     $repository->createBranch('issue42');
     // foobar repository fixture
     $git->createRepository(self::$tmpdir . 'foobar');
     $repository = $git->getRepository(self::$tmpdir . '/foobar');
     file_put_contents(self::$tmpdir . 'foobar/bar.json', "{\n\"name\": \"foobar\"\n}");
     file_put_contents(self::$tmpdir . 'foobar/.git/description', 'This is a test repo!');
     $fs->mkdir(self::$tmpdir . 'foobar/myfolder');
     $fs->mkdir(self::$tmpdir . 'foobar/testfolder');
     file_put_contents(self::$tmpdir . 'foobar/myfolder/mytest.php', "<?php\necho 'Hello World'; // This is my test");
     file_put_contents(self::$tmpdir . 'foobar/testfolder/test.php', "<?php\necho 'Hello World'; // This is a test");
     $repository->setConfig('user.name', 'Luke Skywalker');
     $repository->setConfig('user.email', '*****@*****.**');
     $repository->addAll();
     $repository->commit("First commit");
 }
示例#3
0
 public static function setUpBeforeClass()
 {
     if (getenv('TMP')) {
         self::$tmpdir = getenv('TMP');
     } elseif (getenv('TMPDIR')) {
         self::$tmpdir = getenv('TMPDIR');
     } else {
         self::$tmpdir = DIRECTORY_SEPARATOR . 'tmp';
     }
     self::$tmpdir .= DIRECTORY_SEPARATOR . 'gitlist_' . md5(time() . mt_rand()) . DIRECTORY_SEPARATOR;
     $fs = new Filesystem();
     $fs->mkdir(self::$tmpdir);
     if (!is_writable(self::$tmpdir)) {
         $this->markTestSkipped('There are no write permissions in order to create test repositories.');
     }
     $options['path'] = getenv('GIT_CLIENT') ?: '/usr/bin/git';
     $options['hidden'] = array(self::$tmpdir . '/hiddenrepo');
     $options['default_branch'] = 'master';
     $options['ini.file'] = "config.ini";
     $cacheDir = self::$tmpdir . DIRECTORY_SEPARATOR . 'cache';
     $fs->mkdir($cacheDir);
     $git = new Client($options);
     self::$gitPath = $options['path'];
     // GitTest repository fixture
     $git->createRepository(self::$tmpdir . 'GitTest');
     $repository = $git->getRepository(self::$tmpdir . 'GitTest');
     file_put_contents(self::$tmpdir . 'GitTest/README.md', "## GitTest\nGitTest is a *test* repository!");
     file_put_contents(self::$tmpdir . 'GitTest/test.php', "<?php\necho 'Hello World'; // This is a test");
     $repository->setConfig('user.name', 'Luke Skywalker');
     $repository->setConfig('user.email', '*****@*****.**');
     $repository->addAll();
     $repository->commit("Initial commit");
     $repository->createBranch('issue12');
     $repository->createBranch('issue42');
     $repository->createBranch('branch/name/wiith/slashes');
     // foobar repository fixture
     $git->createRepository(self::$tmpdir . 'foobar');
     $repository = $git->getRepository(self::$tmpdir . 'foobar');
     file_put_contents(self::$tmpdir . 'foobar/bar.json', "{\n\"name\": \"foobar\"\n}");
     file_put_contents(self::$tmpdir . 'foobar/.git/description', 'This is a test repo!');
     $fs->mkdir(self::$tmpdir . 'foobar/myfolder');
     $fs->mkdir(self::$tmpdir . 'foobar/testfolder');
     file_put_contents(self::$tmpdir . 'foobar/myfolder/mytest.php', "<?php\necho 'Hello World'; // This is my test");
     file_put_contents(self::$tmpdir . 'foobar/testfolder/test.php', "<?php\necho 'Hello World'; // This is a test");
     $repository->setConfig('user.name', 'Luke Skywalker');
     $repository->setConfig('user.email', '*****@*****.**');
     $repository->addAll();
     $repository->commit("First commit");
     // Nested repository fixture
     $nested_dir = self::$tmpdir . 'nested/';
     $fs->mkdir($nested_dir);
     $git->createRepository($nested_dir . 'NestedRepo');
     $repository = $git->getRepository($nested_dir . 'NestedRepo');
     file_put_contents($nested_dir . 'NestedRepo/.git/description', 'This is a NESTED test repo!');
     file_put_contents($nested_dir . 'NestedRepo/README.txt', 'NESTED TEST REPO README');
     $repository->setConfig('user.name', 'Luke Skywalker');
     $repository->setConfig('user.email', '*****@*****.**');
     $repository->addAll();
     $repository->commit("First commit");
     $repository->createBranch("testing");
     $repository->checkout("testing");
     file_put_contents($nested_dir . 'NestedRepo/README.txt', 'NESTED TEST BRANCH README');
     $repository->addAll();
     $repository->commit("Changing branch");
     $repository->checkout("master");
     // master-less repository fixture
     $git->createRepository(self::$tmpdir . 'develop');
     $repository = $git->getRepository(self::$tmpdir . 'develop');
     $repository->setConfig('user.name', 'Luke Skywalker');
     $repository->setConfig('user.email', '*****@*****.**');
     file_put_contents(self::$tmpdir . 'develop/README.md', "## develop\ndevelop is a *test* repository!");
     $repository->addAll();
     $repository->commit("First commit");
     $repository->createBranch("develop");
     $repository = $repository->checkout('develop');
     file_put_contents(self::$tmpdir . 'develop/test.php', "<?php\necho 'Hello World'; // This is a test");
     $repository->setConfig('user.name', 'Luke Skywalker');
     $repository->setConfig('user.email', '*****@*****.**');
     $repository->addAll();
     $repository->commit("Initial commit");
     // Detached HEAD repository fixture
     $git->createRepository(self::$tmpdir . 'detached-head');
     $repository = $git->getRepository(self::$tmpdir . 'detached-head');
     $repository->setConfig('user.name', 'Luke Skywalker');
     $repository->setConfig('user.email', '*****@*****.**');
     file_put_contents(self::$tmpdir . 'detached-head/README.md', "## detached head\ndetached-head is a *test* repository!");
     $repository->addAll();
     $repository->commit("First commit");
     $repository->checkout('HEAD');
     // mailmap repository fixture
     $git->createRepository(self::$tmpdir . 'mailmap');
     $repository = $git->getRepository(self::$tmpdir . 'mailmap');
     $repository->setConfig('user.name', 'Luke Skywalker');
     $repository->setConfig('user.email', '*****@*****.**');
     file_put_contents(self::$tmpdir . 'mailmap/README.md', "## mailmap\nmailmap is a *test* repository!");
     file_put_contents(self::$tmpdir . 'mailmap/.mailmap', "Anakin Skywalker <*****@*****.**> Luke Skywalker <*****@*****.**>");
     $repository->addAll();
     $repository->commit("First commit");
 }