Skip to content

Commit 619fac0

Browse files
brikouweaverryan
authored andcommitted
added tearDown method and freeing entity manager
1 parent aaaafa9 commit 619fac0

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

cookbook/testing/doctrine.rst

+13-1
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,14 @@ which makes all of this quite easy::
3232
*/
3333
private $em;
3434

35+
/**
36+
* {@inheritDoc}
37+
*/
3538
public function setUp()
3639
{
3740
static::$kernel = static::createKernel();
3841
static::$kernel->boot();
39-
$this->em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
42+
$this->em = static::$kernel->getContainer()->get('doctrine')->getEntityManager();
4043
}
4144

4245
public function testSearchByCategoryName()
@@ -48,4 +51,13 @@ which makes all of this quite easy::
4851

4952
$this->assertCount(1, $products);
5053
}
54+
55+
/**
56+
* {@inheritDoc}
57+
*/
58+
protected function tearDown()
59+
{
60+
parent::tearDown();
61+
$this->em->close();
62+
}
5163
}

0 commit comments

Comments
 (0)