authclassname = 'TestAuthClass'.mt_rand(); sugar_mkdir("custom/modules/Users/authentication/{$this->authclassname}/",null,true); sugar_file_put_contents( "custom/modules/Users/authentication/{$this->authclassname}/{$this->authclassname}.php", "authclassname} extends SugarAuthenticate { public \$userAuthenticateClass = '{$this->authclassname}User'; public \$authenticationDir = '{$this->authclassname}'; public function _construct(){ parent::SugarAuthenticate(); } }" ); sugar_file_put_contents( "custom/modules/Users/authentication/{$this->authclassname}/{$this->authclassname}User.php", "authclassname}User extends SugarAuthenticateUser { }" ); } public function tearDown() { if ( !is_null($this->authclassname) && is_dir("custom/modules/Users/authentication/{$this->authclassname}/") ) rmdir_recursive("custom/modules/Users/authentication/{$this->authclassname}/"); } public function testLoadingCustomAuthClassFromAuthenicationController() { $authController = new AuthenticationController($this->authclassname); $this->assertInstanceOf($this->authclassname,$authController->authController); $this->assertInstanceOf($this->authclassname.'User',$authController->authController->userAuthenticate); } }