<commit_before><?php

require_once (__DIR__."/../../module_system/system/class_testbase.php");

class class_test_generalActionTest extends class_testbase  {



    public function testAdminModules() {

        class_carrier::getInstance()->getObjRights()->setBitTestMode(true);

        //load all admin-classes
        $arrFiles = class_resourceloader::getInstance()->getFolderContent("/admin");

        foreach($arrFiles as $strOneFile) {
            if(preg_match("/class_module_(.*)_admin.php/i", $strOneFile)) {
                $strClassname = uniSubstr($strOneFile, 0, -4);

                $objAdminInstance = new $strClassname();
                $this->runSingleFile($objAdminInstance);
            }
        }

        class_carrier::getInstance()->getObjRights()->setBitTestMode(false);

    }



    public function testPortalModules() {


        class_carrier::getInstance()->getObjRights()->setBitTestMode(true);

        //load all admin-classes
        $arrFiles = class_resourceloader::getInstance()->getFolderContent("/portal");

        foreach($arrFiles as $strOneFile) {
            if(preg_match("/class_module_(.*)_portal.php/i", $strOneFile)) {
                $strClassname = uniSubstr($strOneFile, 0, -4);

                $objPortalInstance = new $strClassname(array());
                $this->runSingleFile($objPortalInstance);
            }
        }

        class_carrier::getInstance()->getObjRights()->setBitTestMode(false);

    }


    /**
     * @param interface_admin|interface_portal $objViewInstance
     */
    private function runSingleFile($objViewInstance) {

        $objReflection = new ReflectionClass($objViewInstance);
        $arrMethods = $objReflection->getMethods();

        $objAnnotations = new class_reflection(get_class($objViewInstance));

        //collect the autotestable annotations located on class-level
        foreach($objAnnotations->getAnnotationValuesFromClass("@autoTestable") as $strValue) {
            foreach(explode(",", $strValue) as $strOneMethod) {
                echo "found method ".get_class($objViewInstance)."@".$strOneMethod." marked as class-based @autoTestable, preparing call\n";
                echo "   calling via action() method\n";
                $objViewInstance->action($strOneMethod);
            }
        }


        /** @var ReflectionMethod $objOneMethod */
        foreach($arrMethods as $objOneMethod) {

            if($objAnnotations->hasMethodAnnotation($objOneMethod->getName(), "@autoTestable")) {
                echo "found method ".get_class($objViewInstance)."@".$objOneMethod->getName()." marked as @autoTestable, preparing call\n";

                if(uniSubstr($objOneMethod->getName(), 0, 6) == "action" && $objReflection->hasMethod("action")) {
                    echo "   calling via action() method\n";
                    $objViewInstance->action(uniSubstr($objOneMethod->getName(), 6));
                }
                else {
                    echo "   direct call";
                    $objOneMethod->invoke($objViewInstance);
                }
            }
        }

    }

}
<commit_msg>BUG: autotests skip abstract classes<commit_after><?php

require_once (__DIR__."/../../module_system/system/class_testbase.php");

class class_test_generalActionTest extends class_testbase  {



    public function testAdminModules() {

        class_carrier::getInstance()->getObjRights()->setBitTestMode(true);

        //load all admin-classes
        $arrFiles = class_resourceloader::getInstance()->getFolderContent("/admin");

        foreach($arrFiles as $strOneFile) {
            if(preg_match("/class_module_(.*)_admin.php/i", $strOneFile)) {
                $strClassname = uniSubstr($strOneFile, 0, -4);

                $objReflection = new ReflectionClass($strClassname);
                if($objReflection->isAbstract()) {
                    echo "skipping ".$strClassname.", is abstract...\n";
                    continue;
                }

                $objAdminInstance = new $strClassname();
                $this->runSingleFile($objAdminInstance);
            }
        }

        class_carrier::getInstance()->getObjRights()->setBitTestMode(false);

    }



    public function testPortalModules() {


        class_carrier::getInstance()->getObjRights()->setBitTestMode(true);

        //load all admin-classes
        $arrFiles = class_resourceloader::getInstance()->getFolderContent("/portal");

        foreach($arrFiles as $strOneFile) {
            if(preg_match("/class_module_(.*)_portal.php/i", $strOneFile)) {
                $strClassname = uniSubstr($strOneFile, 0, -4);

                $objReflection = new ReflectionClass($strClassname);
                if($objReflection->isAbstract()) {
                    echo "skipping ".$strClassname.", is abstract...\n";
                    continue;
                }

                $objPortalInstance = new $strClassname(array());
                $this->runSingleFile($objPortalInstance);
            }
        }

        class_carrier::getInstance()->getObjRights()->setBitTestMode(false);

    }


    /**
     * @param interface_admin|interface_portal $objViewInstance
     */
    private function runSingleFile($objViewInstance) {

        $objReflection = new ReflectionClass($objViewInstance);
        $arrMethods = $objReflection->getMethods();

        $objAnnotations = new class_reflection(get_class($objViewInstance));

        //collect the autotestable annotations located on class-level
        foreach($objAnnotations->getAnnotationValuesFromClass("@autoTestable") as $strValue) {
            foreach(explode(",", $strValue) as $strOneMethod) {
                echo "found method ".get_class($objViewInstance)."@".$strOneMethod." marked as class-based @autoTestable, preparing call\n";
                echo "   calling via action() method\n";
                $objViewInstance->action($strOneMethod);
            }
        }


        /** @var ReflectionMethod $objOneMethod */
        foreach($arrMethods as $objOneMethod) {

            if($objAnnotations->hasMethodAnnotation($objOneMethod->getName(), "@autoTestable")) {
                echo "found method ".get_class($objViewInstance)."@".$objOneMethod->getName()." marked as @autoTestable, preparing call\n";

                if(uniSubstr($objOneMethod->getName(), 0, 6) == "action" && $objReflection->hasMethod("action")) {
                    echo "   calling via action() method\n";
                    $objViewInstance->action(uniSubstr($objOneMethod->getName(), 6));
                }
                else {
                    echo "   direct call";
                    $objOneMethod->invoke($objViewInstance);
                }
            }
        }

    }

}

{'fraction_non_alphanumeric': 0.13269088213491476, 'fraction_numerical': 0.0020756115641215717, 'mean_word_length': 2.3512170889220068, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2132127', 'n_tokens_mistral': 1874, 'n_tokens_neox': 1755, 'n_words': 286}