public function testRun() { $config = $this->_context->getConfig(); $mock = $this->getMockBuilder('MAdmin_Log_Manager_Default')->setMethods(array('deleteItems'))->setConstructorArgs(array($this->_context))->getMock(); $mock->expects($this->atLeastOnce())->method('deleteItems'); $tmppath = dirname(dirname(dirname(dirname(__DIR__)))) . DIRECTORY_SEPARATOR . 'tmp'; $name = 'ControllerJobsAdminLogDefaultRun'; $config->set('classes/log/manager/name', $name); $config->set('controller/jobs/admin/log/default/limit-days', 0); $config->set('controller/jobs/admin/log/default/path', $tmppath); MAdmin_Log_Manager_Factory::injectManager('MAdmin_Log_Manager_' . $name, $mock); if (!is_dir($tmppath) && mkdir($tmppath) === false) { throw new Exception(sprintf('Unable to create temporary path "%1$s"', $tmppath)); } $this->_object->run(); foreach (new DirectoryIterator($tmppath) as $file) { if ($file->isFile() && $file->getExtension() === 'zip') { $container = MW_Container_Factory::getContainer($file->getPathName(), 'Zip', 'CSV', array()); $container->get('unittest facility.csv'); unlink($file->getPathName()); return; } } $this->fail('Log archive file not found'); }