Skip to content

Commit

Permalink
relax some assertions to make tests forward compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Jul 24, 2019
1 parent 83e7b45 commit c0eed67
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Expand Up @@ -848,7 +848,8 @@ public function testPreferredChoices()
]);

$this->assertEquals([3 => new ChoiceView($entity3, '3', 'Baz'), 2 => new ChoiceView($entity2, '2', 'Bar')], $field->createView()->vars['preferred_choices']);
$this->assertEquals([1 => new ChoiceView($entity1, '1', 'Foo')], $field->createView()->vars['choices']);
$this->assertArrayHasKey(1, $field->createView()->vars['choices']);
$this->assertEquals(new ChoiceView($entity1, '1', 'Foo'), $field->createView()->vars['choices'][1]);
}

public function testOverrideChoicesWithPreferredChoices()
Expand All @@ -868,7 +869,8 @@ public function testOverrideChoicesWithPreferredChoices()
]);

$this->assertEquals([3 => new ChoiceView($entity3, '3', 'Baz')], $field->createView()->vars['preferred_choices']);
$this->assertEquals([2 => new ChoiceView($entity2, '2', 'Bar')], $field->createView()->vars['choices']);
$this->assertArrayHasKey(2, $field->createView()->vars['choices']);
$this->assertEquals(new ChoiceView($entity2, '2', 'Bar'), $field->createView()->vars['choices'][2]);
}

public function testDisallowChoicesThatAreNotIncludedChoicesSingleIdentifier()
Expand Down
Expand Up @@ -404,7 +404,6 @@ public function testSingleChoiceWithPreferred()
/following-sibling::option[@disabled="disabled"][not(@selected)][.="-- sep --"]
/following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
]
[count(./option)=3]
'
);
}
Expand All @@ -427,7 +426,6 @@ public function testSingleChoiceWithPreferredAndNoSeparator()
./option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
/following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
]
[count(./option)=2]
'
);
}
Expand All @@ -451,7 +449,6 @@ public function testSingleChoiceWithPreferredAndBlankSeparator()
/following-sibling::option[@disabled="disabled"][not(@selected)][.=""]
/following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
]
[count(./option)=3]
'
);
}
Expand All @@ -468,7 +465,6 @@ public function testChoiceWithOnlyPreferred()
$this->assertWidgetMatchesXpath($form->createView(), ['attr' => ['class' => 'my&class']],
'/select
[@class="my&class form-control"]
[count(./option)=2]
'
);
}
Expand Down

0 comments on commit c0eed67

Please sign in to comment.