|
5 | 5 | use Barryvdh\Form\Facade\FormFactory; |
6 | 6 | use Barryvdh\Form\Tests\Types\ParentFormType; |
7 | 7 | use Barryvdh\Form\Tests\Types\UserFormType; |
| 8 | +use Illuminate\Foundation\Application; |
8 | 9 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; |
9 | 10 | use Symfony\Component\Form\FormInterface; |
10 | 11 | use Symfony\Component\HttpFoundation\Request; |
@@ -69,7 +70,12 @@ public function testInvalidEmailForm() |
69 | 70 |
|
70 | 71 | $this->assertTrue($form->isSubmitted()); |
71 | 72 | $this->assertFalse($form->isValid()); |
72 | | - $this->assertEquals('The email must be a valid email address.', $form->getErrors(true)[0]->getMessage()); |
| 73 | + |
| 74 | + if (version_compare(Application::VERSION, '10', '>=')) { |
| 75 | + $this->assertEquals('The email field must be a valid email address.', $form->getErrors(true)[0]->getMessage()); |
| 76 | + } else { |
| 77 | + $this->assertEquals('The email must be a valid email address.', $form->getErrors(true)[0]->getMessage()); |
| 78 | + } |
73 | 79 | } |
74 | 80 |
|
75 | 81 | public function testEmptyCollectionForm() |
@@ -124,10 +130,19 @@ public function testInvalidCollectionForm() |
124 | 130 | $this->assertTrue($form->isSubmitted()); |
125 | 131 | $this->assertFalse($form->isValid()); |
126 | 132 |
|
127 | | - $this->assertEqualsCanonicalizing([ |
128 | | - 'The children.1.email must be a valid email address.', |
129 | | - 'The emails.0 must be a valid email address.', |
130 | | - ], array_map(function($error) { |
| 133 | + if (version_compare(Application::VERSION, '10', '>=')) { |
| 134 | + $expected = [ |
| 135 | + 'The children.1.email field must be a valid email address.', |
| 136 | + 'The emails.0 field must be a valid email address.', |
| 137 | + ]; |
| 138 | + } else { |
| 139 | + $expected = [ |
| 140 | + 'The children.1.email must be a valid email address.', |
| 141 | + 'The emails.0 must be a valid email address.', |
| 142 | + ]; |
| 143 | + } |
| 144 | + |
| 145 | + $this->assertEqualsCanonicalizing($expected, array_map(function($error) { |
131 | 146 | return $error->getMessage(); |
132 | 147 | }, iterator_to_array($form->getErrors(true)))); |
133 | 148 | } |
|
0 commit comments