<commit_before><?php


/**
 * Class DataObjectAnnotatorTest
 */
class DataObjectAnnotatorTest extends SapphireTest
{

    /**
     * @var $annotator MockDataObjectAnnotator
     */
    private $annotator = null;

    /**
     * Setup Defaults
     */
    public function setUp()
    {
        parent::setUp();
        Config::inst()->update('DataObjectAnnotator', 'enabled', true);
        Config::inst()->update('DataObjectAnnotator', 'enabled_modules', array('ideannotator'));

        $this->annotator = MockDataObjectAnnotator::create();
    }

    /**
     * Test is a module name is in the @Config enabled_modules
     * and will be seen as allowed or disallowed correctly
     */
    public function testModuleIsAllowed()
    {
        Config::inst()->update('DataObjectAnnotator', 'enabled', true);

        $this->assertFalse($this->annotator->moduleIsAllowed('framework'));
        $this->assertTrue($this->annotator->moduleIsAllowed('mysite'));
        $this->assertTrue($this->annotator->moduleIsAllowed('ideannotator'));
    }

    /**
     * Test if a DataObject is in an allowed module name
     * and will be seen as allowed or disallowed correctly
     */
    public function testDataObjectIsAllowed()
    {
        $this->assertTrue($this->annotator->classNameIsAllowed('DataObjectAnnotatorTest_Team'));
        $this->assertTrue($this->annotator->classNameIsAllowed('DataObjectAnnotatorTest_Team_Extension'));

        $this->assertFalse($this->annotator->classNameIsAllowed('DataObject'));
        $this->assertFalse($this->annotator->classNameIsAllowed('File'));

        Config::inst()->remove('DataObjectAnnotator', 'enabled_modules');
        Config::inst()->update('DataObjectAnnotator', 'enabled_modules', array('mysite'));

        $this->assertFalse($this->annotator->classNameIsAllowed('DataObjectAnnotatorTest_Team'));
    }

    /**
     * Test if the correct annotations are generated
     * for all database fields, relations and extensions
     * and that the start and end tags are present
     */
    public function testFileContentWithAnnotations()
    {<commit_msg>add extension to test setup<commit_after><?php


/**
 * Class DataObjectAnnotatorTest
 */
class DataObjectAnnotatorTest extends SapphireTest
{

    /**
     * @var $annotator MockDataObjectAnnotator
     */
    private $annotator = null;

    /**
     * Setup Defaults
     */
    public function setUp()
    {
        parent::setUp();
        Config::inst()->update('DataObjectAnnotator', 'enabled', true);
        Config::inst()->update('DataObjectAnnotator', 'enabled_modules', array('ideannotator'));

        Config::inst()->update('DataObjectAnnotatorTest_Team' , 'extensions',
            array('DataObjectAnnotatorTest_Team_Extension')
        );

        $this->annotator = MockDataObjectAnnotator::create();
    }

    /**
     * Test is a module name is in the @Config enabled_modules
     * and will be seen as allowed or disallowed correctly
     */
    public function testModuleIsAllowed()
    {
        $this->assertFalse($this->annotator->moduleIsAllowed('framework'));
        $this->assertTrue($this->annotator->moduleIsAllowed('mysite'));
        $this->assertTrue($this->annotator->moduleIsAllowed('ideannotator'));
    }

    /**
     * Test if a DataObject is in an allowed module name
     * and will be seen as allowed or disallowed correctly
     */
    public function testDataObjectIsAllowed()
    {
        $this->assertTrue($this->annotator->classNameIsAllowed('DataObjectAnnotatorTest_Team'));
        $this->assertTrue($this->annotator->classNameIsAllowed('DataObjectAnnotatorTest_Team_Extension'));

        $this->assertFalse($this->annotator->classNameIsAllowed('DataObject'));
        $this->assertFalse($this->annotator->classNameIsAllowed('File'));

        Config::inst()->remove('DataObjectAnnotator', 'enabled_modules');
        Config::inst()->update('DataObjectAnnotator', 'enabled_modules', array('mysite'));

        $this->assertFalse($this->annotator->classNameIsAllowed('DataObjectAnnotatorTest_Team'));
    }

    /**
     * Test if the correct annotations are generated
     * for all database fields, relations and extensions
     * and that the start and end tags are present
     */
    public function testFileContentWithAnnotations()
    {
{'fraction_non_alphanumeric': 0.13311612753083546, 'fraction_numerical': 0.0, 'mean_word_length': 3.5577942735949097, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 63, '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': '5505428', 'n_tokens_mistral': 1149, 'n_tokens_neox': 1152, 'n_words': 230}