<commit_before><?php

class ModuleManagerTest extends PHPUnit_Framework_TestCase
{

    const sampleName1 = "mymodule1";

    const sampleName2 = "mymodule2";

    const sampleVersion1 = "1.0";

    const sampleVersion2 = "2.0";

    public function testCreateAndEditModule1()
    {
        $manager = new ModuleManager();
        
        $module = new Module();
        $module->setName(self::sampleName1);
        $module->setVersion(self::sampleVersion1);
        $module->save();
        
        $allModules = $manager->getAllModuleNames();
        
        $this->assertTrue(faster_in_array(self::sampleName1, $allModules));
        
        $module = new Module(self::sampleName1);
        $this->assertEquals(self::sampleName1, $module->getName());
        $this->assertEquals(self::sampleVersion1, $module->getVersion());
        $this->assertFalse($module->isEnabled());
        $module->setVersion(self::sampleVersion2);
        $module->save();
        
        $module = new Module(self::sampleName1);
        $this->assertEquals(self::sampleVersion2, $module->getVersion());
        $module->enable();
        
        $module = new Module(self::sampleName1);
        
        $this->assertTrue($module->isEnabled());
        $module->disable();
        
        $module = new Module(self::sampleName1);
        $this->assertFalse($module->isEnabled());
        
        $module = new Module(self::sampleName1);
        
        $module = new Module();
        $module->setName(self::sampleName2);
        $module->setVersion(self::sampleVersion2);
        $module->save();
        
        $allModules = $manager->getAllModuleNames();
        
        $this->assertTrue(faster_in_array(self::sampleName1, $allModules));
        $this->assertTrue(faster_in_array(self::sampleName2, $allModules));
        
        $module = new Module(self::sampleName1);
        $module->delete();
        
        $allModules = $manager->getAllModuleNames();
        $this->assertFalse(faster_in_array(self::sampleName1, $allModules));
        
        $module = new Module(self::sampleName2);
        $module->delete();
        
        $allModules = $manager->getAllModuleNames();
        $this->assertFalse(faster_in_array(self::sampleName2, $allModules));
    }

    public function testSync()
    {
        $this->fail("Test not implemented Yet");
    }
}<commit_msg>Test testInitialSync implementiert.<commit_after><?php

class ModuleManagerTest extends PHPUnit_Framework_TestCase
{

    const sampleName1 = "mymodule1";

    const sampleName2 = "mymodule2";

    const sampleVersion1 = "1.0";

    const sampleVersion2 = "2.0";

    public function testCreateAndEditModule1()
    {
        $manager = new ModuleManager();
        
        $module = new Module();
        $module->setName(self::sampleName1);
        $module->setVersion(self::sampleVersion1);
        $module->save();
        
        $allModules = $manager->getAllModuleNames();
        
        $this->assertTrue(faster_in_array(self::sampleName1, $allModules));
        
        $module = new Module(self::sampleName1);
        $this->assertEquals(self::sampleName1, $module->getName());
        $this->assertEquals(self::sampleVersion1, $module->getVersion());
        $this->assertFalse($module->isEnabled());
        $module->setVersion(self::sampleVersion2);
        $module->save();
        
        $module = new Module(self::sampleName1);
        $this->assertEquals(self::sampleVersion2, $module->getVersion());
        $module->enable();
        
        $module = new Module(self::sampleName1);
        
        $this->assertTrue($module->isEnabled());
        $module->disable();
        
        $module = new Module(self::sampleName1);
        $this->assertFalse($module->isEnabled());
        
        $module = new Module(self::sampleName1);
        
        $module = new Module();
        $module->setName(self::sampleName2);
        $module->setVersion(self::sampleVersion2);
        $module->save();
        
        $allModules = $manager->getAllModuleNames();
        
        $this->assertTrue(faster_in_array(self::sampleName1, $allModules));
        $this->assertTrue(faster_in_array(self::sampleName2, $allModules));
        
        $module = new Module(self::sampleName1);
        $module->delete();
        
        $allModules = $manager->getAllModuleNames();
        $this->assertFalse(faster_in_array(self::sampleName1, $allModules));
        
        $module = new Module(self::sampleName2);
        $module->delete();
        
        $allModules = $manager->getAllModuleNames();
        $this->assertFalse(faster_in_array(self::sampleName2, $allModules));
    }

    public function testInitialSync()
    {
        $manager = new ModuleManager();
        
        Database::query("truncate table {prefix}modules", true);
        $this->assertEquals(0, count($manager->getAllModules()));
        $manager->sync();
        $this->assertGreaterThanOrEqual(20, count($manager->getAllModules()));
        $this->assertEquals(count(getAllModules()), count($manager->getAllModules()));
    }
}
{'fraction_non_alphanumeric': 0.15070643642072212, 'fraction_numerical': 0.012755102040816327, 'mean_word_length': 2.7204379562043797, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 77, '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': '5541040', 'n_tokens_mistral': 1435, 'n_tokens_neox': 1441, 'n_words': 204}