Selaa lähdekoodia

Merge pull request #2974 from sonata-project/pulzarraider-patch-1

Fixed unit tests in CRUDControllerTest
Andrej Hudec 10 vuotta sitten
vanhempi
commit
1081aaab4a
1 muutettua tiedostoa jossa 19 lisäystä ja 0 poistoa
  1. 19 0
      Tests/Controller/CRUDControllerTest.php

+ 19 - 0
Tests/Controller/CRUDControllerTest.php

@@ -1612,6 +1612,10 @@ class CRUDControllerTest extends \PHPUnit_Framework_TestCase
             ->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();
@@ -1631,6 +1635,9 @@ class CRUDControllerTest extends \PHPUnit_Framework_TestCase
 
         $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');
@@ -1732,6 +1739,10 @@ class CRUDControllerTest extends \PHPUnit_Framework_TestCase
             ->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));
@@ -1977,6 +1988,10 @@ class CRUDControllerTest extends \PHPUnit_Framework_TestCase
             ->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())
@@ -2002,6 +2017,10 @@ class CRUDControllerTest extends \PHPUnit_Framework_TestCase
 
         $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');