Steps to Reproduce
- Generate new project and an application with the name 'frontend'.
- Apply following settings:
- config/doctrine/schema.yml
actAs: [Timestampable]
options:
type: INNODB
Item:
columns:
name: string(60)
- apps/frontend/config/routing.yml
# default rules
items:
class: sfDoctrineRouteCollection
options:
model: Item
with_wildcard_routes: true
homepage:
url: /
param: { module: default, action: index }
default_index:
url: /:module
param: { action: index }
default:
url: /:module/:action/*
- Run './symfony doctrine:build-all'
- Run './symfony doctrine:generate-module-for-route frontend items'
- Run ' ./symfony test:functional frontend'. This should result in a failed test with status 'dubious':
itemsActionsTest.....................................................dubious
Test returned status 255
Failed Test Stat Total Fail List of Failed
------------------------------------------------------------------
itemsActionsTest 255 0 0
Failed 1/1 test scripts, 0.00% okay. 0/0 subtests failed, 0.00% okay.
To get a clue about why the test failed I ran the test by itself:
php "test/functional/frontend/itemsActionsTest.php" 2>&1
And got this output:
# get /items/index
Fatal error: Call to undefined method sfRoute::getObjects() in /Library/WebServer/Documents/php_workspace/test_tests/apps/frontend/modules/items/actions/actions.class.php on line 15
Call Stack:
0.0009 58916 1. {main}() /Library/WebServer/Documents/php_workspace/test_tests/test/functional/frontend/itemsActionsTest.php:0
0.4372 6259556 2. sfTestFunctionalBase->get() /Library/WebServer/Documents/php_workspace/test_tests/test/functional/frontend/itemsActionsTest.php:8
0.4372 6259556 3. sfTestFunctionalBase->call() /Library/WebServer/Documents/php_workspace/test_tests/lib/vendors/symfony/lib/test/sfTestFunctionalBase.class.php:183
0.4374 6260448 4. sfBrowserBase->call() /Library/WebServer/Documents/php_workspace/test_tests/lib/vendors/symfony/lib/test/sfTestFunctionalBase.class.php:245
0.4376 6267200 5. sfBrowser->doCall() /Library/WebServer/Documents/php_workspace/test_tests/lib/vendors/symfony/lib/util/sfBrowserBase.class.php:322
0.5245 6677036 6. sfFrontWebController->dispatch() /Library/WebServer/Documents/php_workspace/test_tests/lib/vendors/symfony/lib/util/sfBrowser.class.php:43
0.5245 6677752 7. sfController->forward() /Library/WebServer/Documents/php_workspace/test_tests/lib/vendors/symfony/lib/controller/sfFrontWebController.class.php:48
0.5454 7021344 8. sfFilterChain->execute() /Library/WebServer/Documents/php_workspace/test_tests/lib/vendors/symfony/lib/controller/sfController.class.php:245
0.5457 7022028 9. sfFakeRenderingFilter->execute() /Library/WebServer/Documents/php_workspace/test_tests/lib/vendors/symfony/lib/filter/sfFilterChain.class.php:53
0.5457 7022176 10. sfFilterChain->execute() /Library/WebServer/Documents/php_workspace/test_tests/lib/vendors/symfony/lib/util/sfBrowser.class.php:161
0.5460 7022744 11. sfCommonFilter->execute() /Library/WebServer/Documents/php_workspace/test_tests/lib/vendors/symfony/lib/filter/sfFilterChain.class.php:53
0.5460 7023532 12. sfFilterChain->execute() /Library/WebServer/Documents/php_workspace/test_tests/lib/vendors/symfony/lib/filter/sfCommonFilter.class.php:29
0.5462 7024100 13. sfExecutionFilter->execute() /Library/WebServer/Documents/php_workspace/test_tests/lib/vendors/symfony/lib/filter/sfFilterChain.class.php:53
0.5466 7025256 14. sfExecutionFilter->handleAction() /Library/WebServer/Documents/php_workspace/test_tests/lib/vendors/symfony/lib/filter/sfExecutionFilter.class.php:42
0.5466 7025664 15. sfExecutionFilter->executeAction() /Library/WebServer/Documents/php_workspace/test_tests/lib/vendors/symfony/lib/filter/sfExecutionFilter.class.php:76
0.5466 7025952 16. sfActions->execute() /Library/WebServer/Documents/php_workspace/test_tests/lib/vendors/symfony/lib/filter/sfExecutionFilter.class.php:90
0.5469 7026800 17. itemsActions->executeIndex() /Library/WebServer/Documents/php_workspace/test_tests/lib/vendors/symfony/lib/action/sfActions.class.php:53
Looks like everything went fine.
The output above showed that the error happened on line 15 of apps/frontend/modules/items/actions/actions.class.php. Let's have a look there:
11 class itemsActions extends sfActions
12 {
13 public function executeIndex(sfWebRequest $request)
14 {
15 $this->item_list = $this->getRoute()->getObjects();
16 }
Out of curiosity I decided to print the class name of $this->getRoute():
11 class itemsActions extends sfActions
12 {
13 public function executeIndex(sfWebRequest $request)
14 {
15 echo get_class($this->getRoute());
16 $this->item_list = $this->getRoute()->getObjects();
17 }
I then reran the test and the output showed that the class of getRoute was sfRoute. This is wrong. The class should be sfDoctrineRouteCollection as specified in my routing.yml. I have no clue why this happens.
I also tested the same settings and generated an admin module (./symfony doctrine:generate-admin frontend items). The generated functional test were identical to the test generated by generate-module-for-route but would not fail in this manner.