1

我有以下测试。这导致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());
    }
4

0 回答 0