<commit_before><?php

namespace Atrapalo\PHPTools\Enum;

use Atrapalo\PHPTools\Parser\PHPDocClass;

/**
 * Class EnumPHPDocTester
 * @package Atrapalo\PHPTools\Enum
 *
 * @author <NAME> <<EMAIL>>
 */
trait EnumPHPDocTester
{
    /**
     * @return string
     */
    abstract protected function enumClass(): string;

    /**
     * @test
     */
    public function staticAccessByPhpDoc()
    {
        $className = $this->enumClass();

        $staticMethods = PHPDocClass::staticMethods($className);
        if (!empty($staticMethods)) {
            foreach ($staticMethods as $staticMethod) {
                $data = call_user_func([$className, $staticMethod->name()]);

                $this->assertInstanceOf($className, $data);
            }
        } else {
            $this->markTestSkipped('Skipped because no static methods were found');
        }
    }

    /**
     * @test
     */
    public function accessByPhpDoc()
    {
        $className = $this->enumClass();

        $methods = PHPDocClass::methods($className);
        if (!empty($methods)) {

            $enum = $this->createValidEnum($className);
            $actualMethod = $this->snakeCaseToCamelCase("IS_".$enum->key());
            foreach ($methods as $method) {
                $methodName = $method->name();
                if ($methodName === $actualMethod) {
                    $this->assertTrue($enum->$methodName());
                } else {
                    $this->assertFalse($enum->$methodName());
                }
            }
        } else {
            $this->markTestSkipped('Skipped because no methods were found');
        }
    }

    /**<commit_msg>Fix for more information on testing<commit_after><?php

namespace Atrapalo\PHPTools\Enum;

use Atrapalo\PHPTools\Parser\PHPDocClass;

/**
 * Class EnumPHPDocTester
 * @package Atrapalo\PHPTools\Enum
 *
 * @author <NAME> <<EMAIL>>
 */
trait EnumPHPDocTester
{
    /**
     * @return string
     */
    abstract protected function enumClass(): string;

    /**
     * @test
     */
    public function staticAccessByPhpDoc()
    {
        $className = $this->enumClass();

        $staticMethods = PHPDocClass::staticMethods($className);
        if (!empty($staticMethods)) {
            foreach ($staticMethods as $staticMethod) {
                $data = call_user_func([$className, $staticMethod->name()]);

                $this->assertInstanceOf($className, $data);
            }
        } else {
            $this->markTestSkipped('Skipped because no static methods were found for '.get_called_class());
        }
    }

    /**
     * @test
     */
    public function accessByPhpDoc()
    {
        $className = $this->enumClass();

        $methods = PHPDocClass::methods($className);
        if (!empty($methods)) {

            $enum = $this->createValidEnum($className);
            $actualMethod = $this->snakeCaseToCamelCase("IS_".$enum->key());
            foreach ($methods as $method) {
                $methodName = $method->name();
                if ($methodName === $actualMethod) {
                    $this->assertTrue($enum->$methodName());
                } else {
                    $this->assertFalse($enum->$methodName());
                }
            }
        } else {
            $this->markTestSkipped('Skipped because no methods were found for '.get_called_class());
        }
    }

    /**
{'fraction_non_alphanumeric': 0.14336492890995262, 'fraction_numerical': 0.0, 'mean_word_length': 1.9937943262411348, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 37, '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': '7563137', 'n_tokens_mistral': 964, 'n_tokens_neox': 941, 'n_words': 171}