Current file: htdocs/app/code/core/Mage/Core/Model/Mysql4/Cache.php
Legend: executed not executed dead code

  Coverage
  Classes Functions / Methods Lines
Total
0.00%0.00%
0.00% 0 / 1
33.33%33.33%
33.33% 1 / 3 CRAP
45.00%45.00%
45.00% 9 / 20
 
Mage_Core_Model_Mysql4_Cache
0.00%0.00%
0.00% 0 / 1
33.33%33.33%
33.33% 1 / 3
45.00%45.00%
45.00% 9 / 20
 _construct()
100.00%100.00%
100.00% 1 / 1 1
100.00%100.00%
100.00% 2 / 2
 getAllOptions()
0.00%0.00%
0.00% 0 / 1 3.14
75.00%75.00%
75.00% 6 / 8
 saveAllOptions($options)
0.00%0.00%
0.00% 0 / 1 12
0.00%0.00%
0.00% 0 / 9


       1                 : <?php                                                                                            
       2                 : /**                                                                                              
       3                 :  * Magento                                                                                       
       4                 :  *                                                                                               
       5                 :  * NOTICE OF LICENSE                                                                             
       6                 :  *                                                                                               
       7                 :  * This source file is subject to the Open Software License (OSL 3.0)                            
       8                 :  * that is bundled with this package in the file LICENSE.txt.                                    
       9                 :  * It is also available through the world-wide-web at this URL:                                  
      10                 :  * http://opensource.org/licenses/osl-3.0.php                                                    
      11                 :  * If you did not receive a copy of the license and are unable to                                
      12                 :  * obtain it through the world-wide-web, please send an email                                    
      13                 :  * to license@magentocommerce.com so we can send you a copy immediately.                         
      14                 :  *                                                                                               
      15                 :  * DISCLAIMER                                                                                    
      16                 :  *                                                                                               
      17                 :  * Do not edit or add to this file if you wish to upgrade Magento to newer                       
      18                 :  * versions in the future. If you wish to customize Magento for your                             
      19                 :  * needs please refer to http://www.magentocommerce.com for more information.                    
      20                 :  *                                                                                               
      21                 :  * @category    Mage                                                                             
      22                 :  * @package     Mage_Core                                                                        
      23                 :  * @copyright   Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)                 
      24                 :  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)      
      25                 :  */                                                                                              
      26                 :                                                                                                  
      27                 :                                                                                                  
      28                 : class Mage_Core_Model_Mysql4_Cache extends Mage_Core_Model_Mysql4_Abstract                       
      29               1 : {                                                                                                
      30                 :     protected function _construct()                                                              
      31                 :     {                                                                                            
      32               1 :         $this->_init('core/cache_option', 'code');                                               
      33               1 :     }                                                                                            
      34                 :                                                                                                  
      35                 :     /**                                                                                          
      36                 :      * Get all cache options                                                                     
      37                 :      * @return array | false                                                                     
      38                 :      */                                                                                          
      39                 :     public function getAllOptions()                                                              
      40                 :     {                                                                                            
      41               1 :         $adapter = $this->_getReadAdapter();                                                     
      42               1 :         if ($adapter) {                                                                          
      43                 :             /**                                                                                  
      44                 :              * Check if table exist (it protect upgrades. cache settings checked before upgrades)
      45                 :              */                                                                                  
      46               1 :             if ($adapter->fetchOne('SHOW TABLES LIKE ?', $this->getMainTable())) {               
      47               1 :                 $select = $adapter->select()                                                     
      48               1 :                     ->from($this->getMainTable(), array('code', 'value'));                       
      49               1 :                 return $adapter->fetchPairs($select);                                            
      50                 :             }                                                                                    
      51               0 :         }                                                                                        
      52               0 :         return false;                                                                            
      53                 :     }                                                                                            
      54                 :                                                                                                  
      55                 :     /**                                                                                          
      56                 :      * Save all options to option table                                                          
      57                 :      *                                                                                           
      58                 :      * @param   array $options                                                                   
      59                 :      * @return  Mage_Core_Model_Mysql4_Cache                                                     
      60                 :      */                                                                                          
      61                 :     public function saveAllOptions($options)                                                     
      62                 :     {                                                                                            
      63               0 :         if (!$this->_getWriteAdapter()) {                                                        
      64               0 :             return $this;                                                                        
      65                 :         }                                                                                        
      66               0 :         $this->_getWriteAdapter()->delete($this->getMainTable());                                
      67               0 :         foreach ($options as $code => $value) {                                                  
      68               0 :             $this->_getWriteAdapter()->insert($this->getMainTable(), array(                      
      69               0 :                 'code'  => $code,                                                                
      70                 :                 'value' => $value                                                                
      71               0 :             ));                                                                                  
      72               0 :         }                                                                                        
      73               0 :         return $this;                                                                            
      74                 :     }                                                                                            
      75                 : }                                                                                                

Generated by PHP_CodeCoverage 1.0.4 using PHP 5.3.4 and PHPUnit 3.5.13 at Tue Jul 5 9:07:16 UTC 2011.