Skip to content
Browse files

Compatibility with symfony2.1

  • Loading branch information...
1 parent 1bf9980 commit dbc677e0e6de4f2e39e50ed4b42beebb810ae184 @ghua committed Oct 3, 2012
Showing with 13 additions and 17 deletions.
  1. +8 −2 Controller/ForTestingController.php
  2. +1 −1 Tests/Api/ApiTest.php
  3. +4 −14 Tests/ControllerTest.php
View
10 Controller/ForTestingController.php
@@ -41,7 +41,10 @@ public function testFormValidationResponseAction($_data)
{
$Entity = new Test();
- $form = $this->createForm(new TestType(), $Entity);
+ $form = $this->createFormBuilder($Entity, array('csrf_protection' => false))
+ ->add('name')
+ ->add('count')
+ ->getForm();
$_data = array_intersect_key($_data, $form->getChildren());
$form->bind($_data);
@@ -60,7 +63,10 @@ public function testFormEntityValidationResponseAction($_data)
{
$Entity = new Test();
- $form = $this->createForm(new TestType(), $Entity);
+ $form = $this->createFormBuilder($Entity, array('csrf_protection' => false))
+ ->add('name')
+ ->add('count')
+ ->getForm();
$_data = array_intersect_key($_data, $form->getChildren());
$form->bind($_data);
View
2 Tests/Api/ApiTest.php
@@ -34,7 +34,7 @@ public function test__toString()
$this->assertObjectHasAttribute('actions', $apiJson);
$this->assertObjectHasAttribute('ExtDirect_Direct', $apiJson->actions);
- $this->assertObjectHasAttribute('ext_direct_test_service', $apiJson->actions);
+ $this->assertObjectHasAttribute('ext_direct_api_test_service', $apiJson->actions);
$this->assertObjectHasAttribute('len', $apiJson->actions->ExtDirect_Direct[0]);
$this->assertEquals(0, $apiJson->actions->ExtDirect_Direct[0]->len);
View
18 Tests/ControllerTest.php
@@ -4,23 +4,13 @@
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Ext\DirectBundle\Api\Api;
-require_once __DIR__.'../../../../../../app/AppKernel.php';
-
class ControllerTest extends WebTestCase
{
- protected static $kernel;
- protected static $container;
- /**
- * @var \Doctrine\ORM\EntityManager
- */
- private $em;
-
public function __construct() {
- self::$kernel = new \AppKernel('test', true);
- self::$kernel->boot();
- self::$container = self::$kernel->getContainer();
- $this->em = self::$container ->get('doctrine.orm.entity_manager');
+ static::$kernel = static::createKernel();
+ static::$kernel->boot();
+ $this->em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
}
/**
@@ -34,7 +24,7 @@ protected function getEntityManager ()
public function get($serviceId)
{
- return self::$container->get($serviceId);
+ return static::$kernel->getContainer()->get($serviceId);
}
}

0 comments on commit dbc677e

Please sign in to comment.
Something went wrong with that request. Please try again.