Skip to content

Commit 26ae128

Browse files
Merge branch '4.1' into 4.2
* 4.1: Bump phpunit bridge cache id [appveyor] fix create-project phpunit Fix HttpKernel Debug requirement Fix heredoc use final annotation to allow mocking the class synchronise the form builder docblock Grammar fix in exception message fix tests forward the parse error to the calling code [Debug][DebugClassLoader] Match more cases for final, deprecated and internal classes / methods extends ensure compatibility with older PHPUnit mocks [Security] Do not mix usage of password_*() functions and sodium_*() ones
2 parents be39df1 + 03bab85 commit 26ae128

File tree

6 files changed

+10
-27
lines changed

6 files changed

+10
-27
lines changed

ResolvedFormType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public function getOptionsResolver()
205205
* Override this method if you want to customize the builder class.
206206
*
207207
* @param string $name The name of the builder
208-
* @param string $dataClass The data class
208+
* @param string|null $dataClass The data class
209209
* @param FormFactoryInterface $factory The current form factory
210210
* @param array $options The builder options
211211
*

Test/TypeTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected function setUp()
3232
parent::setUp();
3333

3434
$this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
35-
$this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory);
35+
$this->builder = new FormBuilder('', null, $this->dispatcher, $this->factory);
3636
}
3737

3838
protected function tearDown()

Tests/AbstractFormTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ abstract protected function createForm();
5555
/**
5656
* @param string $name
5757
* @param EventDispatcherInterface $dispatcher
58-
* @param string $dataClass
58+
* @param string|null $dataClass
5959
* @param array $options
6060
*
6161
* @return FormBuilder

Tests/ButtonTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ public function testSetParentOnSubmittedButton()
4141

4242
$button->submit('');
4343

44-
$button->setParent($this->getFormBuilder('form')->getForm());
44+
$button->setParent($this->getFormBuilder()->getForm());
4545
}
4646

4747
/**
4848
* @dataProvider getDisabledStates
4949
*/
5050
public function testDisabledIfParentIsDisabled($parentDisabled, $buttonDisabled, $result)
5151
{
52-
$form = $this->getFormBuilder('form')
52+
$form = $this->getFormBuilder()
5353
->setDisabled($parentDisabled)
5454
->getForm()
5555
;
@@ -80,8 +80,8 @@ private function getButtonBuilder($name)
8080
return new ButtonBuilder($name);
8181
}
8282

83-
private function getFormBuilder($name)
83+
private function getFormBuilder()
8484
{
85-
return new FormBuilder($name, null, $this->dispatcher, $this->factory);
85+
return new FormBuilder('form', null, $this->dispatcher, $this->factory);
8686
}
8787
}

Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ protected function setUp()
2828
$this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
2929
$this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
3030
$this->tokenManager = $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock();
31-
$this->form = $this->getBuilder('post')
31+
$this->form = $this->getBuilder()
3232
->setDataMapper($this->getDataMapper())
3333
->getForm();
3434
}
@@ -41,14 +41,9 @@ protected function tearDown()
4141
$this->form = null;
4242
}
4343

44-
protected function getBuilder($name = 'name')
44+
protected function getBuilder()
4545
{
46-
return new FormBuilder($name, null, $this->dispatcher, $this->factory, ['compound' => true]);
47-
}
48-
49-
protected function getForm($name = 'name')
50-
{
51-
return $this->getBuilder($name)->getForm();
46+
return new FormBuilder('post', null, $this->dispatcher, $this->factory, ['compound' => true]);
5247
}
5348

5449
protected function getDataMapper()

Tests/ResolvedFormTypeTest.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Form\Tests;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use Symfony\Component\Form\FormBuilder;
1615
use Symfony\Component\Form\FormTypeExtensionInterface;
1716
use Symfony\Component\Form\FormTypeInterface;
1817
use Symfony\Component\Form\ResolvedFormType;
@@ -380,15 +379,4 @@ private function getMockFormFactory()
380379
{
381380
return $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
382381
}
383-
384-
/**
385-
* @param string $name
386-
* @param array $options
387-
*
388-
* @return FormBuilder
389-
*/
390-
protected function getBuilder($name = 'name', array $options = [])
391-
{
392-
return new FormBuilder($name, null, $this->dispatcher, $this->factory, $options);
393-
}
394382
}

0 commit comments

Comments
 (0)