Skip to content

Commit a64ee75

Browse files
committed
Reintroduce compatibility for PHP 5.4
1 parent 0a33eb3 commit a64ee75

15 files changed

+39
-38
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
language: php
1111

1212
php:
13+
- 5.4
1314
- 5.5
1415
- 5.6
1516
- 7.0

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"license": "MIT",
88
"authors": [{ "name": "makers", "homepage": "https://github.com/gushphp/gush/graphs/contributors" }],
99
"require": {
10-
"php": ">=5.5",
10+
"php": ">=5.4",
1111
"ext-curl": "*",
1212
"guzzlehttp/guzzle": "~4.2.3",
1313
"guzzlehttp/progress-subscriber": "~1.1.0",

src/Factory/AdapterFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class AdapterFactory
2626
const SUPPORT_ISSUE_TRACKER = 'supports_issue_tracker';
2727

2828
/**
29-
* @var object|string[]
29+
* @var string[]
3030
*/
3131
private $adapters = [];
3232

tests/BaseTestCase.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ function (ConsoleEvent $event) {
153153
*/
154154
protected function getGitHelper($isGitFolder = true)
155155
{
156-
$gitHelper = $this->prophesize(GitHelper::class);
156+
$gitHelper = $this->prophesize('Gush\Helper\GitHelper');
157157
$gitHelper->setHelperSet(Argument::any())->willReturn();
158158
$gitHelper->clearTempBranches()->willReturn(null);
159159
$gitHelper->getName()->willReturn('git');
@@ -167,7 +167,7 @@ protected function getGitHelper($isGitFolder = true)
167167
*/
168168
protected function getGitConfigHelper()
169169
{
170-
$helper = $this->prophesize(GitConfigHelper::class);
170+
$helper = $this->prophesize('Gush\Helper\GitConfigHelper');
171171
$helper->setHelperSet(Argument::any())->willReturn();
172172
$helper->getName()->willReturn('git_config');
173173

@@ -179,7 +179,7 @@ protected function getGitConfigHelper()
179179
*/
180180
protected function getProcessHelper()
181181
{
182-
$helper = $this->prophesize(ProcessHelper::class);
182+
$helper = $this->prophesize('Gush\Helper\ProcessHelper');
183183
$helper->setHelperSet(Argument::any())->willReturn();
184184
$helper->setOutput(Argument::any())->willReturn();
185185
$helper->getName()->willReturn('process');

tests/Command/Branch/BranchDeleteCommandTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function (HelperSet $helperSet) {
9999

100100
$this->setExpectedCommandInput($command, "\n"); // default is no
101101

102-
$this->setExpectedException(UserException::class, 'User aborted.');
102+
$this->setExpectedException('Gush\Exception\UserException', 'User aborted.');
103103

104104
$tester->execute();
105105
}

tests/Command/Branch/BranchMergeCommandTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ private function getLocalGitHelper($message = null, $squash = false, $forceSquas
201201
{
202202
$helper = parent::getGitHelper();
203203

204-
$mergeOperation = $this->prophesize(RemoteMergeOperation::class);
204+
$mergeOperation = $this->prophesize('Gush\Operation\RemoteMergeOperation');
205205
$mergeOperation->setTarget('gushphp', 'master')->shouldBeCalled();
206206
$mergeOperation->setSource('gushphp', 'develop')->shouldBeCalled();
207207
$mergeOperation->squashCommits($squash, $forceSquash)->shouldBeCalled();

tests/Command/Core/CoreInitCommandTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ function (HelperSet $helperSet) {
420420
);
421421

422422
$this->setExpectedException(
423-
UserException::class,
423+
'Gush\Exception\UserException',
424424
sprintf(
425425
'The "%s" command can only be executed from a the root of a Git repository.',
426426
$command->getName()

tests/Command/PullRequest/PullRequestCheckoutCommandTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function (HelperSet $helperSet) {
8181
);
8282

8383
$this->setExpectedException(
84-
UserException::class,
84+
'Gush\Exception\UserException',
8585
'A local branch named "head_ref" already exists but it\'s remote is not "cordoval"'
8686
);
8787

tests/Command/PullRequest/PullRequestCreateCommandTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ function (HelperSet $helperSet) {
264264
);
265265

266266
$this->setExpectedException(
267-
UserException::class,
267+
'Gush\Exception\UserException',
268268
'Cannot open pull-request, remote branch "not-my-branch" does not exist in "someone/gush".'
269269
);
270270

tests/Command/PullRequest/PullRequestMergeCommandTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ function (HelperSet $helperSet) {
346346
$this->setExpectedCommandInput($command, "feature\n");
347347

348348
$this->setExpectedException(
349-
UserException::class,
349+
'Gush\Exception\UserException',
350350
"Pull-request type 'feat' is not accepted, choose of one of: security, feature, bug."
351351
);
352352

tests/Factory/AdapterFactoryTest.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function testRegisterLazyAdapter()
5858
$this->adapterFactory->register(
5959
'test',
6060
'Testing',
61-
TestIssueTrackerFactory::class
61+
'Gush\Tests\Fixtures\Adapter\TestIssueTrackerFactory'
6262
);
6363

6464
$this->assertTrue($this->adapterFactory->has('test'));
@@ -80,7 +80,7 @@ public function testGetAllAdapters()
8080
$this->adapterFactory->register(
8181
'test2',
8282
'Testing2',
83-
TestIssueTrackerFactory::class
83+
'Gush\Tests\Fixtures\Adapter\TestIssueTrackerFactory'
8484
);
8585

8686
$this->assertEquals(
@@ -92,7 +92,7 @@ public function testGetAllAdapters()
9292
AdapterFactory::SUPPORT_ISSUE_TRACKER => false,
9393
],
9494
'test2' => [
95-
'factory' => TestIssueTrackerFactory::class,
95+
'factory' => 'Gush\Tests\Fixtures\Adapter\TestIssueTrackerFactory',
9696
'label' => 'Testing2',
9797
AdapterFactory::SUPPORT_REPOSITORY_MANAGER => false,
9898
AdapterFactory::SUPPORT_ISSUE_TRACKER => true,
@@ -127,7 +127,7 @@ public function testCreatesObjectFromLazyFactory()
127127
$this->adapterFactory->register(
128128
'test',
129129
'Testing',
130-
TestAdapterFactory::class
130+
'Gush\Tests\Fixtures\Adapter\TestAdapterFactory'
131131
);
132132

133133
$createdAdapter = $this->adapterFactory->createRepositoryManager(
@@ -136,7 +136,7 @@ public function testCreatesObjectFromLazyFactory()
136136
$this->config
137137
);
138138

139-
$this->assertInstanceOf(Adapter::class, $createdAdapter);
139+
$this->assertInstanceOf('Gush\Adapter\Adapter', $createdAdapter);
140140
}
141141

142142
public function testCreateConfigurator()
@@ -151,10 +151,10 @@ public function testCreateConfigurator()
151151

152152
$createdConfigurator = $this->adapterFactory->createConfigurator(
153153
'test',
154-
$this->prophesize(HelperSet::class)->reveal()
154+
$this->prophesize('Symfony\Component\Console\Helper\HelperSet')->reveal()
155155
);
156156

157-
$this->assertInstanceOf(Configurator::class, $createdConfigurator);
157+
$this->assertInstanceOf('Gush\Adapter\Configurator', $createdConfigurator);
158158
}
159159

160160
public function testCreateRepositoryManagerAdapter()
@@ -173,7 +173,7 @@ public function testCreateRepositoryManagerAdapter()
173173
$this->config
174174
);
175175

176-
$this->assertInstanceOf(Adapter::class, $createdAdapter);
176+
$this->assertInstanceOf('Gush\Adapter\Adapter', $createdAdapter);
177177
}
178178

179179
public function testCreateIssueTrackerAdapter()
@@ -192,7 +192,7 @@ public function testCreateIssueTrackerAdapter()
192192
$this->config
193193
);
194194

195-
$this->assertInstanceOf(IssueTracker::class, $createdAdapter);
195+
$this->assertInstanceOf('Gush\Adapter\IssueTracker', $createdAdapter);
196196
}
197197

198198
public function testCannotCreateUnregisteredAdapter()

tests/Helper/TemplateHelperTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public function gets_helper($domain, $name)
161161
{
162162
$res = $this->helper->getTemplate($domain, $name);
163163

164-
$this->assertInstanceof(TemplateInterface::class, $res);
164+
$this->assertInstanceof('Gush\Template\TemplateInterface', $res);
165165
}
166166

167167
/**

tests/Subscriber/GitFolderSubscriberTest.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public function fire_no_error_when_in_git_folder()
3131

3232
$commandEvent = new ConsoleCommandEvent(
3333
$command,
34-
$this->getMock(InputInterface::class),
35-
$this->getMock(OutputInterface::class)
34+
$this->getMock('Symfony\Component\Console\Input\InputInterface'),
35+
$this->getMock('Symfony\Component\Console\Output\OutputInterface')
3636
);
3737

3838
$helper = $this->getGitHelper();
@@ -52,8 +52,8 @@ public function fire_no_error_when_not_a_git_featured_command()
5252

5353
$commandEvent = new ConsoleCommandEvent(
5454
$command,
55-
$this->getMock(InputInterface::class),
56-
$this->getMock(OutputInterface::class)
55+
$this->getMock('Symfony\Component\Console\Input\InputInterface'),
56+
$this->getMock('Symfony\Component\Console\Output\OutputInterface')
5757
);
5858

5959
$helper = $this->getGitHelper(false);
@@ -73,22 +73,22 @@ public function throws_user_exception_when_not_in_git_folder()
7373

7474
$commandEvent = new ConsoleCommandEvent(
7575
$command,
76-
$this->getMock(InputInterface::class),
77-
$this->getMock(OutputInterface::class)
76+
$this->getMock('Symfony\Component\Console\Input\InputInterface'),
77+
$this->getMock('Symfony\Component\Console\Output\OutputInterface')
7878
);
7979

8080
$helper = $this->getGitHelper(false);
8181

8282
$subscriber = new GitFolderSubscriber($helper);
8383

84-
$this->setExpectedException(UserException::class);
84+
$this->setExpectedException('Gush\Exception\UserException');
8585

8686
$subscriber->initialize($commandEvent);
8787
}
8888

8989
private function getGitHelper($isGitFolder = true)
9090
{
91-
$helper = $this->prophesize(GitHelper::class);
91+
$helper = $this->prophesize('Gush\Helper\GitHelper');
9292
$helper->isGitFolder()->willReturn($isGitFolder);
9393

9494
return $helper->reveal();

tests/Subscriber/GitRepoSubscriberTest.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ public function allows_to_overwrite_configured_org_and_repo_for_issue()
236236
public function throws_error_on_invalid_repo_adapter()
237237
{
238238
$this->setExpectedException(
239-
UserException::class,
239+
'Gush\Exception\UserException',
240240
'Adapter "noop-noop" (for repository-management) is not supported'
241241
);
242242

@@ -254,7 +254,7 @@ public function throws_error_on_invalid_repo_adapter()
254254
public function throws_error_on_invalid_issue_adapter()
255255
{
256256
$this->setExpectedException(
257-
UserException::class,
257+
'Gush\Exception\UserException',
258258
'Adapter "noop-noop" (for issue-tracking) is not supported'
259259
);
260260

@@ -272,7 +272,7 @@ public function throws_error_on_invalid_issue_adapter()
272272
public function throws_error_when_not_configured_and_no_remote_is_set_for_auto_detection()
273273
{
274274
$this->setExpectedException(
275-
UserException::class,
275+
'Gush\Exception\UserException',
276276
'Unable to get the repository information, Git remote "origin" should be set for automatic detection'
277277
);
278278

@@ -293,7 +293,7 @@ function (HelperSet $helperSet) {
293293
public function throws_error_when_no_options_given_and_not_in_git_dir()
294294
{
295295
$this->setExpectedException(
296-
UserException::class,
296+
'Gush\Exception\UserException',
297297
'Provide the --org and --repo options when your are outside of a Git directory.'
298298
);
299299

@@ -314,7 +314,7 @@ function (HelperSet $helperSet) {
314314
public function throws_error_when_adapter_is_supported_but_not_configured()
315315
{
316316
$this->setExpectedException(
317-
UserException::class,
317+
'Gush\Exception\UserException',
318318
'Adapter "jira" (for issue-tracking) is not configured yet.'
319319
);
320320

tests/Validator/MergeWorkflowValidatorTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function testInvalidSemverPresetWithNoBranches($source, $target, $invalid
5555
$validator = new MergeWorkflowValidator(MergeWorkflowValidator::PRESET_SEMVER);
5656

5757
$this->setExpectedException(
58-
MergeWorkflowException::class,
58+
'Gush\Exception\MergeWorkflowException',
5959
sprintf(
6060
'Semver: %1$s version of source "%2$s" is higher then %1$s version of target "%3$s".',
6161
$invalidPart,
@@ -120,7 +120,7 @@ public function testInvalidGitFlowPresetWithNoBranches($source)
120120
$validator = new MergeWorkflowValidator(MergeWorkflowValidator::PRESET_GIT_FLOW);
121121

122122
$this->setExpectedException(
123-
MergeWorkflowException::class,
123+
'Gush\Exception\MergeWorkflowException',
124124
'Git-flow: Only "develop", "hotfix-" or "release-" branches are allowed to be merged into master.'
125125
);
126126

@@ -180,7 +180,7 @@ public function testBranchRestrictionsWithDeniedBranchAndAllowUnknown($source, $
180180
$validator = new MergeWorkflowValidator(MergeWorkflowValidator::PRESET_NONE, $restrictions);
181181

182182
$this->setExpectedException(
183-
MergeWorkflowException::class,
183+
'Gush\Exception\MergeWorkflowException',
184184
sprintf(
185185
'Branches: Only branches "%s" are allowed to be merged into "%s".',
186186
implode('", "', $restrictions[$source]),
@@ -217,7 +217,7 @@ public function testBranchRestrictionsDeniesAccessForUnknownBranchWithPolicyDeny
217217
$this->assertTrue($validator->validate('develop', 'new-feature'));
218218

219219
$this->setExpectedException(
220-
MergeWorkflowException::class,
220+
'Gush\Exception\MergeWorkflowException',
221221
'No branch constraint is set for source "new-feature" and policy denies merging unknown branches.'
222222
);
223223

0 commit comments

Comments
 (0)