コード例 #1
0
ファイル: facetTest.php プロジェクト: antidot/php_api
 public function testDefaultValues()
 {
     $facet = new AfsFacet('foo');
     $this->assertTrue($facet->get_id() == 'foo');
     $this->assertEquals(AfsFacetType::UNKNOWN_TYPE, $facet->get_type());
     $this->assertEquals(AfsFacetLayout::TREE, $facet->get_layout());
     $this->assertEquals(AfsFacetMode::UNSPECIFIED_MODE, $facet->get_mode());
     $this->assertFalse($facet->has_or_mode());
     $this->assertFalse($facet->has_and_mode());
     $this->assertFalse($facet->has_single_mode());
 }
コード例 #2
0
ファイル: afs_facet.php プロジェクト: antidot/php_api
 /** @brief Checks whether provided facet is similar to current instance.
  *
  * Two instances are considered similar when following values are equals:
  * - facet identifier,
  * - facet type (or one is of unknown type),
  * - facet layout (or one is of unknown layout).
  * Other facet parameters are not taken into account.
  *
  * @param $other [in] instance to compare with.
  * @return @c True when both instances are similar, @c false otherwise.
  */
 public function is_similar_to(AfsFacet $other)
 {
     if ($this->id == $other->get_id() && ($this->type == $other->get_type() || $this->type == AfsFacetType::UNKNOWN_TYPE || $other->get_type() == AfsFacetType::UNKNOWN_TYPE) && ($this->layout == $other->get_layout() || $this->type == AfsFacetLayout::UNKNOWN || $other->get_layout() == AfsFacetLayout::UNKNOWN)) {
         return true;
     } else {
         return false;
     }
 }