-
-
Notifications
You must be signed in to change notification settings - Fork 204
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
PHP CS fixer command executed #193
PHP CS fixer command executed #193
Conversation
@jonesdev Thank you for picking this up. We are mocking native php functions on unit tests. Tests are failing because a call to fseek, fread, fwrite, unlink, is_readable, hash_algos, base64_decode, connection_status |
Thanks for your advice - I'll try to rectify this later if I get a few minutes. |
I went about it via the following way: And the tests seem to be failing still - am I misunderstanding here?
|
@jonesdev you are in a right direction. Check the diff below, it works fine for me. You will need to do similar change in --- a/src/File.php
+++ b/src/File.php
@@ -316,7 +316,7 @@ class File
$this->seek($output, $this->offset);
while ( ! \feof($input)) {
- if (CONNECTION_NORMAL !== \connection_status()) {
+ if (CONNECTION_NORMAL !== connection_status()) {
throw new ConnectionException('Connection aborted by user.');
}
@@ -402,7 +402,7 @@ class File
*/
public function seek($handle, int $offset, int $whence = SEEK_SET) : int
{
- $position = \fseek($handle, $offset, $whence);
+ $position = fseek($handle, $offset, $whence);
if (-1 === $position) {
throw new FileException('Cannot move pointer to desired position.');
@@ -423,7 +423,7 @@ class File
*/
public function read($handle, int $chunkSize) : string
{
- $data = \fread($handle, $chunkSize);
+ $data = fread($handle, $chunkSize);
if (false === $data) {
throw new FileException('Cannot read file.');
@@ -445,7 +445,7 @@ class File
*/
public function write($handle, string $data, $length = null) : int
{
- $bytesWritten = \is_int($length) ? \fwrite($handle, $data, $length) : \fwrite($handle, $data);
+ $bytesWritten = \is_int($length) ? fwrite($handle, $data, $length) : fwrite($handle, $data);
if (false === $bytesWritten) {
throw new FileException('Cannot write to a file.'); |
Thank you, I'll try to work on this later. |
Codecov Report
@@ Coverage Diff @@
## master #193 +/- ##
=======================================
Coverage 100% 100%
Complexity 335 335
=======================================
Files 19 19
Lines 907 907
=======================================
Hits 907 907
Continue to review full report at Codecov.
|
Output of PHPUnit: ❯ vendor/bin/phpunit
PHPUnit 7.5.16 by Sebastian Bergmann and contributors.
........................SSSSSSSSSSS............................ 63 / 219 ( 28%)
............................................................... 126 / 219 ( 57%)
............................................................... 189 / 219 ( 86%)
.............................. 219 / 219 (100%)
Time: 1.57 seconds, Memory: 20.00 MB
OK, but incomplete, skipped, or risky tests!
Tests: 219, Assertions: 498, Skipped: 11. |
Looks good now. Thanks! |
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.
Fixes #190
The
native_function_invocation
option within PHP CS Fixer was used for this issue.