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 9318067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T03:01:28+00:00 2026-06-19T03:01:28+00:00

Is it possible to have configuration differences in the PHPUnit XML file that are

  • 0

Is it possible to have configuration differences in the PHPUnit XML file that are processed at runtime so as to configure settings based on platform of execution? For instance, use Color on Ubuntu, but not in Windows.

To explain:

I have different development platforms being used, and want to ensure that our code works for web servers on either platform. Also, the tools we use are on different platforms. For instance, the inhouse backend servers for the Developers (PHPUnit, PHPDocs, Wiki, other tools) are on a Ubuntu computer. The developers actively use Windows based PCs.

When a developer changes code, we want them to be able to test that their code works before checking it into our repository. Therefore, they run PHPUnit, PHP_CodeSniffer, PHPMD and PHPDocs on their local machine to see things are okay to commit.

The main system then, will see the code committed, and will re-run these tests in conjunction with everyone elses code changes on the Ubuntu machine, update the company wide pages with test results, code coverage, etc… These tests may even be run on different computers with different OS/Language configurations. Web Browser testing via Selenium is also started at this point, again, across many different Web Server/OS/Browser versions.

As we introduce new tools, different projects, etc…, the XML files are changing with exclude files, test suite configurations etc… As such, we keep this file in the source tree to ensure the developers have the latest settings when running their tests.

I want to be able to configure some settings differently by platform (that would work for all our combinations as I could set whatever variable is being used) without having to have different files that are then copied after the source to ensure the changes are received.

Is this reasonable, or would using something like Jenkins help me avoid this issue? However, I am trying to keep the tools on the Windows PC as basic as possible to facilitate letting the developers run them quickly, or they will ignore the step.

  • 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-19T03:01:29+00:00Added an answer on June 19, 2026 at 3:01 am

    This answer turned to be longer than expected but it is appropriate. The quick answer is to just build different config files.
    phpunitwindows7.xml

    phpunitubuntu.xml

    phpunitmacosx.xml

    etc…

    But I think your problem is that there are so many different configs that doing this would be a lot of maintenance so what I would do first is build an object with the settings that I wanted. load a base phpunit.xml into a SimpleXML object

    $sxe = simplexml_load_file('phpunit.xml);
    // Modify a node
    $sxe->phpunit = '<tessuites....>';
    
    // You can access an element's attribute just like this :
    $attribute = $sxe->phpunit->attributes()->$att;
    
    $sxe->phpunit->attributes()->$verbose = $phpunitSettings->verbose;
    
    // Saving the whole modified XML to a new filename
    $sxe->asXml('windows7-cookie-cutter-phpunit.xml');
    

    Each developer would have their build configs set to whichever phpunit config file appropriate based on their os / project etc.

    Jenkins will of course help you do this because you could run this script in your Ant build file to update these phpunit config files before phpunit runs instead of running it manually.

    Another thing you might do is to use the

    <?php 
        header ("Content-Type:text/xml");
    ?>
    

    to show a dynamic file like this

    <phpunit setting="<?php echo $setting; ?>"
    
    ><!-- yada yada-->
    </phpunit>
    

    The dynamic file would still have to be accessed by the php script but could be easily done with cUrl to get the content exe:

    http://yoursite.com/apps/phpunit-config.php?os=windows7&project=cookiecutterblog

    Also if you have jenkins installed on the developer machines it can be set to run every hour/day with Poll SCM so it wouldn’t matter if they wanted to use it or not, it would still be used without them even knowing it!

    enter image description here

    If you are using the MakeGood extension in eclipse you can preload the script to update the phpunit config file.

    make good

    Which can be loaded and easily run in the IDE every time a file is edited and then saved
    enter image description here

    Here’s a MakeGood IDE setup tutorial which I put together.

    I’m not sure it would be possible to be easier for the devs since they wouldn’t do anything at all…

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

Sidebar

Related Questions

Is it possible to have an external configuration file defined in the IPA that
Is it possible to have both the XML + Annotation based configuration for MyBatis
I am told that the configuration below is possible, but have had significant difficulty
If I have a PropertyPlaceholderConfigurer coming via an XML file, is it possible to
I have a configuration XML file. some nodes are used for computation purpose and
is it possible to have app.config file like this : <?xml version=1.0 encoding=utf-8 ?>
Is it possible to have grails re-read its configuration files based on a trigger
Is it possible to have a free iPhone app that has say an initial
Is it possible to have a conditional installation configuration, slaved wth the Visual Studio
I have this configuration in ibatis-config.xml <configuration> <properties resource=collector.properties/> <environments default=development> <environment id=development> <transactionManager

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.