小编Ced*_*ric的帖子

Symfony和PhpUnit内存泄漏

在我们的phpunit测试中加载Doctrine时,我们遇到内存泄漏问题

从Symfony的文档开始:http: //symfony.com/doc/2.7/cookbook/testing/doctrine.html我们编写了这个测试:

use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;

class memoryleakTest extends KernelTestCase
{
    private $em;

    protected function setUp()
    {
        self::bootKernel();

        $this->em = static::$kernel->getContainer()
            ->get('doctrine')
            ->getManager();
    }

    protected function tearDown()
    {
        parent::tearDown();

        $this->em->close();
    }

    function testEEE1()  { 
    }
    function testEEE2()  { 
    }
    function testEEE3()  { 
    }
    function testEEE4()  { 
    }
    function testEEE5()  { 
    }
    function testEEE6()  { 
    }
    function testEEE7()  { 
    }
    function testEEE8()  { 
    }
    function testEEE9()  { 
    }
    function testEEE10()  { 
    }
    function testEEE11()  { 
    }
    function testEEE12()  { …
Run Code Online (Sandbox Code Playgroud)

phpunit doctrine symfony

7
推荐指数
2
解决办法
2910
查看次数

标签 统计

doctrine ×1

phpunit ×1

symfony ×1