1<?php 2/** 3 * Copyright 2012-2016 Horde LLC (http://www.horde.org/) 4 * 5 * See the enclosed file COPYING for license information (LGPL). If you 6 * did not receive this file, see http://www.horde.org/licenses/lgpl21. 7 * 8 * @category Horde 9 * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 10 * @package SpellChecker 11 */ 12 13/** 14 * Tests for IMAP mailbox sorting. 15 * 16 * @author Michael Slusarz <slusarz@horde.org> 17 * @category Horde 18 * @ignore 19 * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 20 * @package SpellChecker 21 */ 22class Horde_SpellChecker_AspellTest extends PHPUnit_Framework_TestCase 23{ 24 protected $aspell; 25 26 public function setUp() 27 { 28 $aspell = trim(`which aspell`); 29 if (!is_executable($aspell)) { 30 $aspell = trim(`which ispell`); 31 } 32 33 if (!is_executable($aspell)) { 34 $this->markTestSkipped('No aspell/ispell binary found.'); 35 } 36 37 $this->aspell = new Horde_SpellChecker_Aspell(array( 38 'path' => $aspell 39 )); 40 } 41 42 public function testAspell() 43 { 44 $res = $this->aspell->spellCheck('some tet [mispeled] ?'); 45 46 $this->assertNotEmpty($res); 47 $this->assertNotEmpty($res['bad']); 48 $this->assertEquals( 49 $res['bad'], 50 array('tet', 'mispeled') 51 ); 52 $this->assertNotEmpty($res['suggestions']); 53 $this->assertNotEmpty($res['suggestions'][0]); 54 $this->assertNotEmpty($res['suggestions'][1]); 55 } 56 57} 58