YetiForceCompany/YetiForceCRM

View on GitHub
tests/App/TextUtils.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

Avoid using static access to class '\Tests\Base\C_RecordActions' in method 'testTextTruncate'.
Open

        $this->assertSame(13, \strlen(\App\TextUtils::textTruncate(\Tests\Base\C_RecordActions::createLoremIpsumText(), 10, true)), 'string should be truncated in expexted format (text length: 10)');
Severity: Minor
Found in tests/App/TextUtils.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\Tests\Base\C_RecordActions' in method 'testHtmlTruncateByWords'.
Open

        $this->assertSame(15, \strlen(strip_tags(\App\TextUtils::htmlTruncateByWords(\Tests\Base\C_RecordActions::createLoremIpsumHtml(), 40, ''))), 'html should be truncated in expected format (text length: 10)');
Severity: Minor
Found in tests/App/TextUtils.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\Tests\Base\C_RecordActions' in method 'testHtmlTruncate'.
Open

        $htmlTruncate = \App\TextUtils::htmlTruncate(\Tests\Base\C_RecordActions::createLoremIpsumHtml(), 200);
Severity: Minor
Found in tests/App/TextUtils.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\App\TextUtils' in method 'testTextLength'.
Open

        $this->assertSame(0, \App\TextUtils::getTextLength(null));
Severity: Minor
Found in tests/App/TextUtils.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\App\TextUtils' in method 'testHtmlTruncateByWords'.
Open

        $this->assertSame(15, \strlen(strip_tags(\App\TextUtils::htmlTruncateByWords(\Tests\Base\C_RecordActions::createLoremIpsumHtml(), 40, ''))), 'html should be truncated in expected format (text length: 10)');
Severity: Minor
Found in tests/App/TextUtils.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\App\TextUtils' in method 'testTextLength'.
Open

        $this->assertSame(4, \App\TextUtils::getTextLength('test'));
Severity: Minor
Found in tests/App/TextUtils.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\App\TextUtils' in method 'testTextTruncate'.
Open

        $this->assertSame((\App\Config::main('listview_max_textlength') + 3), \strlen(\App\TextUtils::textTruncate(\Tests\Base\C_RecordActions::createLoremIpsumText(), false, true)), 'string should be truncated in expexted format (default length)');
Severity: Minor
Found in tests/App/TextUtils.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\App\TextUtils' in method 'testGetTagAttributes'.
Open

        $attributes = \App\TextUtils::getTagAttributes('<yetiforce type="Documents" crm-id="448" attachment-id="19"></yetiforce>');
Severity: Minor
Found in tests/App/TextUtils.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\Tests\Base\C_RecordActions' in method 'testTextTruncate'.
Open

        $this->assertSame((\App\Config::main('listview_max_textlength') + 3), \strlen(\App\TextUtils::textTruncate(\Tests\Base\C_RecordActions::createLoremIpsumText(), false, true)), 'string should be truncated in expexted format (default length)');
Severity: Minor
Found in tests/App/TextUtils.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\App\Config' in method 'testTextTruncate'.
Open

        $this->assertSame((\App\Config::main('listview_max_textlength') + 3), \strlen(\App\TextUtils::textTruncate(\Tests\Base\C_RecordActions::createLoremIpsumText(), false, true)), 'string should be truncated in expexted format (default length)');
Severity: Minor
Found in tests/App/TextUtils.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\App\TextUtils' in method 'testTextTruncate'.
Open

        $this->assertSame(13, \strlen(\App\TextUtils::textTruncate(\Tests\Base\C_RecordActions::createLoremIpsumText(), 10, true)), 'string should be truncated in expexted format (text length: 10)');
Severity: Minor
Found in tests/App/TextUtils.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\App\TextUtils' in method 'testHtmlTruncate'.
Open

        $htmlTruncate = \App\TextUtils::htmlTruncate(\Tests\Base\C_RecordActions::createLoremIpsumHtml(), 200);
Severity: Minor
Found in tests/App/TextUtils.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Call to undeclared method \Tests\App\TextUtils::assertArrayHasKey
Open

        $this->assertArrayHasKey('type', $attributes);
Severity: Critical
Found in tests/App/TextUtils.php by phan

Call to undeclared method \Tests\App\TextUtils::assertArrayHasKey
Open

        $this->assertArrayHasKey('attachment-id', $attributes);
Severity: Critical
Found in tests/App/TextUtils.php by phan

Call to undeclared method \Tests\App\TextUtils::assertSame
Open

        $this->assertSame(4, \App\TextUtils::getTextLength('test'));
Severity: Critical
Found in tests/App/TextUtils.php by phan

Call to undeclared method \Tests\App\TextUtils::assertNotEmpty
Open

        $this->assertNotEmpty($attributes);
Severity: Critical
Found in tests/App/TextUtils.php by phan

Call to undeclared method \Tests\App\TextUtils::assertSame
Open

        $this->assertSame(13, \strlen(\App\TextUtils::textTruncate(\Tests\Base\C_RecordActions::createLoremIpsumText(), 10, true)), 'string should be truncated in expexted format (text length: 10)');
Severity: Critical
Found in tests/App/TextUtils.php by phan

Call to undeclared method \Tests\App\TextUtils::assertSame
Open

        $this->assertSame(15, \strlen(strip_tags(\App\TextUtils::htmlTruncateByWords(\Tests\Base\C_RecordActions::createLoremIpsumHtml(), 40, ''))), 'html should be truncated in expected format (text length: 10)');
Severity: Critical
Found in tests/App/TextUtils.php by phan

