我正在使用NetBeans 8.0中的symfony2框架在debian 7.0系統上開發更大的PHP應用程序。 我已經寫了很多幫助類和服務的單元測試,並且它們在netbeans以及命令行上運行良好。 但我想測試控制器一樣,所以我寫了我的第一個「WebTestCase」派生類:無法運行PHPUnit WebTestCases
<?php
namespace StockCrawler\MainBundle\Tests\Services;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class TestFrontpageController extends WebTestCase {
public function testIndexAction() {
$client = static::createClient();
$crawler = $client->request('GET', '/');
}
}
不neccessarily傑作,但它足以說明問題:
PHPUnit 3.6.10 by Sebastian Bergmann.
Configuration read from /home/hennes/PHP-Projects/StockCrawler/app/phpunit.xml
PHP Fatal error: Maximum function nesting level of '100' reached, aborting! in /home/hennes/PHP-Projects/StockCrawler/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/Dumper/DumperCollection.php on line 81
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46
PHP 3. PHPUnit_TextUI_Command->run() /usr/share/php/PHPUnit/TextUI/Command.php:130
PHP 4. PHPUnit_TextUI_TestRunner->doRun() /usr/share/php/PHPUnit/TextUI/Command.php:192
PHP 5. PHPUnit_Framework_TestSuite->run() /usr/share/php/PHPUnit/TextUI/TestRunner.php:325
PHP 6. PHPUnit_Framework_TestSuite->runTest() /usr/share/php/PHPUnit/Framework/TestSuite.php:745
PHP 7. PHPUnit_Framework_TestCase->run() /usr/share/php/PHPUnit/Framework/TestSuite.php:772
PHP 8. PHPUnit_Framework_TestResult->run() /usr/share/php/PHPUnit/Framework/TestCase.php:751
PHP 9. PHPUnit_Framework_TestCase->runBare() /usr/share/php/PHPUnit/Framework/TestResult.php:649
PHP 10. PHPUnit_Framework_TestCase->runTest() /usr/share/php/PHPUnit/Framework/TestCase.php:804
PHP 11. ReflectionMethod->invokeArgs() /usr/share/php/PHPUnit/Framework/TestCase.php:942
PHP 12. Fotokiste\MainBundle\Tests\Services\TestCircleController->testIndexAction() /usr/share/php/PHPUnit/Framework/TestCase.php:942
PHP 13. Symfony\Component\BrowserKit\Client->request() /home/hennes/PHP-Projects/StockCrawler/src/Fotokiste/MainBundle/Tests/Services/TestCircleController.php:23
PHP 14. Symfony\Bundle\FrameworkBundle\Client->doRequest() /home/hennes/PHP-Projects/StockCrawler/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Client.php:334
PHP 15. Symfony\Component\HttpKernel\Client->doRequest() /home/hennes/PHP-Projects/StockCrawler/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Client.php:111
PHP 16. Symfony\Component\HttpKernel\Kernel->handle() /home/hennes/PHP-Projects/StockCrawler/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Client.php:81
PHP 17. Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle() /home/hennes/PHP-Projects/StockCrawler/app/bootstrap.php.cache:2303
PHP 18. Symfony\Component\HttpKernel\HttpKernel->handle() /home/hennes/PHP-Projects/StockCrawler/app/bootstrap.php.cache:3022
PHP 19. Symfony\Component\HttpKernel\HttpKernel->handleRaw() /home/hennes/PHP-Projects/StockCrawler/app/bootstrap.php.cache:2883
PHP 20. Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher->dispatch() /home/hennes/PHP-Projects/StockCrawler/app/bootstrap.php.cache:2900
PHP 21. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() /home/hennes/PHP-Projects/StockCrawler/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php:138
PHP 22. Symfony\Component\EventDispatcher\EventDispatcher->dispatch() /home/hennes/PHP-Projects/StockCrawler/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php:167
PHP 23. Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() /home/hennes/PHP-Projects/StockCrawler/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:53
PHP 24. call_user_func() /home/hennes/PHP-Projects/StockCrawler/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:164
PHP 25. Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher->Symfony\Component\HttpKernel\Debug\{closure}() /home/hennes/PHP-Projects/StockCrawler/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:164
PHP 26. call_user_func() /home/hennes/PHP-Projects/StockCrawler/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php:388
PHP 27. Symfony\Component\HttpKernel\EventListener\RouterListener->onKernelRequest() /home/hennes/PHP-Projects/StockCrawler/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php:388
PHP 28. Symfony\Component\Routing\Router->matchRequest() /home/hennes/PHP-Projects/StockCrawler/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php:125
PHP 29. Symfony\Component\Routing\Router->getMatcher() /home/hennes/PHP-Projects/StockCrawler/vendor/symfony/symfony/src/Symfony/Component/Routing/Router.php:227
PHP 30. Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper->dump() /home/hennes/PHP-Projects/StockCrawler/vendor/symfony/symfony/src/Symfony/Component/Routing/Router.php:261
PHP 31. Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper->generateMatchMethod() /home/hennes/PHP-Projects/StockCrawler/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php:75
PHP 32. Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper->compileRoutes() /home/hennes/PHP-Projects/StockCrawler/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php:90
PHP 33. Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper->buildPrefixTree() /home/hennes/PHP-Projects/StockCrawler/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php:132
PHP 34. Symfony\Component\Routing\Matcher\Dumper\DumperPrefixCollection->mergeSlashNodes() /home/hennes/PHP-Projects/StockCrawler/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php:382
PHP 35. Symfony\Component\Routing\Matcher\Dumper\DumperPrefixCollection->mergeSlashNodes() /home/hennes/PHP-Projects/StockCrawler/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/Dumper/DumperPrefixCollection.php:93
PHP 36. Symfony\Component\Routing\Matcher\Dumper\DumperPrefixCollection->mergeSlashNodes() /home/hennes/PHP-Projects/StockCrawler/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/Dumper/DumperPrefixCollection.php:93
PHP 37. Symfony\Component\Routing\Matcher\Dumper\DumperPrefixCollection->mergeSlashNodes() /home/hennes/PHP-Projects/StockCrawler/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/Dumper/DumperPrefixCollection.php:93
.
.
.
PHP 97. Symfony\Component\Routing\Matcher\Dumper\DumperPrefixCollection->mergeSlashNodes() /home/hennes/PHP-Projects/StockCrawler/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/Dumper/DumperPrefixCollection.php:93
PHP 98. Symfony\Component\Routing\Matcher\Dumper\DumperPrefixCollection->mergeSlashNodes() /home/hennes/PHP-Projects/StockCrawler/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/Dumper/DumperPrefixCollection.php:93
PHP 99. Symfony\Component\Routing\Matcher\Dumper\DumperCollection->getIterator() /home/hennes/PHP-Projects/StockCrawler/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/Dumper/DumperPrefixCollection.php:91
這是絕對不相干哪個網址我說過,錯誤依然如此。 因此,我完全清空了我的routing.yml文件,但爲'/'寫了一個條目,指向一個僅返回Rensponse('OK',200)的新SimpleController; 錯誤依然存在。
這非常令人沮喪,尤其是因爲應用程序在瀏覽器中運行良好,所有其他單元測試都正常工作。
任何提示或想法我做錯了什麼?
在此先感謝 亨尼斯
它設置成'250最低限度。 – ferdynator
嘿,非常感謝。現在它正在工作。 symfony2爲什麼需要這種高嵌套級別?我知道,它在該記錄的方法中遞歸很多。但爲什麼?有機會降低這個水平? – Hennes