/**
  * This parses all the JSON configuration files in the addon directory and
  * returns the addons.
  *
  * @param SolrSearch_Addon_Config $config The configuration parser. If
  * null, this is created.
  *
  * @return array of SolrSearch_Addon_Addon
  * @author Eric Rochester <*****@*****.**>
  **/
 public function parseAll($config = null)
 {
     if (is_null($config)) {
         $config = new SolrSearch_Addon_Config($this->db);
     }
     if (is_null($this->addons)) {
         $this->addons = array();
     }
     $this->addons = array_merge($this->addons, $config->parseDir($this->addonDir));
     return $this->addons;
 }
 /**
  * This tests parsing a config file to a a SolrSearch_Addon.
  **/
 public function testParse()
 {
     $config = new SolrSearch_Addon_Config($this->db);
     $addons = $config->parseString(self::$config_json);
     $this->assertCount(2, $addons);
     $this->assertArrayHasKey('exhibits', $addons);
     $this->assertArrayHasKey('sections', $addons);
     // EXHIBITS
     // --------------------------------------------------------------------
     $a = $addons['exhibits'];
     $this->assertAddon($a, 'exhibits', 'Exhibits', 'Exhibits', 'eid', null, null, true, 'public', 3, 1);
     $this->assertField($a->fields[0], 'title', 'title', false, false);
     $this->assertField($a->fields[1], 'description', 'description', false, false);
     $this->assertField($a->fields[2], 'featured', 'Featured Exhibits', true, false);
     $this->assertEquals('sections', $a->children[0]->name);
     // SECTIONS
     // --------------------------------------------------------------------
     $a = $addons['sections'];
     $this->assertAddon($a, 'sections', null, 'Sections', 'id', 'exhibits', 'exhibit_id', false, null, 3, 0);
     $this->assertField($a->fields[0], 'name', 'Name', false, true);
     $this->assertField($a->fields[1], 'description', 'description', false, false);
     $this->assertField($a->fields[2], 'pagetitle', 'Page Title', false, false, array('table' => 'ExhibitPageBlock', 'key' => 'page_id'));
 }