array('for' => 'contact-email'),
'Email',
'/label',
array('input' => array(
'type' => 'email', 'name' => 'Contact[email]',
'id' => 'contact-email', 'maxlength' => 255
)),
'/div'
);
$this->assertTags($result, $expected);
$result = $this->Form->input('Contact.email', array('type' => 'text'));
$expected = array(
'div' => array('class' => 'input text'),
'label' => array('for' => 'contact-email'),
'Email',
'/label',
array('input' => array(
'type' => 'text', 'name' => 'Contact[email]',
'id' => 'contact-email', 'maxlength' => '255'
)),
'/div'
);
$this->assertTags($result, $expected);
$result = $this->Form->input('Contact.5.email', array('type' => 'text'));
$expected = array(
'div' => array('class' => 'input text'),
'label' => array('for' => 'contact-5-email'),
'Email',
'/label',
array('input' => array(
'type' => 'text', 'name' => 'Contact[5][email]',
'id' => 'contact-5-email', 'maxlength' => '255'
)),
'/div'
);
$this->assertTags($result, $expected);
$result = $this->Form->input('Contact.password');
$expected = array(
'div' => array('class' => 'input password'),
'label' => array('for' => 'contact-password'),
'Password',
'/label',
array('input' => array(
'type' => 'password', 'name' => 'Contact[password]',
'id' => 'contact-password'
)),
'/div'
);
$this->assertTags($result, $expected);
$result = $this->Form->input('Contact.email', array(
'type' => 'file', 'class' => 'textbox'
));
$expected = array(
'div' => array('class' => 'input file'),
'label' => array('for' => 'contact-email'),
'Email',
'/label',
array('input' => array(
'type' => 'file', 'name' => 'Contact[email]', 'class' => 'textbox',
'id' => 'contact-email'
)),
'/div'
);
$this->assertTags($result, $expected);
$entity = new Entity(['phone' => 'Hello & World > weird chars']);
$this->Form->create($entity, ['context' => ['table' => 'Contacts']]);
$result = $this->Form->input('Contact.phone');
$expected = array(
'div' => array('class' => 'input tel'),
'label' => array('for' => 'contact-phone'),
'Phone',
'/label',
array('input' => array(
'type' => 'tel', 'name' => 'Contact[phone]',
'value' => 'Hello & World > weird chars',
'id' => 'contact-phone', 'maxlength' => 255
)),
'/div'
);
$this->assertTags($result, $expected);
$this->Form->request->data['Model']['0']['OtherModel']['field'] = 'My value';
$this->Form->create();
$result = $this->Form->input('Model.0.OtherModel.field', array('id' => 'myId'));
$expected = array(
'div' => array('class' => 'input text'),
'label' => array('for' => 'myId'),
'Field',
'/label',
'input' => array(
'type' => 'text', 'name' => 'Model[0][OtherModel][field]',
'value' => 'My value', 'id' => 'myId'
),
'/div'
);
$this->assertTags($result, $expected);
$this->Form->request->data = [];
$entity->errors('field', 'Badness!');
$this->Form->create($entity, ['context' => ['table' => 'Contacts']]);
$result = $this->Form->input('Contact.field');
$expected = array(
'div' => array('class' => 'input text error'),
'label' => array('for' => 'contact-field'),
'Field',
'/label',
'input' => array(
'type' => 'text', 'name' => 'Contact[field]',
'id' => 'contact-field', 'class' => 'form-error'
),
array('div' => array('class' => 'error-message')),
'Badness!',
'/div',
'/div'
);
$this->assertTags($result, $expected);
$result = $this->Form->input('Contact.field', array(
'templates' => [
'groupContainerError' => '{{content}}{{error}}',
'error' => '
{{content}}'
]
));
$expected = array(
'label' => array('for' => 'contact-field'),
'Field',
'/label',
'input' => array(
'type' => 'text', 'name' => 'Contact[field]',
'id' => 'contact-field', 'class' => 'form-error'
),
array('span' => array('class' => 'error-message')),
'Badness!',
'/span'
);
$this->assertTags($result, $expected);
$entity->errors('field', ['minLength']);
$result = $this->Form->input('Contact.field', array(
'error' => array(
'minLength' => 'Le login doit contenir au moins 2 caractères',
'maxLength' => 'login too large'
)
));
$expected = array(
'div' => array('class' => 'input text error'),
'label' => array('for' => 'contact-field'),
'Field',
'/label',
'input' => array('type' => 'text', 'name' => 'Contact[field]', 'id' => 'contact-field', 'class' => 'form-error'),
array('div' => array('class' => 'error-message')),
'Le login doit contenir au moins 2 caractères',
'/div',
'/div'
);
$this->assertTags($result, $expected);
$entity->errors('field', ['maxLength']);
$result = $this->Form->input('Contact.field', array(
'error' => array(
'minLength' => 'Le login doit contenir au moins 2 caractères',
'maxLength' => 'login too large',
)
));
$expected = array(
'div' => array('class' => 'input text error'),
'label' => array('for' => 'contact-field'),
'Field',
'/label',
'input' => array('type' => 'text', 'name' => 'Contact[field]', 'id' => 'contact-field', 'class' => 'form-error'),
array('div' => array('class' => 'error-message')),
'login too large',
'/div',
'/div'
);
$this->assertTags($result, $expected);
}
/**
* Test id prefix
*
* @return void
*/
public function testCreateIdPrefix() {
$this->Form->create(false, ['idPrefix' => 'prefix']);
$result = $this->Form->input('field');
$expected = [
'div' => ['class' => 'input text'],
'label' => ['for' => 'prefix-field'],
'Field',
'/label',
'input' => ['type' => 'text', 'name' => 'field', 'id' => 'prefix-field'],
'/div'
];
$this->assertTags($result, $expected);
$result = $this->Form->input('field', ['id' => 'custom-id']);
$expected = [
'div' => ['class' => 'input text'],
'label' => ['for' => 'custom-id'],
'Field',
'/label',
'input' => ['type' => 'text', 'name' => 'field', 'id' => 'custom-id'],
'/div'
];
$this->assertTags($result, $expected);
$result = $this->Form->radio('Model.field', ['option A']);
$expected = [
'input' => ['type' => 'hidden', 'name' => 'Model[field]', 'value' => ''],
['input' => [
'type' => 'radio',
'name' => 'Model[field]',
'value' => '0',
'id' => 'prefix-model-field-0'
]],
'label' => ['for' => 'prefix-model-field-0'],
'option A',
'/label'
];
$this->assertTags($result, $expected);
$result = $this->Form->radio('Model.field', ['option A', 'option']);
$expected = [
'input' => ['type' => 'hidden', 'name' => 'Model[field]', 'value' => ''],
['input' => [
'type' => 'radio',
'name' => 'Model[field]',
'value' => '0',
'id' => 'prefix-model-field-0'
]],
'label' => ['for' => 'prefix-model-field-0'],
'option A',
'/label'
];
$this->assertTags($result, $expected);
$result = $this->Form->select(
'Model.multi_field',
['first'],
['multiple' => 'checkbox']
);
$expected = [
'input' => [
'type' => 'hidden', 'name' => 'Model[multi_field]', 'value' => ''
],
['div' => ['class' => 'checkbox']],
['input' => [
'type' => 'checkbox', 'name' => 'Model[multi_field][]',
'value' => '0', 'id' => 'prefix-model-multi-field-0'
]],
['label' => ['for' => 'prefix-model-multi-field-0']],
'first',
'/label',
'/div',
];
$this->assertTags($result, $expected);
$this->Form->end();
$result = $this->Form->input('field');
$expected = [
'div' => ['class' => 'input text'],
'label' => ['for' => 'field'],
'Field',
'/label',
'input' => ['type' => 'text', 'name' => 'field', 'id' => 'field'],
'/div'
];
$this->assertTags($result, $expected);
}
/**
* Test that inputs with 0 can be created.
*
* @return void
*/
public function testInputZero() {
TableRegistry::get('Contacts', [
'className' => __NAMESPACE__ . '\ContactsTable'
]);
$this->Form->create([], ['context' => ['table' => 'Contacts']]);
$result = $this->Form->input('0');
$expected = array(
'div' => array('class' => 'input text'),
'label' => array('for' => '0'), '/label',
'input' => array('type' => 'text', 'name' => '0', 'id' => '0'),
'/div'
);
$this->assertTags($result, $expected);
}
/**
* test input() with checkbox creation
*
* @return void
*/
public function testInputCheckbox() {
$result = $this->Form->input('User.active', array('label' => false, 'checked' => true));
$expected = array(
'div' => array('class' => 'input checkbox'),
'input' => array('type' => 'hidden', 'name' => 'User[active]', 'value' => '0'),
array('input' => array('type' => 'checkbox', 'name' => 'User[active]', 'value' => '1', 'id' => 'user-active', 'checked' => 'checked')),
'/div'
);
$this->assertTags($result, $expected);
$result = $this->Form->input('User.active', array('label' => false, 'checked' => 1));
$expected = array(
'div' => array('class' => 'input checkbox'),
'input' => array('type' => 'hidden', 'name' => 'User[active]', 'value' => '0'),
array('input' => array('type' => 'checkbox', 'name' => 'User[active]', 'value' => '1', 'id' => 'user-active', 'checked' => 'checked')),
'/div'
);
$this->assertTags($result, $expected);
$result = $this->Form->input('User.active', array('label' => false, 'checked' => '1'));
$expected = array(
'div' => array('class' => 'input checkbox'),
'input' => array('type' => 'hidden', 'name' => 'User[active]', 'value' => '0'),
array('input' => array('type' => 'checkbox', 'name' => 'User[active]', 'value' => '1', 'id' => 'user-active', 'checked' => 'checked')),
'/div'
);
$this->assertTags($result, $expected);
$result = $this->Form->input('User.disabled', array(
'label' => 'Disabled',
'type' => 'checkbox',
'data-foo' => 'disabled'
));
$expected = array(
'div' => array('class' => 'input checkbox'),
'input' => array('type' => 'hidden', 'name' => 'User[disabled]', 'value' => '0'),
array('input' => array(
'type' => 'checkbox',
'name' => 'User[disabled]',
'value' => '1',
'id' => 'user-disabled',
'data-foo' => 'disabled'
)),
'label' => array('for' => 'user-disabled'),
'Disabled',
'/label',
'/div'
);
$this->assertTags($result, $expected);
}
/**
* Test that input() does not create wrapping div and label tag for hidden fields
*
* @return void
*/
public function testInputHidden() {
TableRegistry::get('ValidateUsers', [
'className' => __NAMESPACE__ . '\ValidateUsersTable'
]);
$this->Form->create([], ['context' => ['table' => 'ValidateUsers']]);
$result = $this->Form->input('ValidateUser.id');
$expected = array(
'input' => array('name', 'type' => 'hidden', 'id')
);
$this->assertTags($result, $expected);
$result = $this->Form->input('ValidateUser.custom', ['type' => 'hidden']);
$expected = array(
'input' => array('name', 'type' => 'hidden', 'id')
);
$this->assertTags($result, $expected);
}
/**
* test form->input() with datetime
*
* @return void
*/
public function testInputDatetime() {
$this->Form = $this->getMock(
'Cake\View\Helper\FormHelper',
['datetime'],
[new View()]
);
$this->Form->expects($this->once())->method('datetime')
->with('prueba', [
'type' => 'datetime',
'timeFormat' => 24,
'minYear' => 2008,
'maxYear' => 2011,
'interval' => 15,
'options' => null,
'empty' => false,
'id' => 'prueba',
'required' => false,
])
->will($this->returnValue('This is it!'));
$result = $this->Form->input('prueba', array(
'type' => 'datetime', 'timeFormat' => 24, 'minYear' => 2008,
'maxYear' => 2011, 'interval' => 15
));
$expected = array(
'div' => array('class' => 'input datetime'),
'label' => array('for' => 'prueba'),
'Prueba',
'/label',
'This is it!',
'/div'
);
$this->assertTags($result, $expected);
}
/**
* test form->input() with datetime with id prefix
*
* @return void
*/
public function testInputDatetimeIdPrefix() {
$this->Form = $this->getMock(
'Cake\View\Helper\FormHelper',
['datetime'],
[new View()]
);
$this->Form->create(false, ['idPrefix' => 'prefix']);
$this->Form->expects($this->once())->method('datetime')
->with('prueba', [
'type' => 'datetime',
'timeFormat' => 24,
'minYear' => 2008,
'maxYear' => 2011,
'interval' => 15,
'options' => null,
'empty' => false,
'id' => 'prefix-prueba',
'required' => false,
])
->will($this->returnValue('This is it!'));
$result = $this->Form->input('prueba', array(
'type' => 'datetime', 'timeFormat' => 24, 'minYear' => 2008,
'maxYear' => 2011, 'interval' => 15
));
$expected = array(
'div' => array('class' => 'input datetime'),
'label' => array('for' => 'prefix-prueba'),
'Prueba',
'/label',
'This is it!',
'/div'
);
$this->assertTags($result, $expected);
}
/**
* Test generating checkboxes with disabled elements.
*
* @return void
*/
public function testInputCheckboxWithDisabledElements() {
$options = array(1 => 'One', 2 => 'Two', '3' => 'Three');
$result = $this->Form->input('Contact.multiple', array(
'multiple' => 'checkbox',
'disabled' => 'disabled',
'options' => $options
));
$expected = array(
array('div' => array('class' => 'input select')),
array('label' => array('for' => "contact-multiple")),
'Multiple',
'/label',
array('input' => array('type' => 'hidden', 'name' => "Contact[multiple]", 'value' => '')),
array('div' => array('class' => 'checkbox')),
array('input' => array('type' => 'checkbox', 'name' => "Contact[multiple][]", 'value' => 1, 'disabled' => 'disabled', 'id' => "contact-multiple-1")),
array('label' => array('for' => "contact-multiple-1")),
'One',
'/label',
'/div',
array('div' => array('class' => 'checkbox')),
array('input' => array('type' => 'checkbox', 'name' => "Contact[multiple][]", 'value' => 2, 'disabled' => 'disabled', 'id' => "contact-multiple-2")),
array('label' => array('for' => "contact-multiple-2")),
'Two',
'/label',
'/div',
array('div' => array('class' => 'checkbox')),
array('input' => array('type' => 'checkbox', 'name' => "Contact[multiple][]", 'value' => 3, 'disabled' => 'disabled', 'id' => "contact-multiple-3")),
array('label' => array('for' => "contact-multiple-3")),
'Three',
'/label',
'/div',
'/div'
);
$this->assertTags($result, $expected);
// make sure 50 does only disable 50, and not 50f5c0cf
$options = array('50' => 'Fifty', '50f5c0cf' => 'Stringy');
$disabled = array(50);
$expected = array(
array('div' => array('class' => 'input select')),
array('label' => array('for' => "contact-multiple")),
'Multiple',
'/label',
array('input' => array('type' => 'hidden', 'name' => "Contact[multiple]", 'value' => '')),
array('div' => array('class' => 'checkbox')),
array('input' => array('type' => 'checkbox', 'name' => "Contact[multiple][]", 'value' => 50, 'disabled' => 'disabled', 'id' => "contact-multiple-50")),
array('label' => array('for' => "contact-multiple-50")),
'Fifty',
'/label',
'/div',
array('div' => array('class' => 'checkbox')),
array('input' => array('type' => 'checkbox', 'name' => "Contact[multiple][]", 'value' => '50f5c0cf', 'id' => "contact-multiple-50f5c0cf")),
array('label' => array('for' => "contact-multiple-50f5c0cf")),
'Stringy',
'/label',
'/div',
'/div'
);
$result = $this->Form->input('Contact.multiple', array('multiple' => 'checkbox', 'disabled' => $disabled, 'options' => $options));
$this->assertTags($result, $expected);
}
/**
* test input name with leading integer, ensure attributes are generated correctly.
*
* @return void
*/
public function testInputWithLeadingInteger() {
$result = $this->Form->text('0.Node.title');
$expected = array(
'input' => array('name' => '0[Node][title]', 'type' => 'text')
);
$this->assertTags($result, $expected);
}
/**
* test form->input() with select type inputs.
*
* @return void
*/
public function testInputSelectType() {
$result = $this->Form->input('email', array(
'options' => array('è' => 'Firést', 'é' => 'Secoènd'), 'empty' => true)
);
$expected = array(
'div' => array('class' => 'input select'),
'label' => array('for' => 'email'),
'Email',
'/label',
array('select' => array('name' => 'email', 'id' => 'email')),
array('option' => array('value' => '')),
'/option',
array('option' => array('value' => 'è')),
'Firést',
'/option',
array('option' => array('value' => 'é')),
'Secoènd',
'/option',
'/select',
'/div'
);
$this->assertTags($result, $expected);
$result = $this->Form->input('email', array(
'options' => array('First', 'Second'), 'empty' => true)
);
$expected = array(
'div' => array('class' => 'input select'),
'label' => array('for' => 'email'),
'Email',
'/label',
array('select' => array('name' => 'email', 'id' => 'email')),
array('option' => array('value' => '')),
'/option',
array('option' => array('value' => '0')),
'First',
'/option',
array('option' => array('value' => '1')),
'Second',
'/option',
'/select',
'/div'
);
$this->assertTags($result, $expected);
$result = $this->Form->input('email', [
'type' => 'select',
'options' => new \ArrayObject(['First', 'Second']),
'empty' => true
]);
$this->assertTags($result, $expected);
$this->View->viewVars['users'] = array('value' => 'good', 'other' => 'bad');
$this->Form->request->data = array('Model' => array('user_id' => 'value'));
$result = $this->Form->input('Model.user_id', array('empty' => true));
$expected = array(
'div' => array('class' => 'input select'),
'label' => array('for' => 'model-user-id'),
'User',
'/label',
'select' => array('name' => 'Model[user_id]', 'id' => 'model-user-id'),
array('option' => array('value' => '')),
'/option',
array('option' => array('value' => 'value', 'selected' => 'selected')),
'good',
'/option',
array('option' => array('value' => 'other')),
'bad',
'/option',
'/select',
'/div'
);
$this->assertTags($result, $expected);
$this->View->viewVars['users'] = array('value' => 'good', 'other' => 'bad');
$this->Form->request->data = array('Thing' => array('user_id' => null));
$result = $this->Form->input('Thing.user_id', array('empty' => 'Some Empty'));
$expected = array(
'div' => array('class' => 'input select'),
'label' => array('for' => 'thing-user-id'),
'User',
'/label',
'select' => array('name' => 'Thing[user_id]', 'id' => 'thing-user-id'),
array('option' => array('value' => '')),
'Some Empty',
'/option',
array('option' => array('value' => 'value')),
'good',
'/option',
array('option' => array('value' => 'other')),
'bad',
'/option',
'/select',
'/div'
);
$this->assertTags($result, $expected);
$this->View->viewVars['users'] = array('value' => 'good', 'other' => 'bad');
$this->Form->request->data = array('Thing' => array('user_id' => 'value'));
$result = $this->Form->input('Thing.user_id', array('empty' => 'Some Empty'));
$expected = array(
'div' => array('class' => 'input select'),
'label' => array('for' => 'thing-user-id'),
'User',
'/label',
'select' => array('name' => 'Thing[user_id]', 'id' => 'thing-user-id'),
array('option' => array('value' => '')),
'Some Empty',
'/option',
array('option' => array('value' => 'value', 'selected' => 'selected')),
'good',
'/option',
array('option' => array('value' => 'other')),
'bad',
'/option',
'/select',
'/div'
);
$this->assertTags($result, $expected);
$this->Form->data = array();
$result = $this->Form->input('Publisher.id', array(
'label' => 'Publisher',
'type' => 'select',
'multiple' => 'checkbox',
'options' => array('Value 1' => 'Label 1', 'Value 2' => 'Label 2')
));
$expected = array(
array('div' => array('class' => 'input select')),
array('label' => array('for' => 'publisher-id')),
'Publisher',
'/label',
'input' => array('type' => 'hidden', 'name' => 'Publisher[id]', 'value' => ''),
array('div' => array('class' => 'checkbox')),
array('input' => array('type' => 'checkbox', 'name' => 'Publisher[id][]', 'value' => 'Value 1', 'id' => 'publisher-id-value-1')),
array('label' => array('for' => 'publisher-id-value-1')),
'Label 1',
'/label',
'/div',
array('div' => array('class' => 'checkbox')),
array('input' => array('type' => 'checkbox', 'name' => 'Publisher[id][]', 'value' => 'Value 2', 'id' => 'publisher-id-value-2')),
array('label' => array('for' => 'publisher-id-value-2')),
'Label 2',
'/label',
'/div',
'/div'
);
$this->assertTags($result, $expected);
}
/**
* test that input() and a non standard primary key makes a hidden input by default.
*
* @return void
*/
public function testInputWithNonStandardPrimaryKeyMakesHidden() {
$this->article['schema']['_constraints']['primary']['columns'] = ['title'];
$this->Form->create($this->article);
$result = $this->Form->input('title');
$expected = array(
'input' => array('type' => 'hidden', 'name' => 'title', 'id' => 'title'),
);
$this->assertTags($result, $expected);
$this->article['schema']['_constraints']['primary']['columns'] = ['title', 'body'];
$this->Form->create($this->article);
$result = $this->Form->input('title');
$expected = array(
'input' => array('type' => 'hidden', 'name' => 'title', 'id' => 'title'),
);
$this->assertTags($result, $expected);
$result = $this->Form->input('body');
$expected = array(
'input' => array('type' => 'hidden', 'name' => 'body', 'id' => 'body'),
);
$this->assertTags($result, $expected);
}
/**
* test that overriding the magic select type widget is possible
*
* @return void
*/
public function testInputOverridingMagicSelectType() {
$this->View->viewVars['users'] = array('value' => 'good', 'other' => 'bad');
$result = $this->Form->input('Model.user_id', array('type' => 'text'));
$expected = array(
'div' => array('class' => 'input text'),
'label' => array('for' => 'model-user-id'), 'User', '/label',
'input' => array('name' => 'Model[user_id]', 'type' => 'text', 'id' => 'model-user-id'),
'/div'
);
$this->assertTags($result, $expected);
//Check that magic types still work for plural/singular vars
$this->View->viewVars['types'] = array('value' => 'good', 'other' => 'bad');
$result = $this->Form->input('Model.type');
$expected = array(
'div' => array('class' => 'input select'),
'label' => array('for' => 'model-type'), 'Type', '/label',
'select' => array('name' => 'Model[type]', 'id' => 'model-type'),
array('option' => array('value' => 'value')), 'good', '/option',
array('option' => array('value' => 'other')), 'bad', '/option',
'/select',
'/div'
);
$this->assertTags($result, $expected);
}
/**
* Test that inferred types do not override developer input
*
* @return void
*/
public function testInputMagicTypeDoesNotOverride() {
$this->View->viewVars['users'] = array('value' => 'good', 'other' => 'bad');
$result = $this->Form->input('Model.user', array('type' => 'checkbox'));
$expected = array(
'div' => array('class' => 'input checkbox'),
array('input' => array(
'type' => 'hidden',
'name' => 'Model[user]',
'value' => 0,
)),
array('input' => array(
'name' => 'Model[user]',
'type' => 'checkbox',
'id' => 'model-user',
'value' => 1
)),
'label' => array('for' => 'model-user'), 'User', '/label',
'/div'
);
$this->assertTags($result, $expected);
}
/**
* Test that magic input() selects are created for type=number
*
* @return void
*/
public function testInputMagicSelectForTypeNumber() {
TableRegistry::get('ValidateUsers', [
'className' => __NAMESPACE__ . '\ValidateUsersTable'
]);
$entity = new Entity(['balance' => 1]);
$this->Form->create($entity, ['context' => ['table' => 'ValidateUsers']]);
$this->View->viewVars['balances'] = array(0 => 'nothing', 1 => 'some', 100 => 'a lot');
$result = $this->Form->input('ValidateUser.balance');
$expected = array(
'div' => array('class' => 'input select'),
'label' => array('for' => 'validateuser-balance'),
'Balance',
'/label',
'select' => array('name' => 'ValidateUser[balance]', 'id' => 'validateuser-balance'),
array('option' => array('value' => '0')),
'nothing',
'/option',
array('option' => array('value' => '1', 'selected' => 'selected')),
'some',
'/option',
array('option' => array('value' => '100')),
'a lot',
'/option',
'/select',
'/div'
);
$this->assertTags($result, $expected);
}
/**
* Test that magic input() selects can easily be converted into radio types without error.
*
* @return void
*/
public function testInputMagicSelectChangeToRadio() {
$this->View->viewVars['users'] = array('value' => 'good', 'other' => 'bad');
$result = $this->Form->input('Model.user_id', array('type' => 'radio'));
$this->assertContains('input type="radio"', $result);
}
/**
* testFormInputs method
*
* test correct results from form::inputs().
*
* @return void
*/
public function testFormInputsLegendFieldset() {
$this->Form->create($this->article);
$result = $this->Form->allInputs([], array('legend' => 'The Legend'));
$expected = array(
'