Skip to content

Commit 350ec61

Browse files
authored
Make the default branch main. (#25)
* Start moving to 'main' default branch. * Fix tests. * Make tests use main. * Fix name of dependency. * Add more recent versions of PHP to travis config. * Remove unsupported versions of PHP. * .gitignore fix.
1 parent 76744ac commit 350ec61

16 files changed

Lines changed: 67 additions & 63 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
vendor
22
composer.lock
33
patch.diff
4+
.phpunit.result.cache

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
language: php
22

33
php:
4-
- 5.6
5-
- 7.0
6-
- 7.1
4+
- 7.3
5+
- 7.4
6+
- 8.0
77

88
before_script:
99
- composer self-update

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ TryLib currently supports **Freestyle** projects, when your test suite consist o
2121
-U, --lines-of-context ... Generate a diff with n lines of context (like git-diff's -U option)
2222
-s, --staged Use staged changes only to generate the diff
2323
-w, --safelist ... Generate the patch for only the safelisted files
24-
-b, --branch ... Remote branch to diff and try against [master]
24+
-b, --branch ... Remote branch to diff and try against [main]
2525

2626
-c, --show-results Show final try job results
2727
-P, --show-progress Print subtasks progressively as they complete
@@ -152,8 +152,8 @@ More info can be found in the [divide and concur](http://codeascraft.etsy.com/20
152152

153153
Try will work with your branches! The below scenarios are supported:
154154

155-
* You are working on **master**:
156-
* You want to try against master
155+
* You are working on **main**:
156+
* You want to try against main
157157

158158
try [options] [subjobs]
159159
* You want to diff and try against a different branch
@@ -164,13 +164,13 @@ Try will work with your branches! The below scenarios are supported:
164164
* You want to try against that branch
165165

166166
try [options] [subjobs]
167-
* You want to diff and try against a different branch (master for example)
167+
* You want to diff and try against a different branch (main for example)
168168

169-
try --branch=master [options] [subjobs]
169+
try --branch=main [options] [subjobs]
170170

171171
* You are working on a **local branch not tracked**
172172
* If the remote has a branch with the same name, it will be used to generate the diff and try against it
173-
* If the remote does not have a branch with the same name, it will use the default remote : **master**
173+
* If the remote does not have a branch with the same name, it will use the default remote : **main**
174174
* You want to diff and try against a specific remote branch
175175

176176
try --branch=my_branch [options] [subjobs]
@@ -181,7 +181,7 @@ Prior to generate the diff, you can configure try to run a list of pre-checks.
181181

182182
$pre_checks = array(
183183
new TryLib\Precheck\ScriptRunner('/path/to/some/script'),
184-
new TryLib\Precheck\GitCopyBehind(array('master')),
184+
new TryLib\Precheck\GitCopyBehind(array('main')),
185185
new TryLib\Precheck\GitCopyAge(48, 96, $remote_branch)
186186
new TryLib\Precheck\GitReportUntracked(),
187187
);

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"require-dev": {
2020
"phpunit/phpunit": ">=5.5.0",
21-
"mikey179/vfsStream": "~1"
21+
"mikey179/vfsstream": "~1"
2222
},
2323
"autoload": {
2424
"psr-4": {

phpunit.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
convertNoticesToExceptions="true"
88
convertWarningsToExceptions="true"
99
processIsolation="false"
10-
stopOnFailure="false"
11-
syntaxCheck="false">
10+
stopOnFailure="false">
1211
<testsuites>
1312
<testsuite name="TryLib Test Suite">
1413
<directory suffix=".php">./tests/</directory>

src/TryRunner/Options.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@ final class Options {
3636
private function __construct() {} // Do not instantiate.
3737

3838
public static function parse(
39-
$argv,
40-
$jenkins_server,
41-
$default_jenkins_job,
42-
$default_jenkins_job_prefix = null,
43-
$default_wc_path = null,
44-
$default_remote_branch = "master") {
39+
$argv,
40+
$jenkins_server,
41+
$default_jenkins_job,
42+
$default_jenkins_job_prefix = null,
43+
$default_wc_path = null,
44+
$default_remote_branch = "main"
45+
) {
4546

4647
$default_jenkins_job_prefix = $default_jenkins_job_prefix ?: $default_jenkins_job;
4748
$default_wc_path = $default_wc_path ?: ".";

tests/JenkinsRunner/FreeStyleProjectTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class FreeStyleProjectTest extends \PHPUnit\Framework\TestCase {
1212
private $jenkins_runner;
1313
private $mock_cmd_runner;
1414

15-
function setUp() {
15+
function setUp(): void {
1616
parent::setUp();
1717

1818
$this->mock_cmd_runner = $this->getMockBuilder('TryLib\CommandRunner')

tests/JenkinsRunner/MasterProjectTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class MasterProjectTest extends \PHPUnit\Framework\TestCase {
1212
private $jenkins_runner;
1313
private $mock_cmd_runner;
1414

15-
function setUp() {
15+
function setUp(): void {
1616
parent::setUp();
1717

1818
$this->mock_cmd_runner = $this->getMockBuilder('TryLib\CommandRunner')

tests/JenkinsRunnerTest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class JenkinsRunnerTest extends \PHPUnit\Framework\TestCase {
2929
private $jenkins_runner;
3030
private $mock_cmd_runner;
3131

32-
function setUp() {
32+
function setUp(): void {
3333
parent::setUp();
3434

3535
$this->mock_cmd_runner = $this->getMockBuilder('TryLib\CommandRunner')
@@ -49,12 +49,13 @@ function setUp() {
4949
* @expectedException Exception
5050
*/
5151
function testInvalidUrl() {
52-
$this->jenkins_runner = new TestRunner(
53-
'totallyvalid.com/',
54-
self::JENKINS_CLI,
55-
self::JENKINS_JOB,
56-
$this->mock_cmd_runner
57-
);
52+
$this->expectException(\Exception::class);
53+
$this->jenkins_runner = new TestRunner(
54+
'totallyvalid.com/',
55+
self::JENKINS_CLI,
56+
self::JENKINS_JOB,
57+
$this->mock_cmd_runner
58+
);
5859
}
5960

6061

tests/Precheck/GitCopyAgeTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class GitCopyAgeTest extends \PHPUnit\Framework\TestCase {
88

99
private $mock_cmd_runner;
1010

11-
function setUp() {
11+
function setUp(): void {
1212
parent::setUp();
1313
$this->mock_cmd_runner = $this->getMockBuilder('TryLib\CommandRunner')
1414
->getMock();
@@ -78,7 +78,7 @@ function testWorkingCopyPastMaxBlockingAge() {
7878
->method('terminate')
7979
->with($this->stringContains('you working copy is 100 hours old.'));
8080

81-
$script_runner->check($this->mock_cmd_runner, 'path', 'origin/master');
81+
$script_runner->check($this->mock_cmd_runner, 'path', 'origin/main');
8282
}
8383

8484
function testWorkingCopyPastMaxWarningAge() {
@@ -110,7 +110,7 @@ function testWorkingCopyPastMaxWarningAge() {
110110
$this->mock_cmd_runner->expects($this->once())
111111
->method('warn');
112112

113-
$script_runner->check($this->mock_cmd_runner, 'path', 'origin/master');
113+
$script_runner->check($this->mock_cmd_runner, 'path', 'origin/main');
114114
}
115115

116116

@@ -141,6 +141,6 @@ function testWorkingCopySuccess() {
141141
$this->mock_cmd_runner->expects($this->never())
142142
->method('warn');
143143

144-
$script_runner->check($this->mock_cmd_runner, 'path', 'origin/master');
144+
$script_runner->check($this->mock_cmd_runner, 'path', 'origin/main');
145145
}
146146
}

0 commit comments

Comments
 (0)