PageRenderTime 47ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://bitbucket.org/anycode/sfluceneplugin
PHP | 46 lines | 26 code | 7 blank | 13 comment | 0 complexity | 0802e76af65a1fb03612821b1d5d3f61 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?php
  2. /*
  3. * This file is part of the sfLucenePlugin package
  4. * (c) 2007 - 2008 Carl Vondrick <carl@carlsoft.net>
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. /**
  10. * @package sfLucenePlugin
  11. * @subpackage Test
  12. * @author Carl Vondrick
  13. * @version SVN: $Id: sfLuceneHighlighterMarkerHarnessTest.php 7108 2008-01-20 07:44:42Z Carl.Vondrick $
  14. */
  15. require dirname(__FILE__) . '/../../../bootstrap/unit.php';
  16. $t = new limeade_test(6, limeade_output::get());
  17. $limeade = new limeade_sf($t);
  18. $app = $limeade->bootstrap();
  19. $lighters = array(
  20. new sfLuceneHighlighterMarkerDry(),
  21. new sfLuceneHighlighterMarkerUppercase(),
  22. new sfLuceneHighlighterMarkerSprint('[h]%s[/h]'),
  23. );
  24. try {
  25. $harness = new sfLuceneHighlighterMarkerHarness($lighters);
  26. $t->pass('__construct() accepts an array of highlighters');
  27. } catch (Exception $e) {
  28. $t->fail('__construct() accepts an array of highlighters');
  29. }
  30. try {
  31. new sfLuceneHighlighterMarkerHarness(array());
  32. $t->fail('__construct() rejects an empty array of highlighters');
  33. } catch (Exception $e) {
  34. $t->pass('__construct() rejects an empty array of highlighters');
  35. }
  36. $t->is($harness->getHighlighter(), $lighters[0], '->getHighlighter() returns the first highlighter initially');
  37. $t->is($harness->getHighlighter(), $lighters[1], '->getHighlighter() increments the internal pointer');
  38. $t->is($harness->getHighlighter(), $lighters[2], '->getHighlighter() reaches the end of the array');
  39. $t->is($harness->getHighlighter(), $lighters[0], '->getHighlighter() returns to the first highlighter at the end');