_field = new Solarium_Query_Select_Component_Stats_Field; } public function testConfigMode() { $options = array( 'facet' => 'field1, field2', ); $this->_field->setOptions($options); $this->assertEquals(array('field1','field2'), $this->_field->getFacets()); } public function testSetAndGetKey() { $this->_field->setKey('testkey'); $this->assertEquals('testkey', $this->_field->getKey()); } public function testAddFacet() { $expectedFacets = $this->_field->getFacets(); $expectedFacets[] = 'newfacet'; $this->_field->addFacet('newfacet'); $this->assertEquals($expectedFacets, $this->_field->getFacets()); } public function testClearFacets() { $this->_field->addFacet('newfacet'); $this->_field->clearFacets(); $this->assertEquals(array(), $this->_field->getFacets()); } public function testAddFacets() { $facets = array('facet1','facet2'); $this->_field->clearFacets(); $this->_field->addFacets($facets); $this->assertEquals($facets, $this->_field->getFacets()); } public function testAddFacetsAsStringWithTrim() { $this->_field->clearFacets(); $this->_field->addFacets('facet1, facet2'); $this->assertEquals(array('facet1','facet2'), $this->_field->getFacets()); } public function testRemoveFacet() { $this->_field->clearFacets(); $this->_field->addFacets(array('facet1','facet2')); $this->_field->removeFacet('facet1'); $this->assertEquals(array('facet2'), $this->_field->getFacets()); } public function testSetFacets() { $this->_field->clearFacets(); $this->_field->addFacets(array('facet1','facet2')); $this->_field->setFacets(array('facet3','facet4')); $this->assertEquals(array('facet3','facet4'), $this->_field->getFacets()); } }