Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Invalid argument supplied for foreach() #3949

Closed
ghost opened this issue Mar 4, 2013 · 3 comments
Closed

Invalid argument supplied for foreach() #3949

ghost opened this issue Mar 4, 2013 · 3 comments
Milestone

Comments

@ghost
Copy link

ghost commented Mar 4, 2013

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); } ## }
@marc-mabe
Copy link
Member

fixed by #4353 and can be closed

@marc-mabe
Copy link
Member

@weierophinney ping

@weierophinney
Copy link
Member

Closed with #4353

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants