Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongo-php-library
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sinan
mongo-php-library
Commits
9b925197
Unverified
Commit
9b925197
authored
Jan 30, 2018
by
Katherine Walker
Committed by
GitHub
Jan 30, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #463
parents
838436ca
ea98b3a1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
7 deletions
+23
-7
WritableStream.php
src/GridFS/WritableStream.php
+1
-1
StreamWrapperFunctionalTest.php
tests/GridFS/StreamWrapperFunctionalTest.php
+22
-6
No files found.
src/GridFS/WritableStream.php
View file @
9b925197
...
@@ -102,7 +102,6 @@ class WritableStream
...
@@ -102,7 +102,6 @@ class WritableStream
'_id'
=>
$options
[
'_id'
],
'_id'
=>
$options
[
'_id'
],
'chunkSize'
=>
$this
->
chunkSize
,
'chunkSize'
=>
$this
->
chunkSize
,
'filename'
=>
(
string
)
$filename
,
'filename'
=>
(
string
)
$filename
,
'uploadDate'
=>
new
UTCDateTime
,
]
+
array_intersect_key
(
$options
,
[
'aliases'
=>
1
,
'contentType'
=>
1
,
'metadata'
=>
1
]);
]
+
array_intersect_key
(
$options
,
[
'aliases'
=>
1
,
'contentType'
=>
1
,
'metadata'
=>
1
]);
}
}
...
@@ -224,6 +223,7 @@ class WritableStream
...
@@ -224,6 +223,7 @@ class WritableStream
$this
->
file
[
'length'
]
=
$this
->
length
;
$this
->
file
[
'length'
]
=
$this
->
length
;
$this
->
file
[
'md5'
]
=
$md5
;
$this
->
file
[
'md5'
]
=
$md5
;
$this
->
file
[
'uploadDate'
]
=
new
UTCDateTime
;
try
{
try
{
$this
->
collectionWrapper
->
insertFile
(
$this
->
file
);
$this
->
collectionWrapper
->
insertFile
(
$this
->
file
);
...
...
tests/GridFS/StreamWrapperFunctionalTest.php
View file @
9b925197
...
@@ -147,9 +147,8 @@ class StreamWrapperFunctionalTest extends FunctionalTestCase
...
@@ -147,9 +147,8 @@ class StreamWrapperFunctionalTest extends FunctionalTestCase
$this
->
assertSame
(
-
1
,
fseek
(
$stream
,
1
,
\SEEK_END
));
$this
->
assertSame
(
-
1
,
fseek
(
$stream
,
1
,
\SEEK_END
));
}
}
public
function
testWritableStreamStat
()
public
function
testWritableStreamStat
BeforeSaving
()
{
{
$currentTimestamp
=
time
();
$stream
=
$this
->
bucket
->
openUploadStream
(
'filename'
,
[
'chunkSizeBytes'
=>
1024
]);
$stream
=
$this
->
bucket
->
openUploadStream
(
'filename'
,
[
'chunkSizeBytes'
=>
1024
]);
$stat
=
fstat
(
$stream
);
$stat
=
fstat
(
$stream
);
...
@@ -157,10 +156,10 @@ class StreamWrapperFunctionalTest extends FunctionalTestCase
...
@@ -157,10 +156,10 @@ class StreamWrapperFunctionalTest extends FunctionalTestCase
$this
->
assertSame
(
0100222
,
$stat
[
'mode'
]);
$this
->
assertSame
(
0100222
,
$stat
[
'mode'
]);
$this
->
assertSame
(
0
,
$stat
[
7
]);
$this
->
assertSame
(
0
,
$stat
[
7
]);
$this
->
assertSame
(
0
,
$stat
[
'size'
]);
$this
->
assertSame
(
0
,
$stat
[
'size'
]);
$this
->
assert
GreaterThanOrEqual
(
$currentTimestamp
,
$stat
[
9
]);
$this
->
assert
Same
(
0
,
$stat
[
9
]);
$this
->
assert
GreaterThanOrEqual
(
$currentTimestamp
,
$stat
[
'mtime'
]);
$this
->
assert
Same
(
0
,
$stat
[
'mtime'
]);
$this
->
assert
GreaterThanOrEqual
(
$currentTimestamp
,
$stat
[
10
]);
$this
->
assert
Same
(
0
,
$stat
[
10
]);
$this
->
assert
GreaterThanOrEqual
(
$currentTimestamp
,
$stat
[
'ctime'
]);
$this
->
assert
Same
(
0
,
$stat
[
'ctime'
]);
$this
->
assertSame
(
1024
,
$stat
[
11
]);
$this
->
assertSame
(
1024
,
$stat
[
11
]);
$this
->
assertSame
(
1024
,
$stat
[
'blksize'
]);
$this
->
assertSame
(
1024
,
$stat
[
'blksize'
]);
...
@@ -169,6 +168,23 @@ class StreamWrapperFunctionalTest extends FunctionalTestCase
...
@@ -169,6 +168,23 @@ class StreamWrapperFunctionalTest extends FunctionalTestCase
$stat
=
fstat
(
$stream
);
$stat
=
fstat
(
$stream
);
$this
->
assertSame
(
6
,
$stat
[
7
]);
$this
->
assertSame
(
6
,
$stat
[
7
]);
$this
->
assertSame
(
6
,
$stat
[
'size'
]);
$this
->
assertSame
(
6
,
$stat
[
'size'
]);
}
public
function
testWritableStreamStatAfterSaving
()
{
$stream
=
$this
->
bucket
->
openDownloadStream
(
'length-10'
);
$stat
=
fstat
(
$stream
);
$this
->
assertSame
(
0100444
,
$stat
[
2
]);
$this
->
assertSame
(
0100444
,
$stat
[
'mode'
]);
$this
->
assertSame
(
10
,
$stat
[
7
]);
$this
->
assertSame
(
10
,
$stat
[
'size'
]);
$this
->
assertSame
(
1484202200
,
$stat
[
9
]);
$this
->
assertSame
(
1484202200
,
$stat
[
'mtime'
]);
$this
->
assertSame
(
1484202200
,
$stat
[
10
]);
$this
->
assertSame
(
1484202200
,
$stat
[
'ctime'
]);
$this
->
assertSame
(
4
,
$stat
[
11
]);
$this
->
assertSame
(
4
,
$stat
[
'blksize'
]);
}
}
public
function
testWritableStreamWrite
()
public
function
testWritableStreamWrite
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment