2016-04-29 10 views
2

WebTestCaseのメソッドを使用して、私がテストしたリクエストに使用されているメモリ全体をトレースしたいだけです。 WebTestCase::testReturnValidUser方法内でこのような 何か:symfonyウェブテストケースでメモリ使用量をテストする方法

$client = static::createClient(); 
     $client->enableProfiler(); 
     $crawler = $client->request(
      'GET', 
      $userURL 
     ); 

... 

if ($profile = $client->getProfile()) { 
    $this->assertLessThan(10, $profile->getSomethingForMemoryConsumption()) 
} 

追記:残念ながら、私はxhproofをインストールすることはできません。 Brewは私自身がインストールしたphp7のxhproofを提供していないようだ。

答えて

2

[OK]を、私はそれを見つけた:私は単にDataCollector自分を定義せずにMemoryDataCollector既に存在を使用することができます。

if ($profile = $client->getProfile()) { 
     $this->assertLessThan(30000000, $profile->getCollector('memory')->getMemory()); 
    } 
関連する問題