[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/config/tests/cases/ -> lmbIniOverrideTest.class.php (source)

   1  <?php
   2  /*
   3   * Limb PHP Framework
   4   *
   5   * @link http://limb-project.com 
   6   * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
   7   * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
   8   */
   9  lmb_require('limb/config/src/lmbIni.class.php');
  10  
  11  class lmbIniOverrideTest extends UnitTestCase
  12  {
  13    function setUp()
  14    {
  15      lmbFs :: mkdir(LIMB_VAR_DIR . '/tmp_ini');
  16    }
  17  
  18    function tearDown()
  19    {
  20      lmbFs :: rm(LIMB_VAR_DIR . '/tmp_ini');
  21    }
  22  
  23    function _createIniFileNames()
  24    {
  25      $name = mt_rand();
  26      $file = LIMB_VAR_DIR . '/tmp_ini/' . $name . '.ini';
  27      $override_file = LIMB_VAR_DIR . '/tmp_ini/' . $name . '.override.ini';
  28      return array($file, $override_file);
  29    }
  30  
  31    function testOverride()
  32    {
  33      list($file, $override_file) = $this->_createIniFileNames();
  34  
  35      file_put_contents($file,
  36         '[Templates]
  37          conf = 1
  38          force_compile = 0
  39          path = design/templates/');
  40  
  41      file_put_contents($override_file,
  42         '[Templates]
  43          conf =
  44          force_compile = 1');
  45  
  46      $ini = new lmbIni($file);
  47  
  48      $this->assertEqual($ini->getOption('conf', 'Templates'), null);
  49      $this->assertEqual($ini->getOption('path', 'Templates'), 'design/templates/');
  50      $this->assertEqual($ini->getOption('force_compile', 'Templates'), 1);
  51    }
  52  }
  53  
  54  ?>


Generated: Thu Aug 28 04:51:15 2008 Cross-referenced by PHPXref 0.7