Calling a method of a Test Class from another Test class

I am using PHPUnit to unit test my application (using Zend Framework 2). I am stuck in a situation where I need to call a method that is in one test class from another test class. Let me explain myself with a small example:

<?php
// TestUser.php
namespace Test\\User;

class UserTest extends \\PHPUnit_Framework_TestCase
{

    public static function GetUserCount(){

        // some code here

    }

}

?>

<?php
// TestAdmin.php
namespace Test\\Admin;

use Test\\User;

class AdminTest extends \\PHPUnit_Framework_TestCase
{

    public static function AdminAction(){

        Test\\User::GetUserCount();

    }

}

?>

When I call the Test\User::GetUserCount(); or User::GetUserCount(); I get the following error:

PHP Fatal error: Class ‘Test\User’ not found in path/to/TestAdmin.php on line 11

Any idea if the method is callable from one test class to another test class? If yes, how?

Thanks

In your example it would be

User\UserTest::GetUserCount();
or
\Test\User\UserTest::GetUserCount();

or
use Test\User\UserTest;
at the top of your TestAdmin file, then
UserTest::GetUserCount();

As long as you have autoloading, it should work. Otherwise, you should include_once the UserTest file first.