• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

PHPUnit on Proxy Classes (XFCP)

#1
is it possible to use unit tests on XFCP_ControllerPublic_XXX classes?

these are my settings
phpunit.xml
PHP:
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="false"
         backupStaticAttributes="true"
         colors="false"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false"
         syntaxCheck="false"
         verbose="true"
         strict="true"
         bootstrap="initialize.php"
>

    <testsuites>
        <testsuite name="XF Tests">
            <directory>./tests/tests</directory>
        </testsuite>
    </testsuites>

</phpunit>
initialize.php
PHP:
// Assuming 'tests' directory in XF install
$xfLibrary = dirname(__FILE__) . '/../../library/';

// Initialize the xenforo autoloader
require_once($xfLibrary . 'XenForo/Autoloader.php');
XenForo_Autoloader::getInstance()->setupAutoloader($xfLibrary);

// Initialize XenForo App
XenForo_Application::initialize($xfLibrary, dirname(__FILE__) . '/../..');

unset($xfLibrary);
it is possible test models
PHP:
$postModel = XenForo_Model::create('XenForo_Model_Post');
$postModel-> MyCustmMethod('aaa');
but you know you cant load controllers like this.
is there any possible way to do this?