|
1 | 1 | <?php |
2 | 2 |
|
3 | 3 | /** |
4 | | - * Test: Nette\Forms success callback takes $form and $values parameters. |
| 4 | + * Test: Nette\Forms success and validate callback takes $form and $values parameters. |
5 | 5 | */ |
6 | 6 |
|
7 | 7 | use Nette\Utils\ArrayHash; |
@@ -67,16 +67,19 @@ $f3 = function ($form, $values) use (& $types) { |
67 | 67 | $f4 = function ($form, $values) use (& $types) { |
68 | 68 | $values->text = 'b'; |
69 | 69 | }; |
70 | | -$arrayHashIsImmutable = FALSE; |
| 70 | +$arrayHashIsImmutable = array(); |
71 | 71 | $f5 = function ($form, $values) use (& $arrayHashIsImmutable) { |
72 | | - $arrayHashIsImmutable = $values->text === 'a'; |
| 72 | + $arrayHashIsImmutable[] = $values->text === 'a'; |
73 | 73 | }; |
74 | 74 |
|
75 | 75 | foreach (array($m1, $m2, $m3, $f1, $f2, $f3, $f4, $f5) as $f) { |
76 | 76 | $form->onSuccess[] = $f; |
77 | 77 | } |
| 78 | +foreach (array($m1, $m2, $m3, $f1, $f2, $f3, $f4, $f5) as $f) { |
| 79 | + $form->onValidate[] = $f; |
| 80 | +} |
78 | 81 | $form->fireEvents(); |
79 | 82 |
|
80 | | -Assert::same(TestFormCallbackParameters::$results, array(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); |
81 | | -Assert::same($types, array(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); |
82 | | -Assert::true($arrayHashIsImmutable); |
| 83 | +Assert::same(TestFormCallbackParameters::$results, array(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); |
| 84 | +Assert::same($types, array(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); |
| 85 | +Assert::same($arrayHashIsImmutable, array(TRUE, TRUE)); |
0 commit comments