Skip to content
This repository was archived by the owner on Mar 15, 2020. It is now read-only.

Commit 0ee989e

Browse files
committed
Merge pull request #8 from webmozart/5.3-support
Added support for PHP 5.3.3
2 parents 45f51e1 + 56962ea commit 0ee989e

File tree

6 files changed

+50
-36
lines changed

6 files changed

+50
-36
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ php:
55
- 5.6
66
- 5.5
77
- 5.4
8+
- 5.3
9+
- 5.3.3
810
- hhvm
911
- hhvm-nightly
1012

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
}
1313
],
1414
"require": {
15-
"php": ">=5.4",
15+
"php": ">=5.3.3",
1616
"padraic/humbug_get_contents": "^1.0",
1717
"symfony/finder": "~2.2"
1818
},

src/VersionParser.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class VersionParser
2828
/**
2929
* @param array $versions
3030
*/
31-
public function __construct(array $versions = [])
31+
public function __construct(array $versions = array())
3232
{
3333
$this->versions = $versions;
3434
}
@@ -114,7 +114,7 @@ public function isDevelopment($version)
114114

115115
private function selectRecentStable()
116116
{
117-
$candidates = [];
117+
$candidates = array();
118118
foreach ($this->versions as $version) {
119119
if (!$this->stable($version)) {
120120
continue;
@@ -129,7 +129,7 @@ private function selectRecentStable()
129129

130130
private function selectRecentUnstable()
131131
{
132-
$candidates = [];
132+
$candidates = array();
133133
foreach ($this->versions as $version) {
134134
if ($this->stable($version) || $this->development($version)) {
135135
continue;
@@ -144,7 +144,7 @@ private function selectRecentUnstable()
144144

145145
private function selectRecentAll()
146146
{
147-
$candidates = [];
147+
$candidates = array();
148148
foreach ($this->versions as $version) {
149149
if ($this->development($version)) {
150150
continue;

tests/Humbug/Test/SelfUpdate/UpdaterGithubStrategyTest.php

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ public function testSetStabilityThrowsExceptionOnInvalidStabilityValue()
9999
*/
100100
public function testUpdatePhar()
101101
{
102+
if (!extension_loaded('openssl')) {
103+
$this->markTestSkipped('This test requires the openssl extension to run.');
104+
}
105+
102106
$this->createTestPharAndKey();
103107
$this->assertEquals('old', $this->getPharOutput($this->tmp . '/old.phar'));
104108

@@ -141,19 +145,19 @@ private function createTestPharAndKey()
141145
);
142146
@mkdir($this->tmp.'/releases/download/1.0.1', 0755, true);
143147
copy($this->files.'/build/new.phar', $this->tmp.'/releases/download/1.0.1/new.phar');
144-
file_put_contents($this->tmp . '/package.json', json_encode([
145-
'package' => [
146-
'versions' => [
147-
'1.0.1' => [
148-
'source' => [
148+
file_put_contents($this->tmp . '/package.json', json_encode(array(
149+
'package' => array(
150+
'versions' => array(
151+
'1.0.1' => array(
152+
'source' => array(
149153
'url' => 'file://' . $this->tmp . '.git'
150-
]
151-
],
152-
'1.0.0' => [
153-
]
154-
]
155-
]
156-
]));
154+
)
155+
),
156+
'1.0.0' => array(
157+
)
158+
)
159+
)
160+
)));
157161
}
158162
}
159163

tests/Humbug/Test/SelfUpdate/UpdaterTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ public function testThrowsExceptionOnInvalidRemoteVersion()
132132
*/
133133
public function testUpdatePhar()
134134
{
135+
if (!extension_loaded('openssl')) {
136+
$this->markTestSkipped('This test requires the openssl extension to run.');
137+
}
138+
135139
$this->createTestPharAndKey();
136140
$this->assertEquals('old', $this->getPharOutput($this->tmp . '/old.phar'));
137141

@@ -175,6 +179,10 @@ public function testUpdatePharFailsIfCurrentPublicKeyInvalid()
175179
*/
176180
public function testUpdatePharFailsOnExpectedSignatureMismatch()
177181
{
182+
if (!extension_loaded('openssl')) {
183+
$this->markTestSkipped('This test requires the openssl extension to run.');
184+
}
185+
178186
$this->createTestPharAndKey();
179187
$this->assertEquals('old', $this->getPharOutput($this->tmp . '/old.phar'));
180188

tests/Humbug/Test/SelfUpdate/VersionParserTest.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,102 +20,102 @@ class VersionParserTest extends \PHPUnit_Framework_TestCase
2020

2121
public function testShouldSelectNothingFromUnstablesIfStableRequested()
2222
{
23-
$versions = ['1.0.0a', '1.0.0alpha', '1.0.0-dev', 'dev-1.0.0', '1.0.0b',
24-
'1.0.0beta', '1.0.0rc', '1.0.0RC'];
23+
$versions = array('1.0.0a', '1.0.0alpha', '1.0.0-dev', 'dev-1.0.0', '1.0.0b',
24+
'1.0.0beta', '1.0.0rc', '1.0.0RC');
2525
$parser = new VersionParser($versions);
2626
$this->assertSame(false, $parser->getMostRecentStable());
2727
}
28-
28+
2929
public function testShouldSelectMostRecentVersionFromStandardSelection()
3030
{
31-
$versions = ['1.0.0', '1.0.1', '1.1.0'];
31+
$versions = array('1.0.0', '1.0.1', '1.1.0');
3232
$parser = new VersionParser($versions);
3333
$this->assertSame('1.1.0', $parser->getMostRecentStable());
3434
}
3535

3636
public function testShouldSelectMostRecentVersionFromMixedSelection()
3737
{
38-
$versions = ['1.0.0', '1.0.1', '1.1.0', '1.2.0a', '1.2.0b', '1.1.0rc'];
38+
$versions = array('1.0.0', '1.0.1', '1.1.0', '1.2.0a', '1.2.0b', '1.1.0rc');
3939
$parser = new VersionParser($versions);
4040
$this->assertSame('1.1.0', $parser->getMostRecentStable());
4141
}
4242

4343
public function testShouldSelectMostRecentVersionFromPrefixedSelection()
4444
{
45-
$versions = ['v1.0.0', 'v1.0.1', 'v1.1.0'];
45+
$versions = array('v1.0.0', 'v1.0.1', 'v1.1.0');
4646
$parser = new VersionParser($versions);
4747
$this->assertSame('v1.1.0', $parser->getMostRecentStable());
4848
}
4949

5050
public function testShouldSelectMostRecentVersionFromPartlyPrefixedSelection()
5151
{
52-
$versions = ['v1.0.0', 'v1.0.1', '1.1.0'];
52+
$versions = array('v1.0.0', 'v1.0.1', '1.1.0');
5353
$parser = new VersionParser($versions);
5454
$this->assertSame('1.1.0', $parser->getMostRecentStable());
5555
}
5656

5757
public function testShouldSelectMostRecentVersionFromPatchLevels()
5858
{
59-
$versions = ['1.0.0', '1.0.0-pl2', '1.0.0-pl3', '1.0.0-pl1'];
59+
$versions = array('1.0.0', '1.0.0-pl2', '1.0.0-pl3', '1.0.0-pl1');
6060
$parser = new VersionParser($versions);
6161
$this->assertSame('1.0.0-pl3', $parser->getMostRecentStable());
6262
}
6363

6464
public function testShouldSelectMostRecentVersionFromPatchLevels2()
6565
{
66-
$versions = ['1.0.0', '1.0.0pl2', '1.0.0pl3', '1.0.0pl1'];
66+
$versions = array('1.0.0', '1.0.0pl2', '1.0.0pl3', '1.0.0pl1');
6767
$parser = new VersionParser($versions);
6868
$this->assertSame('1.0.0pl3', $parser->getMostRecentStable());
6969
}
7070

7171
// Unstable
72-
72+
7373
public function testShouldSelectNothingFromUnstablesIfUnstableRequested()
7474
{
75-
$versions = ['1.0.0', '1.0.1', '1.1.0'];
75+
$versions = array('1.0.0', '1.0.1', '1.1.0');
7676
$parser = new VersionParser($versions);
7777
$this->assertSame(false, $parser->getMostRecentUnstable());
7878
}
7979

8080
public function testShouldSelectNothingFromStablesOrDevsIfUnstableRequested()
8181
{
82-
$versions = ['1.0.0', '1.0.1', '1.1.0-dev', 'dev-1.1.1'];
82+
$versions = array('1.0.0', '1.0.1', '1.1.0-dev', 'dev-1.1.1');
8383
$parser = new VersionParser($versions);
8484
$this->assertSame(false, $parser->getMostRecentUnstable());
8585
}
8686

8787
public function testShouldSelectMostRecentUnstableVersionFromStandardSelection()
8888
{
89-
$versions = ['1.0.0a', '1.0.0alpha', '1.0.0-dev', 'dev-1.0.0', '1.0.0b',
90-
'1.0.0beta', '1.0.0rc', '1.0.0RC'];
89+
$versions = array('1.0.0a', '1.0.0alpha', '1.0.0-dev', 'dev-1.0.0', '1.0.0b',
90+
'1.0.0beta', '1.0.0rc', '1.0.0RC');
9191
$parser = new VersionParser($versions);
9292
$this->assertSame('1.0.0rc', $parser->getMostRecentUnstable());
9393
}
9494

9595
public function testShouldSelectMostRecentUnstableVersionFromMixedSelection()
9696
{
97-
$versions = ['1.0.0', '1.0.1', '1.1.0', '1.2.0a', '1.2.0b', '1.1.0rc'];
97+
$versions = array('1.0.0', '1.0.1', '1.1.0', '1.2.0a', '1.2.0b', '1.1.0rc');
9898
$parser = new VersionParser($versions);
9999
$this->assertSame('1.2.0b', $parser->getMostRecentUnstable());
100100
}
101101

102102
public function testShouldSelectMostRecentUnstableVersionFromPrefixedSelection()
103103
{
104-
$versions = ['v1.0.0b', 'v1.0.1', 'v1.1.0'];
104+
$versions = array('v1.0.0b', 'v1.0.1', 'v1.1.0');
105105
$parser = new VersionParser($versions);
106106
$this->assertSame('v1.0.0b', $parser->getMostRecentUnstable());
107107
}
108108

109109
public function testShouldSelectMostRecentUnstableVersionFromPartlyPrefixedSelection()
110110
{
111-
$versions = ['v1.0.0b', 'v1.0.0a', '1.1.0a'];
111+
$versions = array('v1.0.0b', 'v1.0.0a', '1.1.0a');
112112
$parser = new VersionParser($versions);
113113
$this->assertSame('1.1.0a', $parser->getMostRecentUnstable());
114114
}
115115

116116
public function testShouldSelectMostRecentUnstableFromVaryingNumeralCounts()
117117
{
118-
$versions = ['1.0-dev', '1.0.0-alpha1'];
118+
$versions = array('1.0-dev', '1.0.0-alpha1');
119119
$parser = new VersionParser($versions);
120120
$this->assertSame('1.0.0-alpha1', $parser->getMostRecentUnstable());
121121
}
@@ -124,7 +124,7 @@ public function testShouldSelectMostRecentUnstableFromVaryingNumeralCounts()
124124

125125
public function testShouldSelectMostRecentIgnoringStabilityExceptDevFromPrefixedSelection()
126126
{
127-
$versions = ['v1.0.0b', 'v1.0.1', 'v1.1.0a', 'v1.2.0-dev'];
127+
$versions = array('v1.0.0b', 'v1.0.1', 'v1.1.0a', 'v1.2.0-dev');
128128
$parser = new VersionParser($versions);
129129
$this->assertSame('v1.1.0a', $parser->getMostRecentAll());
130130
}

0 commit comments

Comments
 (0)