Ошибка памяти Symfony с контейнером в тестах PHPUnit

У меня есть следующий тест. Это вызывает 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());
    }

0 ответов

Другие вопросы по тегам