Testing with phpunit

Home Forums Learn ZF2 Testing with phpunit

This topic contains 1 reply, has 2 voices, and was last updated by  admin 2 years, 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #666

    Peter Sigmund
    Participant

    Hello everybody,
    I’m trying to test the application according to the instructions in the book. Every time I get the following output:

    C:xampphtdocslearnzf2>php phpunit.phar -c module/User/tests
    PHPUnit 4.3.5 by Sebastian Bergmann.

    Configuration read from C:xampphtdocslearnzf2moduleUsertestsphpunit.xml

    ←[31;1mE←[0m.

    Time: 363 ms, Memory: 7.00Mb

    There was 1 error:

    1) UserTestControllerAccountControllerTest::testMeAction
    ZendMvcRouterExceptionRuntimeException: Route with name “debug” not found

    C:xampphtdocslearnzf2vendorzendframeworkzendframeworklibraryZendMvcRou
    terHttpTreeRouteStack.php:317
    C:xampphtdocslearnzf2vendorzendframeworkzendframeworklibraryZendViewHe
    lperUrl.php:100
    C:xampphtdocslearnzf2vendorzendframeworkzendframeworklibraryZendViewRe
    ndererPhpRenderer.php:399
    C:xampphtdocslearnzf2moduleApplicationviewlayoutlayout.phtml:40
    C:xampphtdocslearnzf2moduleApplicationviewlayoutlayout.phtml:40
    C:xampphtdocslearnzf2vendorzendframeworkzendframeworklibraryZendViewRe
    ndererPhpRenderer.php:506
    C:xampphtdocslearnzf2vendorzendframeworkzendframeworklibraryZendViewVi
    ew.php:205
    C:xampphtdocslearnzf2vendorzendframeworkzendframeworklibraryZendMvcVie
    wHttpDefaultRenderingStrategy.php:102
    C:xampphtdocslearnzf2vendorzendframeworkzendframeworklibraryZendEventMa
    nagerEventManager.php:468
    C:xampphtdocslearnzf2vendorzendframeworkzendframeworklibraryZendEventMa
    nagerEventManager.php:207
    C:xampphtdocslearnzf2vendorzendframeworkzendframeworklibraryZendMvcVie
    wHttpDefaultRenderingStrategy.php:112
    C:xampphtdocslearnzf2vendorzendframeworkzendframeworklibraryZendEventMa
    nagerEventManager.php:468
    C:xampphtdocslearnzf2vendorzendframeworkzendframeworklibraryZendEventMa
    nagerEventManager.php:207
    C:xampphtdocslearnzf2vendorzendframeworkzendframeworklibraryZendMvcApp
    lication.php:352
    C:xampphtdocslearnzf2vendorzendframeworkzendframeworklibraryZendMvcApp
    lication.php:309
    C:xampphtdocslearnzf2vendorzendframeworkzendframeworklibraryZendTestPH
    PUnitControllerAbstractControllerTestCase.php:288
    C:xampphtdocslearnzf2moduleUsertestsUserControllerAccountControllerTest
    .php:23
    ←[37;41m ←[0m
    ←[37;41mFAILURES! ←[0m
    ←[37;41mTests: 2, Assertions: 1, Errors: 1.←[0m

    C:xampphtdocslearnzf2>

    What do I miss? The route is defined in

    module/Debug/config/module.config.php:

    return array(
    ‘router’ => array(
    ‘routes’ => array(
    ‘debug’ => array(
    ‘type’ => ‘Literal’,
    ‘options’ => array(
    ‘route’ => ‘/debug’,
    ‘defaults’ => array(
    ‘__NAMESPACE__’ => ‘DebugController’,
    ‘controller’ => ‘Index’,
    ‘action’ => ‘index’,
    ),
    ),
    ‘may_terminate’ => true,
    ‘child_routes’ => array(
    ‘default’ => array(
    ‘type’ => ‘Segment’,
    ‘options’ => array(
    ‘route’ => ‘/[:controller[/:action]]’,
    ‘constraints’ => array(
    ‘controller’ => ‘[a-zA-Z][a-zA-Z0-9_-]*’,
    ‘action’ => ‘[a-zA-Z][a-zA-Z0-9_-]*’,
    ),
    ‘defaults’ => array(
    ),
    ),
    ),
    ),
    ),
    ),

    but anyway this shouldn’t be tested as only modules Application and User are defined in
    module/User/tests/config/application.config.php

    return array(
    ‘modules’ => array(
    ‘Application’,
    ‘User’,
    ),

    I would be very glad if anybody could help me!

    Thank you very much,
    borging

    #667

    admin
    Keymaster

    Hi Peter,
    If you want create a github repository and put your code there. I can take a look and if needed I’ll commit the fixes with explanations.

    Regards,
    Slavey

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.