我有以下测试。这导致PHP Fatal error: Out of memory (allocated 704905216) (tried to allocate 139802474386369 bytes)
错误
这里$this->client->getContainer()
可能是引起此问题的原因。但是我不怎么写其他方式。如何解决此内存问题?
public function testIndexWithCreateUser()
{
$printMock = $this->createMock(InternPrintApi::class);
$printMock->expects($this->once())
->method('createUser')
->willReturn(json_decode('{"user":{"account":{"email":"test.user@example.com"}}}'));
$this->client->getContainer()->set(InternPrintApi::class, $printMock);
$this->client->request('POST', '/registration', [
'registration' => [
'email' => 'test.user@example.com',
'password' => 'password'
]
]);
$this->assertEquals(302, $this->client->getResponse()->getStatusCode());
}