Issues

ZF-11423: creation of module controllers through Zend_Tool overwrites controller tests of application

Issue Type: Bug Created: 2011-05-31T15:33:15.000+0000 Last Updated: 2011-05-31T16:24:07.000+0000 Status: Open Fix version(s): Reporter: Constantin Ehrenstein (skiller) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Test_PHPUnit

  • PHPUnit
  • Zend_Tool
  • test_creation

Related issues: Attachments:

Description

Scenario: you have a "Projects" controller in your application as well as in an "admin" module.

When I create a controller for a module through the zf command on the command line, it will overwrite an existing ProjectsControllerTest for the application controller with an empty/stubbed test case class of the same name.

Instead, the controller test case should be created within a subfolder that mirrors the project structure, i.e. in tests/modules//controllers

Comments

Posted by Adam Lundrigan (adamlundrigan) on 2011-05-31T16:24:07.000+0000

Could not reproduce the issue against the SVN trunk. Here is what I did:

<pre class="highlight">
[adam@zfdev zf]$ zf create project ZF-11423
[adam@zfdev ZF-11423]$ zf create module admin
Creating the following module and artifacts:
/tmp/zf/ZF-11423/application/modules/admin/controllers
/tmp/zf/ZF-11423/application/modules/admin/models
/tmp/zf/ZF-11423/application/modules/admin/views
/tmp/zf/ZF-11423/application/modules/admin/views/scripts
/tmp/zf/ZF-11423/application/modules/admin/views/helpers
/tmp/zf/ZF-11423/application/modules/admin/views/filters
Added a key for path module directory to the application.ini file
Updating project profile '/tmp/zf/ZF-11423/.zfproject.xml'

[adam@zfdev ZF-11423]$ zf create controller Home
Creating a controller at /tmp/zf/ZF-11423/application/controllers/HomeController.php
Creating an index action method in controller Home
Creating a view script for the index action method at /tmp/zf/ZF-11423/application/views/scripts/home/index.phtml
Creating a controller test file at /tmp/zf/ZF-11423/tests/application/controllers/HomeControllerTest.php
Updating project profile '/tmp/zf/ZF-11423/.zfproject.xml'

[adam@zfdev ZF-11423]$ zf create controller Home index-action-included=1 admin
Creating a controller at /tmp/zf/ZF-11423/application/modules/admin/controllers/HomeController.php
Creating an index action method in controller Home
Creating a view script for the index action method at /tmp/zf/ZF-11423/application/modules/admin/views/scripts/home/index.phtml
Creating a controller test file at /tmp/zf/ZF-11423/tests/application/modules/admin/controllers/HomeControllerTest.php
Updating project profile '/tmp/zf/ZF-11423/.zfproject.xml'

[adam@zfdev  ZF-11423]$ find . -name "*Test.php"
./tests/application/controllers/IndexControllerTest.php
./tests/application/controllers/HomeControllerTest.php
./tests/application/modules/admin/controllers/HomeControllerTest.php

As you can see, both controller tests are created in their proper locations.

Could you provide a similar transcript from your system which shows the controller test file ending up in the wrong location?

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts