hajtest
Current file: D:\websites\haj\application\models\PromoCodes.php
Legend: executed not executed dead code

  Coverage
  Classes Functions / Methods Lines
Total
0.00%0.00%
0.00% 0 / 1
50.00%50.00%
50.00% 1 / 2
45.00%45.00%
45.00% 9 / 20
 
PromoCodes
0.00%0.00%
0.00% 0 / 1
50.00%50.00%
50.00% 1 / 2
45.00%45.00%
45.00% 9 / 20
 public static function findWhereCodeIn($codes)
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 5 / 5
 public static function calculatePromos($price, $promos)
0.00%0.00%
0.00% 0 / 1
21.43%21.43%
21.43% 3 / 14


       1                 : <?php                                                                                 
       2                 :                                                                                       
       3                 : /**                                                                                   
       4                 :  * PromoCodes                                                                         
       5                 :  *                                                                                     
       6                 :  * This class has been auto-generated by the Doctrine ORM Framework                   
       7                 :  *                                                                                     
       8                 :  * @package    ##PACKAGE##                                                            
       9                 :  * @subpackage ##SUBPACKAGE##                                                         
      10                 :  * @author     ##NAME## <##EMAIL##>                                                   
      11                 :  * @version    SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $                
      12                 :  */                                                                                   
      13               1 : class PromoCodes extends BasePromoCodes {                                             
      14                 :                                                                                       
      15                 :     public static function findWhereCodeIn($codes) {                                  
      16               1 :         $reg = Doctrine_Core::getTable('PromoCodes')                                  
      17               1 :                 ->createQuery()                                                       
      18               1 :                 ->whereIn($codes)                                                     
      19               1 :                 ->execute();                                                          
      20               1 :     }                                                                                 
      21                 :                                                                                       
      22                 :     public static function calculatePromos($price, $promos) {                         
      23               1 :         $codes = explode(', ', $promos);                                              
      24               1 :         $results = PromoCodes::findWhereCodeIn($codes);                               
      25               1 :         foreach ($results as $result) {                                               
      26               0 :             if ($result->isActive) {                                                  
      27               0 :                 if (strpos($result->action, '+')) {                                   
      28               0 :                     $price = $price + preg_replace("/[^0-9\.]/", '', $result->action);
					
      29               0 :                 } elseif (strpos($result->action, '-')) {                             
      30               0 :                     $price = $price - preg_replace("/[^0-9\.]/", '', $result->action);
					
      31               0 :                 } else {                                                              
      32               0 :                     $price = $result->action;                                         
      33               0 :                     break;                                                            
      34                 :                 }                                                                     
      35               0 :             }                                                                         
      36               0 :         }                                                                             
      37               0 :         return $price;                                                                
      38                 :     }                                                                                 
      39                 :                                                                                       

Generated by PHPUnit 3.4.15 and Xdebug 2.1.0rc1 using PHP 5.3.1 at Mon Jan 17 15:42:18 PST 2011.