filestack/filestack-php

View on GitHub
tests/UploadProcessorTest.php

Summary

Maintainability
C
1 day
Test Coverage

File UploadProcessorTest.php has 391 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
namespace Filestack\Tests;

use Filestack\FilestackConfig;
use Filestack\UploadProcessor;
Severity: Minor
Found in tests/UploadProcessorTest.php - About 5 hrs to fix

    Method testProcessChunks has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function testProcessChunks()
        {
            $mock_response1 = new MockHttpResponse(408,  '{"error": "timed out"}');
            $mock_response2 = new MockHttpResponse(504,  '{"error": "Gateway timed out"}');
            $mock_response3 = new MockHttpResponse(200,
    Severity: Minor
    Found in tests/UploadProcessorTest.php - About 1 hr to fix

      Method testCreatePartsIntelligentSuccess has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function testCreatePartsIntelligentSuccess()
          {
              $mock_response = new MockHttpResponse(200,
                  json_encode([
                      'filename'  => 'somefilename.jpg',
      Severity: Minor
      Found in tests/UploadProcessorTest.php - About 1 hr to fix

        Method testProcessPartsIntelligentSuccess has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function testProcessPartsIntelligentSuccess()
            {
                $test_headers = ['ETag' =>['some-etag']];
                $mock_response = new MockHttpResponse(200,
                    json_encode([
        Severity: Minor
        Found in tests/UploadProcessorTest.php - About 1 hr to fix

          Method testProcessPartsSuccess has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function testProcessPartsSuccess()
              {
                  $test_headers = ['ETag' =>['some-etag']];
                  $mock_response = new MockHttpResponse(200,
                      json_encode([
          Severity: Minor
          Found in tests/UploadProcessorTest.php - About 1 hr to fix

            Method testCommitPartException has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function testCommitPartException()
                {
                    $this->expectException(FilestackException::class);
                    $this->expectExceptionCode(400);
            
            
            Severity: Minor
            Found in tests/UploadProcessorTest.php - About 1 hr to fix

              Avoid unused local variables such as '$parts'.
              Open

                      $parts = $upload_processor->callHandleS3PromisesResult($s3_results);
              Severity: Minor
              Found in tests/UploadProcessorTest.php by phpmd

              UnusedLocalVariable

              Since: 0.2

              Detects when a local variable is declared and/or assigned, but not used.

              Example

              class Foo {
                  public function doSomething()
                  {
                      $i = 5; // Unused
                  }
              }

              Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

              There are no issues that match your filters.

              Category
              Status