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

  • Home
  • SEARCH
  • 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 1046277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:07:18+00:00 2026-05-16T16:07:18+00:00

I have a PHP MVC framework with multiple ‘applications’ under this system the organization

  • 0

I have a PHP MVC framework with multiple ‘applications’ under this system the organization goes

\project\apps\app1\
\project\apps\app2\
\project\apps\shared\

Each application can have it’s own set of controllers

\project\apps\app1\controllers\FooContoller.php
\project\apps\app2\controllers\FooContoller.php
\project\apps\shared\controllers\BarContoller.php

I’d like to set up my PHPUnit testing space to be able to test each of the application directories, but I’m hoping to do it in the “best” way.

The setup of PHPUnit is like:

\project\PHPUnit
\project\PHPUnit\phpunit.xml
\project\PHPUnit\apps\app1\bootstrap.php
\project\PHPUnit\apps\app1\controllers
\project\PHPUnit\apps\app1\controllers\FooControllerTest.php
\project\PHPUnit\apps\app2\bootstrap.php
\project\PHPUnit\apps\app2\controllers
\project\PHPUnit\apps\app2\controllers\FooControllerTest.php

Now here’s the question: what is the “best practise” way to configure my phpunit.xml files?

As it stands, I tried to include both applications as their own test suite in the XML file, but I run into a “Cannot Redeclare Class: FooController ” pretty quickly.

To my mind, the ideal situation would be to configure the XML so that all the tests ran for app1 then memory was ‘cleared’ and all the tests were run for app2.

It might however, be the case that in terms of best practise it’s best to have multiple XML files, one for each APP. (Then perhaps a batch/shellscript file to run a “test all” or test X)

If we look at a ‘typical’ PHPUnit XML config file:

<phpunit bootstrap="./apps/app1/bootstrap.php" colors="true">
    <testsuite name="App1TestSuite">
        <directory>./</directory>
    </testsuite>
    <filter>
        <whitelist>
        <directory suffix=".php">./apps/app1/controllers/</directory>        
    <directory suffix=".php">./apps/shared/</directory>
        </whitelist>
    </filter>
    <logging>
        <log type="coverage-html" target="./log/report.html" charset="UTF-8"
            yui="true" highlight="true"
            lowUpperBound="50" highLowerBound="80"/>
        <log type="testdox-html" target="./log/testdox.html" />
    </logging>
 </phpunit>

Should I go with many of these? Or should I add the tag and have all files Setups combined in a single XML configuration.

If the best practise is ‘single configuration’ … does anyone know how you go about enabling multiple ‘bootstraps’? Since each APP loads with slightly different global variables, and some will load slightly different versions of same-named classes, it would be necessary to clear everything and start again.

I’m interested in building the ‘optimal’ system for testing from the start but obviously have a few holes in my knowledge.

  • 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-05-16T16:07:19+00:00Added an answer on May 16, 2026 at 4:07 pm

    You basically almost answered your own question.

    It might however, be the case that in
    terms of best practise it’s best to
    have multiple XML files, one for each
    APP. (Then perhaps a batch/shellscript
    file to run a “test all” or test X

    This is the way to go, keep everything separated, simpler and less headaches in the long run.

    Also, you may want to look into some Continuous Integration solution to help with running your testsuites, Hudson is rather nice and integrates well with PHPUnit.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 531k
  • Answers 531k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The operation finished successfully after hours of running. The only… May 16, 2026 at 11:53 pm
  • Editorial Team
    Editorial Team added an answer It does not matter if the elements are on the… May 16, 2026 at 11:53 pm
  • Editorial Team
    Editorial Team added an answer The post-receive hook doesn't take any arguments. Quoth the manual… May 16, 2026 at 11:53 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a PHP MVC application using Zend Framework. As presented in the quickstart,
I have been reading up on multiple PHP frameworks, especially the Zend Framework but
I have a custom built application framework written in PHP which I have been
We're building a PHP app based on Good old codeigniter framework and have run
I have been scouring for a while about this one but haven't seen a
This is question about MVC web-app architecture, and how it can be extended to
I currently use CodeIgniter as my framework of choice when using PHP. One of
The reason I am asking this question is because I have landed my first
I apologize if this question is a duplicate. I have read many other mysqli
I have just stumbled upon Bad Behavior - a plugin for PHP that promises

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.