-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding SizeCalculator support to GridFS #603
Adding SizeCalculator support to GridFS #603
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for your contribution ;)
src/Gaufrette/Adapter/GridFS.php
Outdated
|
||
public function size($key) | ||
{ | ||
if(!$this->exists($key)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you apply the PSR2 coding style please ?
if(!isset($size['length'])) { | ||
return false; | ||
} | ||
return $size['length']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same about return statement; PSR2 says it should have an empty line before it ;)
public function testSize() | ||
{ | ||
$this->filesystem->write('sizetest.txt', 'data'); | ||
$this->assertGreaterThan(0, $this->filesystem->size('sizetest.txt')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the returned value be equal to 4
(length of data
) ?
You can run this test by putting your gridFS credentials in the phpunit.xml
file (copied from the phpunit.xml.dist
file).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I overthought it, it's changed
d57c8af
to
17313c5
Compare
Thank you @bsperduto ! |
Adds support for the SizeCalculator interface to the GridFS adapter.