Skip to content

Commit

Permalink
Merge pull request sonata-project#2974 from sonata-project/pulzarraid…
Browse files Browse the repository at this point in the history
…er-patch-1

Fixed unit tests in CRUDControllerTest
  • Loading branch information
pulzarraider committed May 6, 2015
2 parents 9807b04 + 4ef3171 commit 1081aaa
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Tests/Controller/CRUDControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1612,6 +1612,10 @@ public function testEditActionWithModelManagerException($expectedToStringValue,
->with($this->equalTo('EDIT'))
->will($this->returnValue(true));

$this->admin->expects($this->any())
->method('getClass')
->will($this->returnValue('stdClass'));

$form = $this->getMockBuilder('Symfony\Component\Form\Form')
->disableOriginalConstructor()
->getMock();
Expand All @@ -1631,6 +1635,9 @@ public function testEditActionWithModelManagerException($expectedToStringValue,

$this->expectTranslate('flash_edit_error', array('%name%' => $expectedToStringValue), 'SonataAdminBundle');

$form->expects($this->once())
->method('isSubmitted')
->will($this->returnValue(true));
$this->request->setMethod('POST');

$formView = $this->getMock('Symfony\Component\Form\FormView');
Expand Down Expand Up @@ -1732,6 +1739,10 @@ public function testPreCreate()
->with($this->equalTo('CREATE'))
->will($this->returnValue(true));

$this->admin->expects($this->any())
->method('getClass')
->will($this->returnValue('stdClass'));

$this->admin->expects($this->once())
->method('getNewInstance')
->will($this->returnValue($object));
Expand Down Expand Up @@ -1977,6 +1988,10 @@ public function testCreateActionWithModelManagerException($expectedToStringValue
->with($this->equalTo('CREATE'))
->will($this->returnValue(true));

$this->admin->expects($this->any())
->method('getClass')
->will($this->returnValue('stdClass'));

$object = new \stdClass();

$this->admin->expects($this->once())
Expand All @@ -2002,6 +2017,10 @@ public function testCreateActionWithModelManagerException($expectedToStringValue

$this->expectTranslate('flash_create_error', array('%name%' => $expectedToStringValue), 'SonataAdminBundle');

$form->expects($this->once())
->method('isSubmitted')
->will($this->returnValue(true));

$this->request->setMethod('POST');

$formView = $this->getMock('Symfony\Component\Form\FormView');
Expand Down

0 comments on commit 1081aaa

Please sign in to comment.