.dev/tests/rewrite/class_rewrite_testing_shared.php

Summary

Maintainability
F
1 wk
Test Coverage

File class_rewrite_testing_shared.php has 426 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

require_once __DIR__ . '/yf_unit_tests_setup.php';
class class_rewrite_testing_shared extends yf\tests\wrapper
{
Severity: Minor
Found in .dev/tests/rewrite/class_rewrite_testing_shared.php - About 6 hrs to fix

    Method test_rewrite_replace_links has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function test_rewrite_replace_links()
        {
            $GLOBALS['PROJECT_CONF']['tpl']['REWRITE_MODE'] = true;
            $host = self::$host;
    
    
    Severity: Major
    Found in .dev/tests/rewrite/class_rewrite_testing_shared.php - About 2 hrs to fix

      class_rewrite_testing_shared has 21 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class class_rewrite_testing_shared extends yf\tests\wrapper
      {
          private static $host = 'test.dev';
          private static $_bak_settings = [];
      
      
      Severity: Minor
      Found in .dev/tests/rewrite/class_rewrite_testing_shared.php - About 2 hrs to fix

        Method test_rewrite_disabled_simple has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function test_rewrite_disabled_simple()
            {
                $GLOBALS['PROJECT_CONF']['tpl']['REWRITE_MODE'] = false;
                unset($_GET['debug']);
                $this->assertEquals('http://' . self::$host . '/?object=test', process_url('./?object=test'));
        Severity: Minor
        Found in .dev/tests/rewrite/class_rewrite_testing_shared.php - About 1 hr to fix

          Method test_correct_protocol has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function test_correct_protocol()
              {
                  $old = main()->USE_ONLY_HTTPS;
                  main()->USE_ONLY_HTTPS = true;
          
          
          Severity: Minor
          Found in .dev/tests/rewrite/class_rewrite_testing_shared.php - About 1 hr to fix

            Method test_https_enabled_for has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function test_https_enabled_for()
                {
                    $old1 = main()->HTTPS_ENABLED_FOR;
                    $old2 = main()->USE_ONLY_HTTPS;
            
            
            Severity: Minor
            Found in .dev/tests/rewrite/class_rewrite_testing_shared.php - About 1 hr to fix

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

                  public function test_rewrite_short_form()
                  {
                      $this->assertEquals('http://' . self::$host . '/test/my/123/456', url('/test/my/123/456', ['host' => self::$host]));
              
                      $this->assertEquals('http://' . self::$host . '/test', url('/test', ['host' => self::$host]));
              Severity: Minor
              Found in .dev/tests/rewrite/class_rewrite_testing_shared.php - About 1 hr to fix

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                    public function test_rewrite_url_user_disabled()
                    {
                        $GLOBALS['PROJECT_CONF']['tpl']['REWRITE_MODE'] = false;
                        $this->assertEquals('http://' . self::$host . '/', url_user());
                        $this->assertEquals('http://' . self::$host . '/', url_user(''));
                Severity: Major
                Found in .dev/tests/rewrite/class_rewrite_testing_shared.php and 2 other locations - About 2 days to fix
                .dev/tests/rewrite/class_rewrite_testing_shared.php on lines 148..164
                .dev/tests/rewrite/class_rewrite_testing_shared.php on lines 165..181

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 411.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                    public function test_rewrite_disabled()
                    {
                        $GLOBALS['PROJECT_CONF']['tpl']['REWRITE_MODE'] = false;
                        $this->assertEquals('http://' . self::$host . '/', url());
                        $this->assertEquals('http://' . self::$host . '/', url(''));
                Severity: Major
                Found in .dev/tests/rewrite/class_rewrite_testing_shared.php and 2 other locations - About 2 days to fix
                .dev/tests/rewrite/class_rewrite_testing_shared.php on lines 165..181
                .dev/tests/rewrite/class_rewrite_testing_shared.php on lines 182..198

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 411.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                    public function test_rewrite_url_user_enabled()
                    {
                        $GLOBALS['PROJECT_CONF']['tpl']['REWRITE_MODE'] = true;
                        $this->assertEquals('http://' . self::$host . '/', url_user());
                        $this->assertEquals('http://' . self::$host . '/', url_user(''));
                Severity: Major
                Found in .dev/tests/rewrite/class_rewrite_testing_shared.php and 2 other locations - About 2 days to fix
                .dev/tests/rewrite/class_rewrite_testing_shared.php on lines 148..164
                .dev/tests/rewrite/class_rewrite_testing_shared.php on lines 182..198

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 411.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                    public static function setUpBeforeClass() : void
                    {
                        self::$_bak_settings['REWRITE_MODE'] = $GLOBALS['PROJECT_CONF']['tpl']['REWRITE_MODE'];
                        $GLOBALS['PROJECT_CONF']['tpl']['REWRITE_MODE'] = true;
                        $_GET = [
                Severity: Major
                Found in .dev/tests/rewrite/class_rewrite_testing_shared.php and 1 other location - About 1 hr to fix
                .dev/tests/rewrite/class_rewrite_testing_admin.php on lines 10..20

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 103.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                There are no issues that match your filters.

                Category
                Status