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
6590854b
Commit
6590854b
authored
Jun 08, 2016
by
Jeremy Mikola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up BucketFunctionalTest
parent
9b219418
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
427 additions
and
232 deletions
+427
-232
BucketFunctionalTest.php
tests/GridFS/BucketFunctionalTest.php
+395
-216
FunctionalTestCase.php
tests/GridFS/FunctionalTestCase.php
+32
-16
No files found.
tests/GridFS/BucketFunctionalTest.php
View file @
6590854b
This diff is collapsed.
Click to expand it.
tests/GridFS/FunctionalTestCase.php
View file @
6590854b
...
...
@@ -2,8 +2,8 @@
namespace
MongoDB\Tests\GridFS
;
use
MongoDB\GridFS
;
use
MongoDB\Collection
;
use
MongoDB\GridFS\Bucket
;
use
MongoDB\Tests\FunctionalTestCase
as
BaseFunctionalTestCase
;
/**
...
...
@@ -12,28 +12,44 @@ use MongoDB\Tests\FunctionalTestCase as BaseFunctionalTestCase;
abstract
class
FunctionalTestCase
extends
BaseFunctionalTestCase
{
protected
$bucket
;
protected
$collectionWrapper
;
protected
$chunksCollection
;
protected
$filesCollection
;
public
function
setUp
()
{
parent
::
setUp
();
foreach
([
'fs.files'
,
'fs.chunks'
]
as
$collection
){
$col
=
new
Collection
(
$this
->
manager
,
$this
->
getDatabaseName
(),
$collection
);
$col
->
drop
();
}
$this
->
bucket
=
new
\MongoDB\GridFS\Bucket
(
$this
->
manager
,
$this
->
getDatabaseName
()
);
$this
->
collectionWrapper
=
$this
->
bucket
->
getCollectionWrapper
(
);
$this
->
bucket
=
new
Bucket
(
$this
->
manager
,
$this
->
getDatabaseName
()
);
$this
->
bucket
->
drop
();
$this
->
chunksCollection
=
new
Collection
(
$this
->
manager
,
$this
->
getDatabaseName
(),
'fs.chunks'
);
$this
->
filesCollection
=
new
Collection
(
$this
->
manager
,
$this
->
getDatabaseName
(),
'fs.files'
);
}
public
function
tearDown
()
/**
* Rewinds a stream and asserts its contents.
*
* @param string $expectedContents
* @param resource $stream
*/
protected
function
assertStreamContents
(
$expectedContents
,
$stream
)
{
foreach
([
'fs.files'
,
'fs.chunks'
]
as
$collection
){
$col
=
new
Collection
(
$this
->
manager
,
$this
->
getDatabaseName
(),
$collection
);
$col
->
drop
();
}
if
(
$this
->
hasFailed
())
{
return
;
}
$this
->
assertEquals
(
$expectedContents
,
stream_get_contents
(
$stream
,
-
1
,
.
0
));
}
/**
* Creates an in-memory stream with the given data.
*
* @param string $data
* @return resource
*/
protected
function
createStream
(
$data
=
''
)
{
$stream
=
fopen
(
'php://temp'
,
'w+b'
);
fwrite
(
$stream
,
$data
);
rewind
(
$stream
);
return
$stream
;
}
public
function
provideInsertChunks
()
...
...
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