2

I would simply like to trace the whole amount of memory used for a request I test by means of a WebTestCase's method. Something like this inside a WebTestCase::testReturnValidUser method:

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

...

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

Sidenote: unfortunately I can't install xhproof. Brew seems not to give xhproof for its own php7, which I installed.

Bertuz
  • 2,390
  • 3
  • 25
  • 50

1 Answers1

2

Ok I found it: I can simply use the already existent MemoryDataCollector without defining my own DataCollector:

    if ($profile = $client->getProfile()) {
        $this->assertLessThan(30000000, $profile->getCollector('memory')->getMemory());
    }
Bertuz
  • 2,390
  • 3
  • 25
  • 50