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