Hi all!
You probably know about Controller tests described in Zend Framework (ZF) manual.
There is a known problem with memory usage in Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase. It is allocated about 10 Mb for each test in PHP 5.6 or 6 Mb in PHP 7.1.
Upgrading to the last PHP version is the first step of optimization. In that case you will save 40% of memory. Also this upgrade is required for the next optimization step.