Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

Multiple data set files support in PHPUnit_Extensions_Database_TestCase #6

Open
sebastianbergmann opened this issue May 25, 2010 · 4 comments

Comments

@sebastianbergmann
Copy link
Owner

Copied from http://www.phpunit.de/ticket/724

@elyobo
Copy link

elyobo commented Oct 19, 2010

I have the same problem; I have some data which is common to several different tests, and when I want to change it I need to go modify it in several different places.

It seems to me that this would be easily by supporting external html entities; this requires only one change to the simplexml_load_file call, adding the LIBXML_NOENT argument.

We can then do things like

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE dataset [
    <!ENTITY someFileOne SYSTEM "./someFileOne.xml">
    <!ENTITY someFileTwo SYSTEM "./someFileTwo.xml">
]>
<dataset>
    &someFileOne;
    &someFileTwo;
</dataset>

I have changed the simplexml_load_file call from
$this->xmlFileContents = @simplexml_load_file($xmlFile);
to
$this->xmlFileContents = @simplexml_load_file($xmlFile, null, LIBXML_NOENT);

and it seems to work fine (although my testing is very limited so far).

@elyobo
Copy link

elyobo commented Oct 19, 2010

Perhaps this can be enabled as an option when the dataset is created if there are compatibiltiy concerns.

@elyobo
Copy link

elyobo commented Oct 24, 2010

I'm not familiar with git, so I'm not sure how to provide it, but I have created a patch which adds an option to process the entities when creating the datasets; the change is trivial. If anyone can explain how I can attach a patch (or what other process I should follow) I'll provide the patch.

@elyobo
Copy link

elyobo commented Apr 5, 2011

I've implemented the change in my fork if that helps any other users that would like this simple feature.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants