Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8755929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:57:07+00:00 2026-06-13T13:57:07+00:00

I am trying out the phpunit in the Zf2 album module. I encountered an

  • 0

I am trying out the phpunit in the Zf2 album module. I encountered an error which states about routing.

Below is the debug information. It says ‘Route with name “album” not found’, but when I checked module.config.php in the album module folder, I see that is correctly set and in the browser the redirection to that route is working fine.

Album\Controller\AlbumControllerTest::testDeleteActionCanBeAccessed
Zend\Mvc\Router\Exception\RuntimeException: Route with name "album" not found
D:\www\zend2\vendor\zendframework\zendframework\library\Zend\Mvc\Router\SimpleRouteStack.php:292
D:\www\zend2\vendor\zendframework\zendframework\library\Zend\Mvc\Controller\Plugin\Url.php:88
D:\www\zend2\vendor\zendframework\zendframework\library\Zend\Mvc\Controller\Plugin\Redirect.php:54
D:\www\zend2\module\Album\src\Album\Controller\AlbumController.php:80
D:\www\zend2\vendor\zendframework\zendframework\library\Zend\Mvc\Controller\AbstractActionController.php:87
D:\www\zend2\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php:468
D:\www\zend2\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php:208
D:\www\zend2\vendor\zendframework\zendframework\library\Zend\Mvc\Controller\AbstractController.php:108
D:\www\zend2\tests\module\Album\src\Album\Controller\AlbumControllerTest.php:35
C:\wamp\bin\php\php5.4.3\phpunit:46

I understand that the issue in AlbumController.php line 80 is

return $this->redirect()->toRoute('album');

But not sure why it is not working. Any one has encountered and overcome such issues?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:57:09+00:00Added an answer on June 13, 2026 at 1:57 pm

    I hope it will save approx. 30 minutes of searching in the zend framework 2 code:

    class AlbumControllerTest extends PHPUnit_Framework_TestCase
    {
    
    //...
    
        protected function setUp()
        {
            $bootstrap        = \Zend\Mvc\Application::init(include 'config/application.config.php');
            $this->controller = new AlbumController();
            $this->request    = new Request();
            $this->routeMatch = new RouteMatch(array('controller' => 'index'));
            $this->event      = $bootstrap->getMvcEvent();
    
            $router = new \Zend\Mvc\Router\SimpleRouteStack();
            $options = array(
                        'route'    => '/album[/:action][/:id]',
                        'constraints' => array(
                            'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                            'id'     => '[0-9]+',
                        ),
                        'defaults' => array(
                            'controller' => 'Album\Controller\Album',
                            'action'     => 'index',
                        ),
                );
            $route = \Zend\Mvc\Router\Http\Segment::factory($options);
    
            $router->addRoute('album', $route);
    
            $this->event->setRouter($router);
            $this->event->setRouteMatch($this->routeMatch);
            $this->controller->setEvent($this->event);
            $this->controller->setEventManager($bootstrap->getEventManager());
            $this->controller->setServiceLocator($bootstrap->getServiceManager());
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just trying out PHPUnit with CakePHP and i'm getting an the following error
I am trying to work out how to configure PHPUnit to use the test
im trying out paypals html api where you specify price, item_name, customer information and
Trying out the following, will result in error. How do I retrieve the values
I trying out using regEx to split a String which gives me an array
I'm trying to mock out the Predis client in a PHPUnit test. When I
Using, Centos, Apache, PHPUnit, Selenium RC, I was trying to test selenium RC which
When I'm unit-testing my php code with PHPUnit, I'm trying to figure out the
Trying out the example usage of codebrew rails-backbone , everything works fine but the
Trying out the examples found on pleac.sf.net , I'm not able to get an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.