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

[TASK] Fix the hg tests. #126

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@
} else {
throw new \Exception("Unable to find the an autoloader");
}

if (file_exists('test' . DIRECTORY_SEPARATOR . 'bootstrap.php')) {
require_once 'test' . DIRECTORY_SEPARATOR . 'bootstrap.php';
}
10 changes: 10 additions & 0 deletions test/Liip/RMT/Tests/Functional/GitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@

class GitTest extends RMTFunctionalTestBase
{
protected function setUp()
{
if (SKIP_GIT_TESTS) {
$this->markTestSkipped('GIT is not installed');
}

parent::setUp(); // TODO: Change the autogenerated stub
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you can delete the comment

}


public function testInitialVersion()
{
$this->initGit();
Expand Down
10 changes: 10 additions & 0 deletions test/Liip/RMT/Tests/Functional/HgTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@

class HgTest extends RMTFunctionalTestBase
{
protected function setUp()
{
if (SKIP_HG_TESTS) {
$this->markTestSkipped('HG is not installed');
}

parent::setUp();
}


public static function cleanTags($tags)
{
return array_map(function ($t) {
Expand Down
4 changes: 4 additions & 0 deletions test/Liip/RMT/Tests/Unit/VCS/GitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ class GitTest extends \PHPUnit_Framework_TestCase

protected function setUp()
{
if (SKIP_GIT_TESTS) {
$this->markTestSkipped('GIT is not installed');
}

// Create a temp folder and extract inside the git test folder
$tempDir = tempnam(sys_get_temp_dir(), '');
if (file_exists($tempDir)) {
Expand Down
4 changes: 4 additions & 0 deletions test/Liip/RMT/Tests/Unit/VCS/HgTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ class HgTest extends \PHPUnit_Framework_TestCase

protected function setUp()
{
if (SKIP_HG_TESTS) {
$this->markTestSkipped('HG is not installed');
}

// Create a temp folder and extract inside the Hg test folder
$tempDir = tempnam(sys_get_temp_dir(), '');
if (file_exists($tempDir)) {
Expand Down
20 changes: 20 additions & 0 deletions test/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

/*
* This file is part of the project RMT
*
* Copyright (c) 2017, Liip AG, http://www.liip.ch
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

if (!defined('SKIP_HG_TESTS')) {
exec('which hg', $result);
define('SKIP_HG_TESTS', !isset($result[0]));
}

if (!defined('SKIP_GIT_TESTS')) {
exec('which git', $result);
define('SKIP_GIT_TESTS', !isset($result[0]));
}