Call to undeclared method \Tests\App\TextUtils::assertSame
Open

        $this->assertSame(138, \strlen($htmlTruncate), 'html should be truncated in expected format (default length=138)');
Severity: Critical
Found in tests/App/TextUtils.php by phan

Argument 1 (text) is null but \App\TextUtils::getTextLength() takes string defined at /code/app/TextUtils.php:26
Open

        $this->assertSame(0, \App\TextUtils::getTextLength(null));
Severity: Minor
Found in tests/App/TextUtils.php by phan

Call to undeclared method \Tests\App\TextUtils::assertSame
Open

        $this->assertSame(0, \App\TextUtils::getTextLength(null));
Severity: Critical
Found in tests/App/TextUtils.php by phan

Call to undeclared method \Tests\App\TextUtils::assertArrayHasKey
Open

        $this->assertArrayHasKey('crm-id', $attributes);
Severity: Critical
Found in tests/App/TextUtils.php by phan

Call to undeclared method \Tests\App\TextUtils::assertSame
Open

        $this->assertSame((\App\Config::main('listview_max_textlength') + 3), \strlen(\App\TextUtils::textTruncate(\Tests\Base\C_RecordActions::createLoremIpsumText(), false, true)), 'string should be truncated in expexted format (default length)');
Severity: Critical
Found in tests/App/TextUtils.php by phan

Call to undeclared method \Tests\App\TextUtils::assertSame
Open

        $this->assertSame(18, \strlen(strip_tags($htmlTruncate)), 'html should be truncated in expected format (length=18)');
Severity: Critical
Found in tests/App/TextUtils.php by phan

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Line exceeds 120 characters; contains 131 characters
Open

        $attributes = \App\TextUtils::getTagAttributes('<yetiforce type="Documents" crm-id="448" attachment-id="19"></yetiforce>');
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @see \App\TextUtils::getTagAttributes()
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function testTextTruncate()
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @see \App\TextUtils::htmlTruncate()
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function testHtmlTruncate()
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Tests `\App\TextUtils::textTruncate` methods.
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Line exceeds 120 characters; contains 125 characters
Open

        $this->assertSame(18, \strlen(strip_tags($htmlTruncate)), 'html should be truncated in expected format (length=18)');
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @see \App\TextUtils::htmlTruncateByWords()
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Tests `\App\TextUtils::getTagAttributes` methods.
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->assertSame(0, \App\TextUtils::getTextLength(null));
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->assertSame(4, \App\TextUtils::getTextLength('test'));
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->assertSame((\App\Config::main('listview_max_textlength') + 3), \strlen(\App\TextUtils::textTruncate(\Tests\Base\C_RecordActions::createLoremIpsumText(), false, true)), 'string should be truncated in expexted format (default length)');
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->assertArrayHasKey('crm-id', $attributes);
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function testTextLength()
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @see \App\TextUtils::textTruncate()
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->assertNotEmpty($attributes);
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @see \App\TextUtils::getTextLength()
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Tests `\App\TextUtils::htmlTruncateByWords` methods.
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Tests `\App\TextUtils::htmlTruncate` methods.
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Line exceeds 120 characters; contains 214 characters
Open

        $this->assertSame(15, \strlen(strip_tags(\App\TextUtils::htmlTruncateByWords(\Tests\Base\C_RecordActions::createLoremIpsumHtml(), 40, ''))), 'html should be truncated in expected format (text length: 10)');
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->assertSame(15, \strlen(strip_tags(\App\TextUtils::htmlTruncateByWords(\Tests\Base\C_RecordActions::createLoremIpsumHtml(), 40, ''))), 'html should be truncated in expected format (text length: 10)');
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Line exceeds 120 characters; contains 123 characters
Open

        $this->assertSame(138, \strlen($htmlTruncate), 'html should be truncated in expected format (default length=138)');
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->assertArrayHasKey('type', $attributes);
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Tests `\App\TextUtils::getTextLength` methods.
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function testHtmlTruncateByWords()
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $htmlTruncate = \App\TextUtils::htmlTruncate(\Tests\Base\C_RecordActions::createLoremIpsumHtml(), 200);
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Line exceeds 120 characters; contains 249 characters
Open

        $this->assertSame((\App\Config::main('listview_max_textlength') + 3), \strlen(\App\TextUtils::textTruncate(\Tests\Base\C_RecordActions::createLoremIpsumText(), false, true)), 'string should be truncated in expexted format (default length)');
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->assertSame(13, \strlen(\App\TextUtils::textTruncate(\Tests\Base\C_RecordActions::createLoremIpsumText(), 10, true)), 'string should be truncated in expexted format (text length: 10)');
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $attributes = \App\TextUtils::getTagAttributes('<yetiforce type="Documents" crm-id="448" attachment-id="19"></yetiforce>');
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Line exceeds 120 characters; contains 199 characters
Open

        $this->assertSame(13, \strlen(\App\TextUtils::textTruncate(\Tests\Base\C_RecordActions::createLoremIpsumText(), 10, true)), 'string should be truncated in expexted format (text length: 10)');
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->assertSame(18, \strlen(strip_tags($htmlTruncate)), 'html should be truncated in expected format (length=18)');
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->assertSame(138, \strlen($htmlTruncate), 'html should be truncated in expected format (default length=138)');
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function testGetTagAttributes()
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->assertArrayHasKey('attachment-id', $attributes);
Severity: Minor
Found in tests/App/TextUtils.php by phpcodesniffer

There are no issues that match your filters.

Category
Status