Skip to content

Commit 72749c8

Browse files
Merge branch '3.4'
* 3.4: [Bridge\Doctrine][FrameworkBundle] Deprecate some remaining uses of ContainerAwareTrait [FrameworkBundle] Fix bad interface hint in AbstractController [VarDumper] deprecate MongoCaster [HttpFoundation] deprecate using with the legacy mongo extension; use it with the mongodb/mongodb package and ext-mongodb instead Fix BC layer Reset profiler. [DI] Improve some deprecation messages [DI] remove inheritdoc from dumped container [Config] Fix dumped files invalidation by OPCache [Security] Add Guard authenticator <supports> method [Cache] Fix race condition in TagAwareAdapter [DI] Allow setting any public non-initialized services [Yaml] parse references on merge keys treat trailing backslashes in multi-line strings [FrameworkBundle] Expose dotenv in bin/console about fix refreshing line numbers for the inline parser fix version in changelog [FrameworkBundle] Make Controller helpers final [DoctrineBridge] Deprecate DbalSessionHandler
2 parents 6587e56 + 6ee0022 commit 72749c8

File tree

2 files changed

+41
-5
lines changed

2 files changed

+41
-5
lines changed

Extension/DataCollector/FormDataCollector.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,8 @@ public function __construct(FormDataExtractorInterface $dataExtractor)
7474
}
7575

7676
$this->dataExtractor = $dataExtractor;
77-
$this->data = array(
78-
'forms' => array(),
79-
'forms_by_hash' => array(),
80-
'nb_errors' => 0,
81-
);
77+
78+
$this->reset();
8279
}
8380

8481
/**
@@ -88,6 +85,15 @@ public function collect(Request $request, Response $response, \Exception $except
8885
{
8986
}
9087

88+
public function reset()
89+
{
90+
$this->data = array(
91+
'forms' => array(),
92+
'forms_by_hash' => array(),
93+
'nb_errors' => 0,
94+
);
95+
}
96+
9197
/**
9298
* {@inheritdoc}
9399
*/

Tests/Extension/DataCollector/FormDataCollectorTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,36 @@ public function testCollectSubmittedDataExpandedFormsErrors()
695695
$this->assertFalse(isset($child21Data['has_children_error']), 'The leaf data does not contains "has_children_error" property.');
696696
}
697697

698+
public function testReset()
699+
{
700+
$form = $this->createForm('my_form');
701+
702+
$this->dataExtractor->expects($this->any())
703+
->method('extractConfiguration')
704+
->will($this->returnValue(array()));
705+
$this->dataExtractor->expects($this->any())
706+
->method('extractDefaultData')
707+
->will($this->returnValue(array()));
708+
$this->dataExtractor->expects($this->any())
709+
->method('extractSubmittedData')
710+
->with($form)
711+
->will($this->returnValue(array('errors' => array('baz'))));
712+
713+
$this->dataCollector->buildPreliminaryFormTree($form);
714+
$this->dataCollector->collectSubmittedData($form);
715+
716+
$this->dataCollector->reset();
717+
718+
$this->assertSame(
719+
array(
720+
'forms' => array(),
721+
'forms_by_hash' => array(),
722+
'nb_errors' => 0,
723+
),
724+
$this->dataCollector->getData()
725+
);
726+
}
727+
698728
private function createForm($name)
699729
{
700730
$builder = new FormBuilder($name, null, $this->dispatcher, $this->factory);

0 commit comments

Comments
 (0)