open-orchestra/open-orchestra-cms-bundle

View on GitHub
Workflow/Tests/Form/Type/StatusTypeTest.php

Summary

Maintainability
A
45 mins
Test Coverage

Method testBuildView has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function testBuildView($isInitial, $isTranslation, $isPublished, $isautoPublish, $isAutounpublish, array $expectedProperties)
Severity: Minor
Found in Workflow/Tests/Form/Type/StatusTypeTest.php - About 45 mins to fix

Avoid using static access to class '\Phake' in method 'testBuilder'.
Open

        $builder = Phake::mock('Symfony\Component\Form\FormBuilder');

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 '\Phake' in method 'testConfigureOptions'.
Open

        $resolver = Phake::mock('Symfony\Component\OptionsResolver\OptionsResolver');

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 '\Phake' in method 'testBuildView'.
Open

        $view = Phake::mock('Symfony\Component\Form\FormView');

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 '\Phake' in method 'testBuildView'.
Open

        $form = Phake::mock('Symfony\Component\Form\FormInterface');

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 '\Phake' in method 'testBuilder'.
Open

        Phake::when($builder)->addEventSubscriber(Phake::anyParameters())->thenReturn($builder);

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 '\Phake' in method 'testBuilder'.
Open

        Phake::when($builder)->add(Phake::anyParameters())->thenReturn($builder);

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 '\Phake' in method 'testBuilder'.
Open

        Phake::verify($builder, Phake::times(5))->add(Phake::anyParameters());

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 '\Phake' in method 'testBuildView'.
Open

        $status = Phake::mock('OpenOrchestra\ModelInterface\Model\StatusInterface');

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 '\Phake' in method 'testBuilder'.
Open

        Phake::verify($builder, Phake::times(5))->add(Phake::anyParameters());

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 \OpenOrchestra\Workflow\Tests\Form\Type\StatusTypeTest::assertSame
Open

        $this->assertSame('test', $view->vars['delete_help_text']);

Call to method mock from undeclared class \Phake
Open

        $resolver = Phake::mock('Symfony\Component\OptionsResolver\OptionsResolver');

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($builder)->addEventSubscriber(Phake::anyParameters())->thenReturn($builder);

Call to undeclared method \OpenOrchestra\Workflow\Tests\Form\Type\StatusTypeTest::assertInstanceOf
Open

        $this->assertInstanceOf('Symfony\Component\Form\AbstractType', $this->form);

Call to method when from undeclared class \Phake
Open

        Phake::when($status)->isAutoUnpublishToState()->thenReturn($isAutounpublish);

Call to method when from undeclared class \Phake
Open

        Phake::when($form)->getData()->thenReturn($status);

Call to method when from undeclared class \Phake
Open

        Phake::when($status)->isInitialState()->thenReturn($isInitial);

Call to method mock from undeclared class \Phake
Open

        $view = Phake::mock('Symfony\Component\Form\FormView');

Call to undeclared method \OpenOrchestra\Workflow\Tests\Form\Type\StatusTypeTest::assertTrue
Open

        $this->assertTrue($view->vars['enable_delete_button']);

Class extends undeclared class \OpenOrchestra\BaseBundle\Tests\AbstractTest\AbstractBaseTestCase
Open

class StatusTypeTest extends AbstractBaseTestCase

Call to method verify from undeclared class \Phake
Open

        Phake::verify($builder, Phake::times(5))->add(Phake::anyParameters());

Call to undeclared method \OpenOrchestra\Workflow\Tests\Form\Type\StatusTypeTest::assertSame
Open

        $this->assertSame(true, isset($view->vars['properties']));

Call to undeclared method \OpenOrchestra\Workflow\Tests\Form\Type\StatusTypeTest::assertSame
Open

        $this->assertSame($expectedProperties, $view->vars['properties']);

Call to method mock from undeclared class \Phake
Open

        $builder = Phake::mock('Symfony\Component\Form\FormBuilder');

Call to method anyParameters from undeclared class \Phake
Open

        Phake::verify($builder, Phake::times(5))->add(Phake::anyParameters());

Call to method mock from undeclared class \Phake
Open

        $form = Phake::mock('Symfony\Component\Form\FormInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($status)->isPublishedState()->thenReturn($isPublished);

Call to method when from undeclared class \Phake
Open

        Phake::when($builder)->add(Phake::anyParameters())->thenReturn($builder);

Call to method times from undeclared class \Phake
Open

        Phake::verify($builder, Phake::times(5))->add(Phake::anyParameters());

Call to undeclared method \OpenOrchestra\Workflow\Tests\Form\Type\StatusTypeTest::assertTrue
Open

        $this->assertTrue($view->vars['delete_button']);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($resolver)->setDefaults(array(

Call to method when from undeclared class \Phake
Open

        Phake::when($status)->isTranslationState()->thenReturn($isTranslation);

Call to method when from undeclared class \Phake
Open

        Phake::when($status)->isAutoPublishFromState()->thenReturn($isautoPublish);

Call to undeclared method \OpenOrchestra\Workflow\Tests\Form\Type\StatusTypeTest::assertSame
Open

        $this->assertSame('oo_status', $this->form->getName());

Call to method when from undeclared class \Phake
Open

        Phake::when($builder)->addEventSubscriber(Phake::anyParameters())->thenReturn($builder);

Call to method mock from undeclared class \Phake
Open

        $status = Phake::mock('OpenOrchestra\ModelInterface\Model\StatusInterface');

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($builder)->add(Phake::anyParameters())->thenReturn($builder);

Call to undeclared method \OpenOrchestra\Workflow\Tests\Form\Type\StatusTypeTest::assertTrue
Open

        $this->assertTrue($view->vars['new_button']);

Line exceeds 120 characters; contains 136 characters
Open

    public function testBuildView($isInitial, $isTranslation, $isPublished, $isautoPublish, $isAutounpublish, array $expectedProperties)

Line exceeds 120 characters; contains 125 characters
Open

            array(true , true , true , true , true , array($initial, $translation, $published, $autoPublish, $autoUnpublish))

There are no issues that match your filters.

Category
Status