FluidTYPO3\Flux\Tests\Unit\Form\AbstractFormTest::canChainAllChainableSetters PHP Method

canChainAllChainableSetters() public method

public canChainAllChainableSetters ( array $chainPropertiesAndValues = NULL ) : FluidTYPO3\Flux\Form\FieldInterface
$chainPropertiesAndValues array
return FluidTYPO3\Flux\Form\FieldInterface
    public function canChainAllChainableSetters($chainPropertiesAndValues = NULL)
    {
        if (NULL === $chainPropertiesAndValues) {
            $chainPropertiesAndValues = $this->chainProperties;
        }
        $instance = $this->createInstance();
        foreach ($chainPropertiesAndValues as $propertyName => $propertValue) {
            $setterMethodName = ObjectAccess::buildSetterMethodName($propertyName);
            $chained = call_user_func_array(array($instance, $setterMethodName), array($propertValue));
            $this->assertSame($instance, $chained, 'The setter ' . $setterMethodName . ' on ' . $this->getObjectClassName() . ' does not support chaining.');
            if ($chained === $instance) {
                $instance = $chained;
            }
        }
        return $instance;
    }