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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:49:33+00:00 2026-06-09T04:49:33+00:00

Is it possible to load multiple flat xml datasets on PHPUnit to load lots

  • 0

Is it possible to load multiple flat xml datasets on PHPUnit to load lots of fixtures?

We are writing a rather complex application and the xml dataset is getting pretty big, so I would like to slip it into 2-3 xml.

Here is the current code for a test case:

<?php

class My_TestBase extends Zend_Test_PHPUnit_DatabaseTestCase{ 

/**
 * Zend_Application
 * @var Zend_Application 
 */
protected $_application;

/**
 * Connection
 * 
 * @var Zend_Test_PHPUnit_Db_Connection
 */
private $_connection;

/**
 * Returns the test database connection.
 *
 * @link http://framework.zend.com/wiki/display/ZFPROP/Zend_Test_PHPUnit_Database+-+Benjamin+Eberlei
 * @return PHPUnit_Extensions_Database_DB_IDatabaseConnection
 */
protected function getConnection(){

    if($this->_connection === null){

        $Resources = $this->_application->getOption("resources");

        $conn = Zend_Db::factory($Resources["db"]["adapter"], $Resources["db"]["params"]);          
        $this->_connection = $this->createZendDbConnection($conn, $Resources["db"]["params"]["dbname"]);
    }

    return $this->_connection;
}


/**
 * Returns the test dataset.
 * 
 * @link http://framework.zend.com/wiki/display/ZFPROP/Zend_Test_PHPUnit_Database+-+Benjamin+Eberlei
 * @return PHPUnit_Extensions_Database_DataSet_IDataSet
 */
protected function getDataSet(){

    return $this->createFlatXMLDataSet(__DIR__."/seed_data.xml");
}

/**
 * Setup
 */
protected function setUp(){

    $this->_application = new Zend_Application(
        APPLICATION_ENV,
        APPLICATION_PATH . '/configs/application.ini'
    );
}   

}

  • 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-09T04:49:34+00:00Added an answer on June 9, 2026 at 4:49 am

    Dislaimer: The following will only work for yaml fixtures, for some reason the xml fixtures API DOES NOT afford the same functionality (checked source code), don’t ask me why, seems like we should be able to add multiple tables regardless of the fixture file format type.

    The API is a bit clumsy, and exactly why I don’t like passing args to constructors, especially in this case, but try the following (this was tested and worked):

    class MyTest extends PHPUnit_Extensions_Database_TestCase
    {
        protected function getDataset()
        {
            $primary = new PHPUnit_Extensions_Database_DataSet_YamlDataSet('etc/fixture/dbname/table1.yml');
    
            $primary->addYamlFile('etc/fixture/dbname/table2.yml');
            $primary->addYamlFile('etc/fixture/dbname/table3.yml');
    
            return $primary;
        }
    ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

is it possible to load multiple swf files directly on top of each other?
Is it possible to load multiple files from a project directory. For example, loading
Is it possible to load table creation scripts from flat files when creating the
maybe this question is a little silly, but is it possible to load multiple
Hoping someone can answer this one... Is it possible to load multiple JSON files
Is it possible to load multiple scripts with same variables/functions in JS, without overriding
Is it possible to load multiple assemblies into a new AppDomain and apply different
Is it possible to load multiple items at once through jquery using $.load? For
I am currently writing an application that will serve a similar purpose for multiple
I am trying to load a flat file which mixed multiple data sets. The

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.