Issues

ZF-12533: Invalid argument supplied for foreach()

Issue Type: Unit Tests: Problem Created: 2013-03-03T14:30:37.000+0000 Last Updated: 2013-03-04T19:47:50.000+0000 Status: Closed Fix version(s): Reporter: Egidio Caprino (aegidius) Assignee: None Tags: Related issues: Attachments:

Description

In testing a controller I get this error.


PHPUnit 3.7.15 by Sebastian Bergmann.

Configuration read from /home/egidio/NetBeansProjects/school_gear/module/Guest/test/phpunit.xml

E

Time: 0 seconds, Memory: 4.75Mb

There was 1 error:

  1. GuestTest\Controller\LoginControllerTest::testGuestCanAccessLoginPage Invalid argument supplied for foreach()

/home/egidio/NetBeansProjects/school_gear/vendor/ZF2/Zend/ModuleManager/Listener/ConfigListener.php:354 /home/egidio/NetBeansProjects/school_gear/vendor/ZF2/Zend/ModuleManager/Listener/ConfigListener.php:147 /home/egidio/NetBeansProjects/school_gear/vendor/ZF2/Zend/EventManager/EventManager.php:460 /home/egidio/NetBeansProjects/school_gear/vendor/ZF2/Zend/EventManager/EventManager.php:204 /home/egidio/NetBeansProjects/school_gear/vendor/ZF2/Zend/ModuleManager/ModuleManager.php:100 /home/egidio/NetBeansProjects/school_gear/vendor/ZF2/Zend/Mvc/Application.php:239 /home/egidio/NetBeansProjects/school_gear/vendor/ZF2/Zend/Test/PHPUnit/Controller/AbstractControllerTestCase.php:146 /home/egidio/NetBeansProjects/school_gear/vendor/ZF2/Zend/Test/PHPUnit/Controller/AbstractControllerTestCase.php:173 /home/egidio/NetBeansProjects/school_gear/vendor/ZF2/Zend/Test/PHPUnit/Controller/AbstractControllerTestCase.php:193 /home/egidio/NetBeansProjects/school_gear/vendor/ZF2/Zend/Test/PHPUnit/Controller/AbstractControllerTestCase.php:236 /home/egidio/NetBeansProjects/school_gear/module/Guest/test/GuestTest/Controller/LoginControllerTest.php:15

FAILURES!

Tests: 1, Assertions: 0, Errors: 1.

These are involved files.


phpunit.xml

./GuestTest

Bootstrap.php

array( 'module_paths' => $zf2ModulePaths, ), 'modules' => array('Application','Guest') ); $serviceManager = new \Zend\ServiceManager\ServiceManager( new \Zend\Mvc\Service\ServiceManagerConfig()); $serviceManager->setService('ApplicationConfig', $config); $serviceManager->get('ModuleManager')->loadModules(); static::$serviceManager = $serviceManager; } public static function getServiceManager() { return static::$serviceManager; } protected static function initAutoloader() { $vendorPath = static::findParentPath('vendor'); $zf2Path = getenv('ZF2_PATH'); if (!$zf2Path) { if (defined('ZF2_PATH')) { $zf2Path = ZF2_PATH; } else { if (is_dir($vendorPath . '/ZF2/library')) { $zf2Path = $vendorPath . '/ZF2/library'; } } } if (!$zf2Path) { throw new \RuntimeException('Unable to load ZF2.'); } include $zf2Path . '/Zend/Loader/AutoloaderFactory.php'; \Zend\Loader\AutoloaderFactory::factory(array( 'Zend\Loader\StandardAutoloader' => array( 'autoregister_zf' => true, 'namespaces' => array( __NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__, ), ), )); } protected static function findParentPath($path) { $dir = __DIR__; $previousDir = '.'; while (!is_dir($dir . '/' . $path)) { $dir = dirname($dir); if ($previousDir === $dir) return false; $previousDir = $dir; } return $dir . '/' . $path; } } Bootstrap::init(); ------------------ LoginControllerTest.php setApplicationConfig($config); parent::setUp(); } public function testGuestCanAccessLoginPage() { $this->dispatch('/login'); $this->assertResponseStatusCode(200); } } - ### Comments Posted by Frank Br├╝ckner (frosch) on 2013-03-04T19:47:50.000+0000 Please report all issues in ZF on [Github](https://github.com/zendframework/zf2/issues).

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts