Skip to content

Commit da6aca6

Browse files
committed
minor symfony#32728 relax some assertions to make tests forward compatible (xabbuh)
This PR was merged into the 3.4 branch. Discussion ---------- relax some assertions to make tests forward compatible | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Commits ------- c0eed67 relax some assertions to make tests forward compatible
2 parents 83e7b45 + c0eed67 commit da6aca6

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,8 @@ public function testPreferredChoices()
848848
]);
849849

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

854855
public function testOverrideChoicesWithPreferredChoices()
@@ -868,7 +869,8 @@ public function testOverrideChoicesWithPreferredChoices()
868869
]);
869870

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

874876
public function testDisallowChoicesThatAreNotIncludedChoicesSingleIdentifier()

src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap3LayoutTest.php

-4
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,6 @@ public function testSingleChoiceWithPreferred()
404404
/following-sibling::option[@disabled="disabled"][not(@selected)][.="-- sep --"]
405405
/following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
406406
]
407-
[count(./option)=3]
408407
'
409408
);
410409
}
@@ -427,7 +426,6 @@ public function testSingleChoiceWithPreferredAndNoSeparator()
427426
./option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
428427
/following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
429428
]
430-
[count(./option)=2]
431429
'
432430
);
433431
}
@@ -451,7 +449,6 @@ public function testSingleChoiceWithPreferredAndBlankSeparator()
451449
/following-sibling::option[@disabled="disabled"][not(@selected)][.=""]
452450
/following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
453451
]
454-
[count(./option)=3]
455452
'
456453
);
457454
}
@@ -468,7 +465,6 @@ public function testChoiceWithOnlyPreferred()
468465
$this->assertWidgetMatchesXpath($form->createView(), ['attr' => ['class' => 'my&class']],
469466
'/select
470467
[@class="my&class form-control"]
471-
[count(./option)=2]
472468
'
473469
);
474470
}

0 commit comments

Comments
 (0)