Skip to content

Commit

Permalink
Merge branch '3.4' into 4.1
Browse files Browse the repository at this point in the history
* 3.4:
  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
  • Loading branch information
nicolas-grekas committed Jan 24, 2019
2 parents 9b97370 + b24a67f commit 03bab85
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 27 deletions.
2 changes: 1 addition & 1 deletion ResolvedFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public function getOptionsResolver()
* Override this method if you want to customize the builder class.
*
* @param string $name The name of the builder
* @param string $dataClass The data class
* @param string|null $dataClass The data class
* @param FormFactoryInterface $factory The current form factory
* @param array $options The builder options
*
Expand Down
2 changes: 1 addition & 1 deletion Test/TypeTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected function setUp()
parent::setUp();

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

protected function tearDown()
Expand Down
2 changes: 1 addition & 1 deletion Tests/AbstractFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ abstract protected function createForm();
/**
* @param string $name
* @param EventDispatcherInterface $dispatcher
* @param string $dataClass
* @param string|null $dataClass
* @param array $options
*
* @return FormBuilder
Expand Down
8 changes: 4 additions & 4 deletions Tests/ButtonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ public function testSetParentOnSubmittedButton()

$button->submit('');

$button->setParent($this->getFormBuilder('form')->getForm());
$button->setParent($this->getFormBuilder()->getForm());
}

/**
* @dataProvider getDisabledStates
*/
public function testDisabledIfParentIsDisabled($parentDisabled, $buttonDisabled, $result)
{
$form = $this->getFormBuilder('form')
$form = $this->getFormBuilder()
->setDisabled($parentDisabled)
->getForm()
;
Expand Down Expand Up @@ -80,8 +80,8 @@ private function getButtonBuilder($name)
return new ButtonBuilder($name);
}

private function getFormBuilder($name)
private function getFormBuilder()
{
return new FormBuilder($name, null, $this->dispatcher, $this->factory);
return new FormBuilder('form', null, $this->dispatcher, $this->factory);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protected function setUp()
$this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
$this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
$this->tokenManager = $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock();
$this->form = $this->getBuilder('post')
$this->form = $this->getBuilder()
->setDataMapper($this->getDataMapper())
->getForm();
}
Expand All @@ -41,14 +41,9 @@ protected function tearDown()
$this->form = null;
}

protected function getBuilder($name = 'name')
protected function getBuilder()
{
return new FormBuilder($name, null, $this->dispatcher, $this->factory, ['compound' => true]);
}

protected function getForm($name = 'name')
{
return $this->getBuilder($name)->getForm();
return new FormBuilder('post', null, $this->dispatcher, $this->factory, ['compound' => true]);
}

protected function getDataMapper()
Expand Down
12 changes: 0 additions & 12 deletions Tests/ResolvedFormTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormTypeExtensionInterface;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\Form\ResolvedFormType;
Expand Down Expand Up @@ -380,15 +379,4 @@ private function getMockFormFactory()
{
return $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
}

/**
* @param string $name
* @param array $options
*
* @return FormBuilder
*/
protected function getBuilder($name = 'name', array $options = [])
{
return new FormBuilder($name, null, $this->dispatcher, $this->factory, $options);
}
}

0 comments on commit 03bab85

Please sign in to comment.