sfluceneplugin /test/unit/highlighter/marker/sfLuceneHighlighterMarkerHarnessTest.php

Language PHP Lines 46
MD5 Hash 0802e76af65a1fb03612821b1d5d3f61 Estimated Cost $538 (why?)
Repository https://bitbucket.org/anycode/sfluceneplugin.git View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/*
 * This file is part of the sfLucenePlugin package
 * (c) 2007 - 2008 Carl Vondrick <carl@carlsoft.net>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
  * @package sfLucenePlugin
  * @subpackage Test
  * @author Carl Vondrick
  * @version SVN: $Id: sfLuceneHighlighterMarkerHarnessTest.php 7108 2008-01-20 07:44:42Z Carl.Vondrick $
  */

require dirname(__FILE__) . '/../../../bootstrap/unit.php';

$t = new limeade_test(6, limeade_output::get());
$limeade = new limeade_sf($t);
$app = $limeade->bootstrap();

$lighters = array(
  new sfLuceneHighlighterMarkerDry(),
  new sfLuceneHighlighterMarkerUppercase(),
  new sfLuceneHighlighterMarkerSprint('[h]%s[/h]'),
);

try {
  $harness = new sfLuceneHighlighterMarkerHarness($lighters);
  $t->pass('__construct() accepts an array of highlighters');
} catch (Exception $e) {
  $t->fail('__construct() accepts an array of highlighters');
}

try {
  new sfLuceneHighlighterMarkerHarness(array());
  $t->fail('__construct() rejects an empty array of highlighters');
} catch (Exception $e) {
  $t->pass('__construct() rejects an empty array of highlighters');
}

$t->is($harness->getHighlighter(), $lighters[0], '->getHighlighter() returns the first highlighter initially');
$t->is($harness->getHighlighter(), $lighters[1], '->getHighlighter() increments the internal pointer');
$t->is($harness->getHighlighter(), $lighters[2], '->getHighlighter() reaches the end of the array');
$t->is($harness->getHighlighter(), $lighters[0], '->getHighlighter() returns to the first highlighter at the end');
Back to Top