コード例 #1
0
 /**
  * execute tests
  */
 public function test($action, $context)
 {
     $action = us($action);
     $temp_dir = Charcoal_ResourceLocator::getApplicationPath(s('tmp'));
     switch ($action) {
         case "get_section":
             $ini_data = parse_ini_file($temp_dir . '/test.ini', true);
             $config = new Charcoal_Config($this->getSandbox()->getEnvironment(), $ini_data);
             $first_section = $config->getSection(s('first_section'));
             $second_section = $config->getSection(s('second_section'));
             $third_section = $config->getSection(s('third_section'));
             $this->assertEquals(1, $first_section['one']);
             $this->assertEquals(5, $first_section['five']);
             $this->assertEquals('BIRD', $first_section['animal']);
             $this->assertEquals("/usr/local/bin", $second_section['path']);
             $this->assertEquals("http://www.example.com/~username", $second_section['URL']);
             $this->assertEquals(array("5.0", "5.1", "5.2", "5.3"), $third_section['phpversion']);
             return TRUE;
     }
     return FALSE;
 }