Current file: /home/greg/workspace/PHPDS-dev-trunk/PHPDevShell/stable/trunk/other/tests/unittests/framework/mock_connector.php
Legend: executed not executed dead code

  Coverage
  Classes Functions / Methods Lines
Total
50.00%50.00%
50.00% 1 / 2
28.57%28.57%
28.57% 4 / 14 CRAP
34.62%34.62%
34.62% 9 / 26
 
TEST_mock_connector
0.00%0.00%
0.00% 0 / 1
28.57%28.57%
28.57% 4 / 14
34.62%34.62%
34.62% 9 / 26
 free()
0.00%0.00%
0.00% 0 / 1 6
0.00%0.00%
0.00% 0 / 4
 connect()
100.00%100.00%
100.00% 1 / 1 1
100.00%100.00%
100.00% 2 / 2
 query($sql)
100.00%100.00%
100.00% 1 / 1 2
100.00%100.00%
100.00% 4 / 4
 protect($param)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 fetchAssoc()
100.00%100.00%
100.00% 1 / 1 2
100.00%100.00%
100.00% 2 / 2
 seek($row_number)
0.00%0.00%
0.00% 0 / 1 12
0.00%0.00%
0.00% 0 / 4
 numrows()
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 affectedRows()
100.00%100.00%
100.00% 1 / 1 1
100.00%100.00%
100.00% 1 / 1
 returnSqlError($query)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 debugInstance ($domain = null)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 lastId($reset = false)
0.00%0.00%
0.00% 0 / 1 6
0.00%0.00%
0.00% 0 / 2
 rowResults($row = 0)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 startTransaction()
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 endTransaction($commit = true)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
TEST_stubQuery
100.00%100.00%
100.00% 1 / 1
  
   
100.00%100.00%
100.00% 0 / 0


       1                 : <?php                                                                                        
       2                 :                                                                                              
       3                 :     require_once 'db.class.php';                                                             
       4                 :     require_once 'PHPDS_db.class.php';                                                       
       5                 :     require_once 'PHPDS_query.class.php';                                                    
       6                 :                                                                                              
       7                 :     class TEST_mock_connector /*extends PHPDS_dependant*/ implements PHPDS_dbConnector       
       8                 :     {                                                                                        
       9                 :         private $link;                                                                       
      10                 :                                                                                              
      11                 :         private $result;                                                                     
      12                 :                                                                                              
      13                 :         public $data = array();                                                              
      14                 :         private $pointer = 0;                                                                
      15                 :         private $lastid = 0;                                                                 
      16                 :                                                                                              
      17                 :         public function free()                                                               
      18                 :         {                                                                                    
      19               0 :             if (!empty($this->result)) {                                                     
      20               0 :                 $this->data = array();                                                       
      21               0 :             }                                                                                
      22               0 :         }                                                                                    
      23                 :                                                                                              
      24                 :         public function connect()                                                            
      25                 :         {                                                                                    
      26               1 :             $this->link = true;                                                              
      27               1 :         }                                                                                    
      28                 :                                                                                              
      29                 :         public function query($sql)                                                          
      30                 :         {                                                                                    
      31               1 :             if (empty($this->link)) $this->connect();                                        
      32               1 :             $this->pointer = 0;                                                              
      33               1 :             $this->lastid++;                                                                 
      34               1 :             return true;                                                                     
      35                 :         }                                                                                    
      36                 :                                                                                              
      37                 :         public function protect($param)                                                      
      38                 :         {                                                                                    
      39               0 :             return mysql_real_escape_string($param);                                         
      40                 :         }                                                                                    
      41                 :                                                                                              
      42                 :         public function fetchAssoc()                                                         
      43                 :         {                                                                                    
      44               1 :             if ($this->pointer >= count($this->data)) return false;                          
      45               1 :             return $this->data[$this->pointer++];                                            
      46                 :         }                                                                                    
      47                 :                                                                                              
      48                 :         public function seek($row_number)                                                    
      49                 :         {                                                                                    
      50               0 :             $this->pointer = $row_number;                                                    
      51               0 :             if ($this->pointer < 0) $this->pointer = 0;                                      
      52               0 :             if ($this->pointer > count($this->data)) $this->pointer = count($this->data) - 1;
      53               0 :         }                                                                                    
      54                 :                                                                                              
      55                 :         public function numrows()                                                            
      56                 :         {                                                                                    
      57               0 :             return count($this->data);                                                       
      58                 :         }                                                                                    
      59                 :                                                                                              
      60                 :         public function affectedRows()                                                       
      61                 :         {                                                                                    
      62               1 :             return 0;                                                                        
      63                 :         }                                                                                    
      64                 :                                                                                              
      65                 :         public function returnSqlError($query)                                               
      66                 :         {                                                                                    
      67               0 :             return '';                                                                       
      68                 :         }                                                                                    
      69                 :                                                                                              
      70                 :         public function debugInstance ($domain = null)                                       
      71                 :         {                                                                                    
      72               0 :             return parent::debugInstance('db');                                              
      73                 :         }                                                                                    
      74                 :                                                                                              
      75                 :         public function lastId($reset = false) {                                             
      76               0 :             if ($reset) $this->lastid = 0;                                                   
      77               0 :             return $this->lastid;                                                            
      78                 :         }                                                                                    
      79                 :                                                                                              
      80                 :         public function rowResults($row = 0) {                                               
      81               0 :             return $this->data[$row];                                                        
      82                 :         }                                                                                    
      83                 :                                                                                              
      84                 :         public function startTransaction()                                                   
      85                 :         {                                                                                    
      86                 :             // do nothing                                                                    
      87               0 :         }                                                                                    
      88                 :                                                                                              
      89                 :         public function endTransaction($commit = true)                                       
      90                 :         {                                                                                    
      91                 :             // do nothing                                                                    
      92               0 :         }                                                                                    
      93                 :                                                                                              
      94                 :     }                                                                                        
      95                 :                                                                                              
      96                 :                                                                                              
      97                 :                                                                                              
      98                 :     class TEST_stubQuery  extends PHPDS_query                                                
      99                 :     {                                                                                        
     100                 :         protected $sql = '';                                                                 
     101                 :                                                                                              
     102                 :         // allow easy access from the test scripts to the fields                             
     103                 :         public $singleRow;                                                                   
     104                 :         public $singleValue;                                                                 
     105                 :         public $typecast;                                                                    
     106                 :         public $getLastID;                                                                   
     107                 :     }                                                                                        

Generated by PHP_CodeCoverage 1.0.4 using PHP 5.3.6 and PHPUnit 3.5.14 at Mon Aug 8 22:35:38 PDT 2011.