[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/_test/tests/inc/ -> indexer_histogram.test.php (source)

   1  <?php
   2  /**
   3   * Tests the histogram function of the indexer.
   4   *
   5   * @author Michael Hamann <michael@content-space.de>
   6   */
   7  class indexer_histogram_test extends DokuWikiTest {
   8      function test_minlength() {
   9          $indexer = idx_get_indexer();
  10          $indexer->addMetaKeys('histo1', 'testkey', array('foo', 'bar', 'foobar'));
  11          $indexer->addMetaKeys('histo2', 'testkey', array('bar', 'testing'));
  12          $indexer->addMetaKeys('histo3', 'testkey', array('foo', 'foobar'));
  13          $histogram4 = $indexer->histogram(1, 0, 4, 'testkey');
  14          $this->assertEquals(array('foobar' => 2, 'testing' => 1), $histogram4);
  15          $histogram2 = $indexer->histogram(1, 0, 2, 'testkey');
  16          $this->assertEquals(array('foobar' => 2, 'testing' => 1, 'foo' => 2, 'bar' => 2), $histogram2);
  17      }
  18  
  19  }