.dev/tests/unit/class_form_test.Test.php

Summary

Maintainability
F
5 days
Test Coverage

class_form_test has 66 functions (exceeds 20 allowed). Consider refactoring.
Open

class class_form_test extends yf\tests\wrapper
{
    private static $_bak_settings = [];
    private static $css = [];
    private static $action = '';
Severity: Major
Found in .dev/tests/unit/class_form_test.Test.php - About 1 day to fix

    File class_form_test.Test.php has 519 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    
    require_once __DIR__ . '/yf_unit_tests_setup.php';
    
    
    Severity: Major
    Found in .dev/tests/unit/class_form_test.Test.php - About 1 day to fix

      Method test_check_box has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function test_check_box()
          {
              $html = html();
              $def_class = $html->CLASS_LABEL_CHECKBOX . ' ' . $html->CLASS_LABEL_CHECKBOX_INLINE;
      
      
      Severity: Minor
      Found in .dev/tests/unit/class_form_test.Test.php - About 1 hr to fix

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

            public function test_yes_no_box()
            {
                $this->assertEquals('<label class="radio radio-inline"><input type="radio" name="active" id="radio_box_1_1" value="0"><span><span class="btn btn-default btn-mini btn-xs btn-warning">'
                    . '<i class="icon-ban-circle fa fa-ban"></i> No</span></span></label><label class="radio radio-inline"><input type="radio" name="active" id="radio_box_1_2" value="1">'
                    . '<span><span class="btn btn-default btn-mini btn-xs btn-success"><i class="icon-ok fa fa-check"></i> Yes</span></span></label>', str_replace(PHP_EOL, '', trim(self::form_no_chain($r)->yes_no_box('', ['force_id' => 'radio_box_1']))));
        Severity: Major
        Found in .dev/tests/unit/class_form_test.Test.php and 2 other locations - About 2 hrs to fix
        .dev/tests/unit/class_form_test.Test.php on lines 414..422
        .dev/tests/unit/class_form_test.Test.php on lines 423..431

        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 134.

        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_allow_deny_box()
            {
                $this->assertEquals('<label class="radio radio-inline"><input type="radio" name="active" id="radio_box_1_1" value="DENY"><span><span class="btn btn-default btn-mini btn-xs btn-warning">'
                    . '<i class="icon-ban-circle fa fa-ban"></i> Deny</span></span></label><label class="radio radio-inline"><input type="radio" name="active" id="radio_box_1_2" value="ALLOW">'
                    . '<span><span class="btn btn-default btn-mini btn-xs btn-success"><i class="icon-ok fa fa-check"></i> Allow</span></span></label>', str_replace(PHP_EOL, '', trim(self::form_no_chain($r)->allow_deny_box('', ['force_id' => 'radio_box_1']))));
        Severity: Major
        Found in .dev/tests/unit/class_form_test.Test.php and 2 other locations - About 2 hrs to fix
        .dev/tests/unit/class_form_test.Test.php on lines 414..422
        .dev/tests/unit/class_form_test.Test.php on lines 432..440

        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 134.

        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_active_box()
            {
                $this->assertEquals('<label class="radio radio-inline"><input type="radio" name="active" id="radio_box_1_1" value="0"><span><span class="btn btn-default btn-mini btn-xs btn-warning">'
                    . '<i class="icon-ban-circle fa fa-ban"></i> Disabled</span></span></label><label class="radio radio-inline"><input type="radio" name="active" id="radio_box_1_2" value="1">'
                    . '<span><span class="btn btn-default btn-mini btn-xs btn-success"><i class="icon-ok fa fa-check"></i> Active</span></span></label>', str_replace(PHP_EOL, '', trim(self::form_no_chain($r)->active_box('', ['force_id' => 'radio_box_1']))));
        Severity: Major
        Found in .dev/tests/unit/class_form_test.Test.php and 2 other locations - About 2 hrs to fix
        .dev/tests/unit/class_form_test.Test.php on lines 423..431
        .dev/tests/unit/class_form_test.Test.php on lines 432..440

        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 134.

        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 2 locations. Consider refactoring.
        Open

            public function test_input_text_attr_ng()
            {
                $this->assertEquals('<input name="name" type="text" id="name" class="form-control" placeholder="Name" ng-something="5">', trim(self::form_no_chain($r)->text('name', ['ng-something' => '5'])));
                $this->assertEquals('<input name="name" type="text" id="name" class="form-control" placeholder="Name" ng-a1="a11" ng-b1="b11">', trim(self::form_no_chain($r)->text('name', ['ng-a1' => 'a11', 'ng-b1' => 'b11'])));
                $this->assertEquals('<input name="name" type="text" id="name" class="form-control" placeholder="Name" ng-test-escape="!@#$%^&*(&quot;&apos;&lt;&gt;?&gt;&lt;:;">', trim(self::form_no_chain($r)->text('name', ['ng-test-escape' => '!@#$%^&*("\'<>?><:;'])));
        Severity: Major
        Found in .dev/tests/unit/class_form_test.Test.php and 1 other location - About 2 hrs to fix
        .dev/tests/unit/class_form_test.Test.php on lines 133..138

        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 132.

        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 2 locations. Consider refactoring.
        Open

            public function test_input_text_attr_data()
            {
                $this->assertEquals('<input name="name" type="text" id="name" class="form-control" placeholder="Name" data-something="5">', trim(self::form_no_chain($r)->text('name', ['data-something' => '5'])));
                $this->assertEquals('<input name="name" type="text" id="name" class="form-control" placeholder="Name" data-a1="a11" data-b1="b11">', trim(self::form_no_chain($r)->text('name', ['data-a1' => 'a11', 'data-b1' => 'b11'])));
                $this->assertEquals('<input name="name" type="text" id="name" class="form-control" placeholder="Name" data-test-escape="!@#$%^&*(&quot;&apos;&lt;&gt;?&gt;&lt;:;">', trim(self::form_no_chain($r)->text('name', ['data-test-escape' => '!@#$%^&*("\'<>?><:;'])));
        Severity: Major
        Found in .dev/tests/unit/class_form_test.Test.php and 1 other location - About 2 hrs to fix
        .dev/tests/unit/class_form_test.Test.php on lines 139..144

        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 132.

        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 5 locations. Consider refactoring.
        Open

            public function test_tbl_link_view()
            {
                $this->assertEquals('<a name="View" class="btn btn-default btn-mini btn-xs ajax_view"><i class="icon-eye-open fa fa-eye"></i> View</a>', trim(self::form_no_chain($r)->tbl_link_view()));
                $this->assertEquals('<a name="test" class="btn btn-default btn-mini btn-xs ajax_view"><i class="icon-eye-open fa fa-eye"></i> test</a>', trim(self::form_no_chain($r)->tbl_link_view('test')));
                $r['view_link'] = './?object=someobject&action=someaction';
        Severity: Major
        Found in .dev/tests/unit/class_form_test.Test.php and 4 other locations - About 1 hr to fix
        .dev/tests/unit/class_form_test.Test.php on lines 481..487
        .dev/tests/unit/class_form_test.Test.php on lines 492..498
        .dev/tests/unit/class_form_test.Test.php on lines 499..505
        .dev/tests/unit/class_form_test.Test.php on lines 506..512

        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 108.

        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 5 locations. Consider refactoring.
        Open

            public function test_tbl_link_delete()
            {
                $this->assertEquals('<a name="Delete" class="btn btn-default btn-mini btn-xs ajax_delete btn-danger"><i class="icon-trash fa fa-trash"></i> Delete</a>', trim(self::form_no_chain($r)->tbl_link_delete()));
                $this->assertEquals('<a name="test" class="btn btn-default btn-mini btn-xs ajax_delete btn-danger"><i class="icon-trash fa fa-trash"></i> test</a>', trim(self::form_no_chain($r)->tbl_link_delete('test')));
                $r['delete_link'] = './?object=someobject&action=someaction';
        Severity: Major
        Found in .dev/tests/unit/class_form_test.Test.php and 4 other locations - About 1 hr to fix
        .dev/tests/unit/class_form_test.Test.php on lines 481..487
        .dev/tests/unit/class_form_test.Test.php on lines 492..498
        .dev/tests/unit/class_form_test.Test.php on lines 506..512
        .dev/tests/unit/class_form_test.Test.php on lines 513..519

        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 108.

        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 5 locations. Consider refactoring.
        Open

            public function test_tbl_link_clone()
            {
                $this->assertEquals('<a name="Clone" class="btn btn-default btn-mini btn-xs ajax_clone"><i class="icon-code-fork fa fa-code-fork"></i> Clone</a>', trim(self::form_no_chain($r)->tbl_link_clone()));
                $this->assertEquals('<a name="test" class="btn btn-default btn-mini btn-xs ajax_clone"><i class="icon-code-fork fa fa-code-fork"></i> test</a>', trim(self::form_no_chain($r)->tbl_link_clone('test')));
                $r['clone_link'] = './?object=someobject&action=someaction';
        Severity: Major
        Found in .dev/tests/unit/class_form_test.Test.php and 4 other locations - About 1 hr to fix
        .dev/tests/unit/class_form_test.Test.php on lines 481..487
        .dev/tests/unit/class_form_test.Test.php on lines 492..498
        .dev/tests/unit/class_form_test.Test.php on lines 499..505
        .dev/tests/unit/class_form_test.Test.php on lines 513..519

        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 108.

        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 5 locations. Consider refactoring.
        Open

            public function test_tbl_link_edit()
            {
                $this->assertEquals('<a name="Edit" class="btn btn-default btn-mini btn-xs ajax_edit"><i class="icon-edit fa fa-edit"></i> Edit</a>', trim(self::form_no_chain($r)->tbl_link_edit()));
                $this->assertEquals('<a name="test" class="btn btn-default btn-mini btn-xs ajax_edit"><i class="icon-edit fa fa-edit"></i> test</a>', trim(self::form_no_chain($r)->tbl_link_edit('test')));
                $r['edit_link'] = './?object=someobject&action=someaction';
        Severity: Major
        Found in .dev/tests/unit/class_form_test.Test.php and 4 other locations - About 1 hr to fix
        .dev/tests/unit/class_form_test.Test.php on lines 481..487
        .dev/tests/unit/class_form_test.Test.php on lines 499..505
        .dev/tests/unit/class_form_test.Test.php on lines 506..512
        .dev/tests/unit/class_form_test.Test.php on lines 513..519

        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 108.

        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 5 locations. Consider refactoring.
        Open

            public function test_info_link()
            {
                $this->assertEquals('<span class=" label label-info"></span>', trim(self::form_no_chain($r)->info_link()));
                $this->assertEquals('<span class=" label label-info"></span>', trim(self::form_no_chain($r)->info_link('test')));
                $r['test'] = './?object=someobject&action=someaction';
        Severity: Major
        Found in .dev/tests/unit/class_form_test.Test.php and 4 other locations - About 1 hr to fix
        .dev/tests/unit/class_form_test.Test.php on lines 492..498
        .dev/tests/unit/class_form_test.Test.php on lines 499..505
        .dev/tests/unit/class_form_test.Test.php on lines 506..512
        .dev/tests/unit/class_form_test.Test.php on lines 513..519

        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 108.

        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 2 locations. Consider refactoring.
        Open

                $this->assertEquals('<span class="my_stacked_class"><input name="name" type="text" id="name" class="form-control" placeholder="' . $desc . '" value="' . $r['name'] . '">' . PHP_EOL . '</span>', trim(form($r, ['no_form' => 1])->text('name', ['desc' => $desc, 'stacked' => ['class' => 'my_stacked_class']])));
        Severity: Minor
        Found in .dev/tests/unit/class_form_test.Test.php and 1 other location - About 35 mins to fix
        .dev/tests/unit/class_form_test.Test.php on lines 545..545

        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 92.

        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 2 locations. Consider refactoring.
        Open

                $this->assertEquals('<span class="stacked-item my_stacked_class"><input name="name" type="text" id="name" class="form-control" placeholder="' . $desc . '" value="' . $r['name'] . '">' . PHP_EOL . '</span>', trim(form($r, ['no_form' => 1])->text('name', ['desc' => $desc, 'stacked' => ['class_add' => 'my_stacked_class']])));
        Severity: Minor
        Found in .dev/tests/unit/class_form_test.Test.php and 1 other location - About 35 mins to fix
        .dev/tests/unit/class_form_test.Test.php on lines 543..543

        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 92.

        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