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
67c450b9
Commit
67c450b9
authored
Jan 12, 2016
by
Will Banfield
Committed by
Jeremy Mikola
Mar 14, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHPLIB-160: implement drop() on bucket
parent
6aa739c4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
1 deletion
+23
-1
Bucket.php
src/GridFS/Bucket.php
+10
-0
GridFSCollectionsWrapper.php
src/GridFS/GridFSCollectionsWrapper.php
+6
-1
BucketFunctionalTest.php
tests/GridFS/BucketFunctionalTest.php
+7
-0
No files found.
src/GridFS/Bucket.php
View file @
67c450b9
...
...
@@ -150,6 +150,16 @@ class Bucket
$gridFsStream
->
downloadToStream
(
$destination
);
}
/**
* Drops the files and chunks collection associated with GridFS this bucket
*
*/
public
function
drop
()
{
$this
->
collectionsWrapper
->
dropCollections
();
}
/**
* Find files from the GridFS bucket's files collection.
*
...
...
src/GridFS/GridFSCollectionsWrapper.php
View file @
67c450b9
...
...
@@ -35,6 +35,11 @@ class GridFSCollectionsWrapper
$this
->
chunksCollection
=
new
Collection
(
$manager
,
sprintf
(
'%s.%s.chunks'
,
$databaseName
,
$bucketName
),
$collectionOptions
);
}
public
function
dropCollections
(){
$this
->
filesCollection
->
drop
();
$this
->
chunksCollection
->
drop
();
}
public
function
getChunksCollection
()
{
return
$this
->
chunksCollection
;
...
...
tests/GridFS/BucketFunctionalTest.php
View file @
67c450b9
...
...
@@ -273,6 +273,13 @@ class BucketFunctionalTest extends FunctionalTestCase
$this
->
assertEquals
(
"testing"
,
stream_get_contents
(
$this
->
bucket
->
openDownloadStreamByName
(
"second_name"
)));
}
public
function
testDrop
()
{
$id
=
$this
->
bucket
->
uploadFromStream
(
"test_filename"
,
$this
->
generateStream
(
"hello world"
));
$this
->
bucket
->
drop
();
$id
=
$this
->
bucket
->
uploadFromStream
(
"test_filename"
,
$this
->
generateStream
(
"hello world"
));
$this
->
assertEquals
(
1
,
$this
->
collectionsWrapper
->
getFilesCollection
()
->
count
());
}
/**
*@dataProvider 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