DicFro Tests
Current file: D:\data\micmap\cgi-bin\dicfro\4.4.1\application\Model\Query\Whitaker.php
Legend: executed not executed dead code

  Coverage
  Classes Functions / Methods Lines
Total
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 2 / 2
100.00%100.00%
100.00% 9 / 9
 
Model_Query_Whitaker
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 2 / 2
100.00%100.00%
100.00% 9 / 9
 public function __construct($directory = '.')
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 2 / 2
 public function searchWords($word)
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 7 / 7


       1                 : <?php                                                                                                      
       2                 :                                                                                                            
       3                 : /**                                                                                                        
       4                 :  * Dictionaries of Old French and Latin                                                                    
       5                 :  *                                                                                                         
       6                 :  * PHP 5                                                                                                   
       7                 :  *                                                                                                         
       8                 :  * @category  Application                                                                                  
       9                 :  * @package   DicFro                                                                                       
      10                 :  * @author    Michel Corne <mcorne@yahoo.com>                                                              
      11                 :  * @copyright 2008-2010 Michel Corne                                                                       
      12                 :  * @license   http://opensource.org/licenses/gpl-3.0.html GNU General Public License, version 3 (GPLv3)    
      13                 :  * @link      http://www.micmap.org/dicfro                                                                 
      14                 :  */                                                                                                        
      15                 :                                                                                                            
      16                 : require_once 'Model/Query.php';                                                                            
      17                 :                                                                                                            
      18                 : /**                                                                                                        
      19                 :  * Queries the Whitaker database                                                                           
      20                 :  *                                                                                                         
      21                 :  * @category  Application                                                                                  
      22                 :  * @package   DicFro                                                                                       
      23                 :  * @author    Michel Corne <mcorne@yahoo.com>                                                              
      24                 :  * @copyright 2008-2010 Michel Corne                                                                       
      25                 :  * @license   http://opensource.org/licenses/gpl-3.0.html GNU General Public License, version 3 (GPLv3)    
      26                 :  */                                                                                                        
      27                 :                                                                                                            
      28                 : class Model_Query_Whitaker extends Model_Query                                                             
      29                 : {                                                                                                          
      30                 :     /**                                                                                                    
      31                 :      * Constructor                                                                                         
      32                 :      *                                                                                                     
      33                 :      * @param  string $directory the dictionaries directory                                                
      34                 :      * @return void                                                                                        
      35                 :      */                                                                                                    
      36                 :     public function __construct($directory = '.')                                                          
      37                 :     {                                                                                                      
      38               4 :         parent::__construct($directory . '/whitaker');                                                     
      39               4 :     }                                                                                                      
      40                 :                                                                                                            
      41                 :     /**                                                                                                    
      42                 :      * Searches a word form                                                                                
      43                 :      *                                                                                                     
      44                 :      * @param  string $word the word form to search                                                        
      45                 :      * @return array  the list of words matching that form                                                 
      46                 :      */                                                                                                    
      47                 :     public function searchWords($word)                                                                     
      48                 :     {                                                                                                      
      49               4 :         $string = new Common_String;                                                                       
      50               4 :         $latin = $string->toLatin($word);                                                                  
      51                 :                                                                                                            
      52               4 :         $query = "SELECT DISTINCT info, frequency FROM word, entry ";                                      
      53               4 :         $query .= "WHERE latin = :latin AND entry.line = word.line ";                                      
      54               4 :         $query .= "ORDER BY frequency, info";                                                              
      55                 :                                                                                                            
      56               4 :         $result = $this->execute($query, array(':latin' => $latin), PDO::FETCH_COLUMN | PDO::FETCH_UNIQUE);
      57                 :                                                                                                            
      58               4 :         return array_keys($result);                                                                        
      59                 :     }                                                                                                      

Generated by PHPUnit 3.4.15 and Xdebug 2.1.0 using PHP 5.2.11 at Fri Oct 1 18:50:14 UTC 2010.