Skip to content

Commit a1f471b

Browse files
committed
Merge pull request #27 from giovyloca/php53
Restore PHP 5.3 compatibility
2 parents 8d7db8b + 678423d commit a1f471b

File tree

6 files changed

+29
-28
lines changed

6 files changed

+29
-28
lines changed

.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
language: php
22

33
php:
4+
- 5.3
45
- 5.4
56
- 5.5
67

@@ -9,4 +10,4 @@ before_script:
910

1011
script:
1112
- mkdir -p build
12-
- phpunit --configuration travis.phpunit.xml
13+
- phpunit --configuration travis.phpunit.xml

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"chunks"
2020
],
2121
"require": {
22-
"php": ">=5.4"
22+
"php": ">=5.3"
2323
},
2424
"require-dev": {
2525
"mikey179/vfsStream": "v1.2.0",

test/Unit/ConfigTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ class ConfigTest extends FlowUnitCase
2424
*/
2525
public function testConfig_construct_config()
2626
{
27-
$exampleConfig = [
27+
$exampleConfig = array(
2828
'tempDir' => '/some/dir',
2929
'deleteChunksOnSave' => TRUE,
3030
'hashNameCallback' => '\SomeNs\SomeClass::someMethod',
3131
'preprocessCallback' => '\SomeNs\SomeClass::preProcess'
32-
];
32+
);
3333

3434
$config = new Config($exampleConfig);
3535

test/Unit/FileTest.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -124,27 +124,27 @@ public function testFile_validateChunk()
124124
$this->assertFalse($file->validateChunk());
125125

126126
// Upload OK
127-
$fileInfo->exchangeArray([
127+
$fileInfo->exchangeArray(array(
128128
'size' => 10,
129129
'error' => UPLOAD_ERR_OK,
130130
'tmp_name' => ''
131-
]);
131+
));
132132
$this->assertTrue($file->validateChunk());
133133

134134
// Chunk size doesn't match
135-
$fileInfo->exchangeArray([
135+
$fileInfo->exchangeArray(array(
136136
'size' => 9,
137137
'error' => UPLOAD_ERR_OK,
138138
'tmp_name' => ''
139-
]);
139+
));
140140
$this->assertFalse($file->validateChunk());
141141

142142
// Upload error
143-
$fileInfo->exchangeArray([
143+
$fileInfo->exchangeArray(array(
144144
'size' => 10,
145145
'error' => UPLOAD_ERR_EXTENSION,
146146
'tmp_name' => ''
147-
]);
147+
));
148148
$this->assertFalse($file->validateChunk());
149149
}
150150

@@ -250,7 +250,7 @@ public function testFile_saveChunk()
250250

251251
// Mock File to use rename instead of move_uploaded_file
252252
$request = new Request($this->requestArr, $this->filesArr['file']);
253-
$file = $this->getMock('Flow\File', ['_move_uploaded_file'], [$this->config, $request]);
253+
$file = $this->getMock('Flow\File', array('_move_uploaded_file'), array($this->config, $request));
254254
$file->expects($this->once())
255255
->method('_move_uploaded_file')
256256
->will($this->returnCallback(function ($filename, $destination) {

test/Unit/FlowUnitCase.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class FlowUnitCase extends \PHPUnit_Framework_TestCase
2323

2424
protected function setUp()
2525
{
26-
$this->requestArr = new ArrayObject([
26+
$this->requestArr = new ArrayObject(array(
2727
'flowChunkNumber' => 1,
2828
'flowChunkSize' => 1048576,
2929
'flowCurrentChunkSize' => 10,
@@ -32,22 +32,22 @@ protected function setUp()
3232
'flowFilename' => 'prettify.js',
3333
'flowRelativePath' => 'home/prettify.js',
3434
'flowTotalChunks' => 42
35-
]);
35+
));
3636

37-
$this->filesArr = [
38-
'file' => [
37+
$this->filesArr = array(
38+
'file' => array(
3939
'name' => 'someFile.gif',
4040
'type' => 'image/gif',
4141
'size' => '10',
4242
'tmp_name' => '/tmp/abc1234',
4343
'error' => UPLOAD_ERR_OK
44-
]
45-
];
44+
)
45+
);
4646
}
4747

4848
protected function tearDown()
4949
{
50-
$_REQUEST = [];
51-
$_FILES = [];
50+
$_REQUEST = array();
51+
$_FILES = array();
5252
}
5353
}

test/Unit/FustyRequestTest.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ public function testFustyRequest_construct()
4545
$firstChunk->setContent('1234567890');
4646
$this->vfs->addChild($firstChunk);
4747

48-
$fileInfo = new \ArrayObject([
48+
$fileInfo = new \ArrayObject(array(
4949
'size' => 10,
5050
'error' => UPLOAD_ERR_OK,
5151
'tmp_name' => $firstChunk->url()
52-
]);
52+
));
5353

54-
$request = new \ArrayObject([
54+
$request = new \ArrayObject(array(
5555
'flowIdentifier' => '13632-prettifyjs',
5656
'flowFilename' => 'prettify.js',
5757
'flowRelativePath' => 'home/prettify.js'
58-
]);
58+
));
5959

6060
$fustyRequest = new FustyRequest($request, $fileInfo);
6161

@@ -80,25 +80,25 @@ public function testFustyRequest_ValidateUpload()
8080
$firstChunk->setContent('1234567890');
8181
$this->vfs->addChild($firstChunk);
8282

83-
$fileInfo = new \ArrayObject([
83+
$fileInfo = new \ArrayObject(array(
8484
'size' => 10,
8585
'error' => UPLOAD_ERR_OK,
8686
'tmp_name' => $firstChunk->url()
87-
]);
87+
));
8888

89-
$request = new \ArrayObject([
89+
$request = new \ArrayObject(array(
9090
'flowIdentifier' => '13632-prettifyjs',
9191
'flowFilename' => 'prettify.js',
9292
'flowRelativePath' => 'home/prettify.js'
93-
]);
93+
));
9494

9595
$fustyRequest = new FustyRequest($request, $fileInfo);
9696

9797
$config = new Config();
9898
$config->setTempDir($this->vfs->url());
9999

100100
/** @var File $file */
101-
$file = $this->getMock('Flow\File', array('_move_uploaded_file'), [$config, $fustyRequest]);
101+
$file = $this->getMock('Flow\File', array('_move_uploaded_file'), array($config, $fustyRequest));
102102

103103
/** @noinspection PhpUndefinedMethodInspection */
104104
$file->expects($this->once())

0 commit comments

Comments
 (0)