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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:39:41+00:00 2026-05-24T16:39:41+00:00

I have this in my phpunit.xml file: <phpunit …> <testsuites> <testsuite name=MyTests> <directory>../path/to/some/tests</directory> </testsuite>

  • 0

I have this in my phpunit.xml file:

<phpunit ...>
    <testsuites>
        <testsuite name="MyTests">
            <directory>../path/to/some/tests</directory>
        </testsuite>
    </testsuites>
    ... // more settings for <filter> and <logging>
</phpunit>

And when I go to run it, I get this error:

PHP fatal error: Uncaught exception 'PHPUnit_Framework_Exception'
with message 'Neither "MyTests.php" nor "MyTests.php" could be opened.'

Why does PHPUnit give me this error, and why is it looking for “MyTests.php” if I gave it a directory in which to look for tests?

And on a related note, when I add more <testsuite> entries with other tests, PHPUnit runs without error. What’s up with that?

  • 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-24T16:39:42+00:00Added an answer on May 24, 2026 at 4:39 pm

    By default PHPUnit will add “all *Test classes that are found in *Test.php files” (see PHPUnit docs). If it doesn’t find any files matching that description, (e.g. a SomeTest.php file defining a SomeTest class), it falls back to looking for a file based on the name attribute of the test suite.

    The solution is to create a file matching that description so that PHPUnit doesn’t fall back to its default of searching by the testsuite name:

    <?php
    // in ../path/to/some/tests/SomeTest.php:
    class SomeTest extends PHPUnit_Framework_TestCase {
        public function test() {
            //... test cases here
        }
    }
    ?>
    

    Now you should be able to run phpunit without errors:

    $ phpunit
    PHPUnit 3.5.14 by Sebastian Bergmann.
    
    .
    
    Time: 0 seconds, Memory: 10.75Mb
    
    OK (1 test, 0 assertions)
    

    It will work without errors when you add more testsuite entries if PHPUnit is able to find matching test cases to run under those other suites. If it finds tests to run in any testsuite, it won’t resort to searching by the name attribute for the suites it couldn’t find anything for.

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

Sidebar

Related Questions

I have following, very simple, XML config for PHPUnit: <phpunit bootstrap=/_tests/TestAutoload.php> <testsuites> <testsuite name=Unit
I have the following Phing configuration file: <?xml version=1.0 encoding=UTF-8?> <project name=ru.fractalizer.phpsweetpdo default=make-phar-packages basedir=..>
I have a complex set of PHPUnit tests, some of which involve connecting to
Below is my phpunit.xml file. All methods of logging stop as soon as a
I have a suite of PHPUnit tests for my extension, and I want to
I have a series of PHPUnit tests that will need to connect to a
i have pear's phpunit installed (see image) I have that path in the include
i have just installed phpunit on my ubuntu. now i wan't to implement some
I followed this link http://www.phpunit.de/manual/3.6/en/database.html there i found some useful details of php db
I work on Windows 7, with phpunit & selenium & Firefox. I have this

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.