Skip to content

Commit

Permalink
Why not both
Browse files Browse the repository at this point in the history
  • Loading branch information
ndm2 committed Feb 25, 2015
1 parent 340ad7b commit b8e44d5
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions tests/TestCase/View/Helper/FormHelperTest.php
Expand Up @@ -4164,33 +4164,33 @@ public function testHabtmSelectBox()
*/
public function testErrorsForBelongsToManySelect()
{
$tags = [
1 => 'blue',
50 => 'green'
$spacecraft = [
1 => 'Orion',
2 => 'Helios'
];
$this->View->viewVars['tags'] = $tags;
$this->View->viewVars['spacecraft'] = $spacecraft;

$article = new Article();
$article->errors('tags', ['Invalid']);
$article->errors('spacecraft', ['Invalid']);

$this->Form->create($article);
$result = $this->Form->input('tags._ids');
$result = $this->Form->input('spacecraft._ids');

$expected = [
['div' => ['class' => 'input select error']],
'label' => ['for' => 'tags-ids'],
'Tags',
'label' => ['for' => 'spacecraft-ids'],
'Spacecraft',
'/label',
'input' => ['type' => 'hidden', 'name' => 'tags[_ids]', 'value' => ''],
'input' => ['type' => 'hidden', 'name' => 'spacecraft[_ids]', 'value' => ''],
'select' => [
'name' => 'tags[_ids][]', 'id' => 'tags-ids',
'name' => 'spacecraft[_ids][]', 'id' => 'spacecraft-ids',
'multiple' => 'multiple'
],
['option' => ['value' => '1']],
'blue',
'Orion',
'/option',
['option' => ['value' => '50']],
'green',
['option' => ['value' => '2']],
'Helios',
'/option',
'/select',
['div' => ['class' => 'error-message']],
Expand Down

0 comments on commit b8e44d5

Please sign in to comment.