浏览代码

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

Fixed unit tests in CRUDControllerTest
Andrej Hudec 10 年之前
父节点
当前提交
1081aaab4a
共有 1 个文件被更改,包括 19 次插入0 次删除
  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'))
             ->with($this->equalTo('EDIT'))
             ->will($this->returnValue(true));
             ->will($this->returnValue(true));
 
 
+        $this->admin->expects($this->any())
+            ->method('getClass')
+            ->will($this->returnValue('stdClass'));
+
         $form = $this->getMockBuilder('Symfony\Component\Form\Form')
         $form = $this->getMockBuilder('Symfony\Component\Form\Form')
             ->disableOriginalConstructor()
             ->disableOriginalConstructor()
             ->getMock();
             ->getMock();
@@ -1631,6 +1635,9 @@ class CRUDControllerTest extends \PHPUnit_Framework_TestCase
 
 
         $this->expectTranslate('flash_edit_error', array('%name%' => $expectedToStringValue), 'SonataAdminBundle');
         $this->expectTranslate('flash_edit_error', array('%name%' => $expectedToStringValue), 'SonataAdminBundle');
 
 
+        $form->expects($this->once())
+            ->method('isSubmitted')
+            ->will($this->returnValue(true));
         $this->request->setMethod('POST');
         $this->request->setMethod('POST');
 
 
         $formView = $this->getMock('Symfony\Component\Form\FormView');
         $formView = $this->getMock('Symfony\Component\Form\FormView');
@@ -1732,6 +1739,10 @@ class CRUDControllerTest extends \PHPUnit_Framework_TestCase
             ->with($this->equalTo('CREATE'))
             ->with($this->equalTo('CREATE'))
             ->will($this->returnValue(true));
             ->will($this->returnValue(true));
 
 
+        $this->admin->expects($this->any())
+            ->method('getClass')
+            ->will($this->returnValue('stdClass'));
+
         $this->admin->expects($this->once())
         $this->admin->expects($this->once())
             ->method('getNewInstance')
             ->method('getNewInstance')
             ->will($this->returnValue($object));
             ->will($this->returnValue($object));
@@ -1977,6 +1988,10 @@ class CRUDControllerTest extends \PHPUnit_Framework_TestCase
             ->with($this->equalTo('CREATE'))
             ->with($this->equalTo('CREATE'))
             ->will($this->returnValue(true));
             ->will($this->returnValue(true));
 
 
+        $this->admin->expects($this->any())
+            ->method('getClass')
+            ->will($this->returnValue('stdClass'));
+
         $object = new \stdClass();
         $object = new \stdClass();
 
 
         $this->admin->expects($this->once())
         $this->admin->expects($this->once())
@@ -2002,6 +2017,10 @@ class CRUDControllerTest extends \PHPUnit_Framework_TestCase
 
 
         $this->expectTranslate('flash_create_error', array('%name%' => $expectedToStringValue), 'SonataAdminBundle');
         $this->expectTranslate('flash_create_error', array('%name%' => $expectedToStringValue), 'SonataAdminBundle');
 
 
+        $form->expects($this->once())
+            ->method('isSubmitted')
+            ->will($this->returnValue(true));
+
         $this->request->setMethod('POST');
         $this->request->setMethod('POST');
 
 
         $formView = $this->getMock('Symfony\Component\Form\FormView');
         $formView = $this->getMock('Symfony\Component\Form\FormView');