You are here

public function FormTest::provideInitializeValues in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dom-crawler/Tests/FormTest.php \Symfony\Component\DomCrawler\Tests\FormTest::provideInitializeValues()

File

vendor/symfony/dom-crawler/Tests/FormTest.php, line 203

Class

FormTest

Namespace

Symfony\Component\DomCrawler\Tests

Code

public function provideInitializeValues() {
  return array(
    array(
      'does not take into account input fields without a name attribute',
      '<input type="text" value="foo" />
                 <input type="submit" />',
      array(),
    ),
    array(
      'does not take into account input fields with an empty name attribute value',
      '<input type="text" name="" value="foo" />
                 <input type="submit" />',
      array(),
    ),
    array(
      'takes into account disabled input fields',
      '<input type="text" name="foo" value="foo" disabled="disabled" />
                 <input type="submit" />',
      array(
        'foo' => array(
          'InputFormField',
          'foo',
        ),
      ),
    ),
    array(
      'appends the submitted button value',
      '<input type="submit" name="bar" value="bar" />',
      array(
        'bar' => array(
          'InputFormField',
          'bar',
        ),
      ),
    ),
    array(
      'appends the submitted button value for Button element',
      '<button type="submit" name="bar" value="bar">Bar</button>',
      array(
        'bar' => array(
          'InputFormField',
          'bar',
        ),
      ),
    ),
    array(
      'appends the submitted button value but not other submit buttons',
      '<input type="submit" name="bar" value="bar" />
                 <input type="submit" name="foobar" value="foobar" />',
      array(
        'foobar' => array(
          'InputFormField',
          'foobar',
        ),
      ),
    ),
    array(
      'turns an image input into x and y fields',
      '<input type="image" name="bar" />',
      array(
        'bar.x' => array(
          'InputFormField',
          '0',
        ),
        'bar.y' => array(
          'InputFormField',
          '0',
        ),
      ),
    ),
    array(
      'returns textareas',
      '<textarea name="foo">foo</textarea>
                 <input type="submit" />',
      array(
        'foo' => array(
          'TextareaFormField',
          'foo',
        ),
      ),
    ),
    array(
      'returns inputs',
      '<input type="text" name="foo" value="foo" />
                 <input type="submit" />',
      array(
        'foo' => array(
          'InputFormField',
          'foo',
        ),
      ),
    ),
    array(
      'returns checkboxes',
      '<input type="checkbox" name="foo" value="foo" checked="checked" />
                 <input type="submit" />',
      array(
        'foo' => array(
          'ChoiceFormField',
          'foo',
        ),
      ),
    ),
    array(
      'returns not-checked checkboxes',
      '<input type="checkbox" name="foo" value="foo" />
                 <input type="submit" />',
      array(
        'foo' => array(
          'ChoiceFormField',
          false,
        ),
      ),
    ),
    array(
      'returns radio buttons',
      '<input type="radio" name="foo" value="foo" />
                 <input type="radio" name="foo" value="bar" checked="bar" />
                 <input type="submit" />',
      array(
        'foo' => array(
          'ChoiceFormField',
          'bar',
        ),
      ),
    ),
    array(
      'returns file inputs',
      '<input type="file" name="foo" />
                 <input type="submit" />',
      array(
        'foo' => array(
          'FileFormField',
          array(
            'name' => '',
            'type' => '',
            'tmp_name' => '',
            'error' => 4,
            'size' => 0,
          ),
        ),
      ),
    ),
  );
}