Skip to content
This repository has been archived by the owner on Feb 11, 2023. It is now read-only.

Commit

Permalink
Fix tests again.
Browse files Browse the repository at this point in the history
  • Loading branch information
lakiboy committed Jan 5, 2018
1 parent fa2c24e commit 0b15adf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions Tests/Form/DateNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function setUp()
public function it_leaves_non_datetime_type_intact()
{
$dummy = new \stdClass();
$this->assertSame($dummy, $this->normalizer->normalizeDate($dummy, $this->getMock('Symfony\Component\Form\FormInterface')));
$this->assertSame($dummy, $this->normalizer->normalizeDate($dummy, $this->makeMock('Symfony\Component\Form\FormInterface')));
}

/**
Expand All @@ -32,8 +32,8 @@ public function it_normalizes_date()
$datePreNormalized = new \DateTime();
$dateNormalized = new \DateTime();

$transformer1 = $this->getMock('Symfony\Component\Form\DataTransformerInterface');
$transformer2 = $this->getMock('Symfony\Component\Form\DataTransformerInterface');
$transformer1 = $this->makeMock('Symfony\Component\Form\DataTransformerInterface');
$transformer2 = $this->makeMock('Symfony\Component\Form\DataTransformerInterface');

$transformer1
->expects($this->once())
Expand All @@ -59,14 +59,14 @@ public function it_normalizes_date()
*/
private function getForm(array $transformers)
{
$config = $this->getMock('Symfony\Component\Form\FormConfigInterface');
$config = $this->makeMock('Symfony\Component\Form\FormConfigInterface');
$config
->expects($this->once())
->method('getViewTransformers')
->willReturn($transformers)
;

$form = $this->getMock('Symfony\Component\Form\FormInterface');
$form = $this->makeMock('Symfony\Component\Form\FormInterface');
$form
->expects($this->once())
->method('getConfig')
Expand All @@ -76,12 +76,12 @@ private function getForm(array $transformers)
return $form;
}

public function getMock($originalClassName)
private function makeMock($originalClassName)
{
if (method_exists($this, 'createMock')) {
return $this->createMock($originalClassName);
}

return parent::getMock($originalClassName);
return $this->getMock($originalClassName);
}
}
8 changes: 4 additions & 4 deletions Tests/Twig/GenemuFormExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class GenemuFormExtensionTest extends \PHPUnit_Framework_TestCase
public function it_registers_functions()
{
$twig = new \Twig_Environment(new \Twig_Loader_Array());
$twig->addExtension(new GenemuFormExtension($this->getMock('Symfony\Component\Form\FormRendererInterface')));
$twig->addExtension(new GenemuFormExtension($this->makeMock('Symfony\Component\Form\FormRendererInterface')));

$f1 = $twig->getFunction('form_javascript');
$f2 = $twig->getFunction('form_stylesheet');
Expand All @@ -29,7 +29,7 @@ public function it_proxies_to_form_renderer()
{
$view = new FormView();

$renderer = $this->getMock('Symfony\Component\Form\FormRendererInterface');
$renderer = $this->makeMock('Symfony\Component\Form\FormRendererInterface');
$renderer
->expects($this->exactly(3))
->method('searchAndRenderBlock')
Expand All @@ -48,12 +48,12 @@ public function it_proxies_to_form_renderer()
call_user_func($twig->getFunction('form_stylesheet')->getCallable(), $view);
}

protected function getMock($originalClassName)
private function makeMock($originalClassName)
{
if (method_exists($this, 'createMock')) {
return $this->createMock($originalClassName);
}

return parent::getMock($originalClassName);
return $this->getMock($originalClassName);
}
}

0 comments on commit 0b15adf

Please sign in to comment.