php - What ever happened to PHPUnit's Database Extension?

932

After upgrading to PHPUnit v > 3.5 (I forgot) I kept on getting this error because I imported PHPUnit/Extensions/Database/TestCase.php:

require_once(...): failed to open stream: No such file or directory

I peeked at the PHPUnit folder in my /usr/share/php folder only to find out it isn't there anymore.

In fact a look at the official source code reveals that it seems it has been removed.

So for now I am using version 3.4.15. But it's not ideal as assertions on the table are still not supported. For now I am only able to use the CLEAN_INSERT feature which populates my database.

372

Answer

Solution:

Your installation seems broken. PHPUnit 3.5 got split up in more seperate packages.

Usepear install phpunit/dbUnit to install that part.

Package overview: http://pear.phpunit.de/


Or to reinstall everything use:pear install --force --alldeps phpunit/phpunit


2013 update:

Just use to install PHPUnit. It's less hassle.

599

Answer

Solution:

Use this

pear install phpunit/PHPUnit_Story
661

Answer

Solution:

I solved this by installing db unit manually. I downloaded it from here. Then I replaced the incomplete Extensions/Database folder with the one from the download.

252

Answer

Solution:

For those that are running macports, you will have to install the php5-unit-db port to get the needed files. This did help me start looking in the right direction. This dep was not installed by default.

558

Answer

Solution:

This should solve all problems with installing PHPUnit:

pear install --alldeps --force phpunit/PHPUnit
834

Answer

Solution:

On the current stable PHPUnit (4.5), DbUnit is an optional package that can be installed with Composer: https://phpunit.de/manual/current/en/installation.html#installation.optional-packages

(click the "Composer" hyperlink if you're not familiar with Composer--I wasn't and it was easy to set up in about 10 minutes)

I struggled before I found that, but was running with an older version of PHPUnit, and had it in a few places, so I removed it from /usr/local/bin and /usr/bin and then followed the instructions "To globally install the PHAR" found here: https://phpunit.de/manual/4.5/en/installation.html

I didn't have much luck using pear to install PHPUnit.

(I'm on a Mac running Yosemite).

People are also looking for solutions to the problem: php - curl_multi_exec shows different runs

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.