Skip to content
Permalink
Browse files

Starting to extract Ini file parsing out of IniAcl as it breaks singl…

…e responsibility, and ini file parsing should be generic enough to be reused.

Adding a test case.
  • Loading branch information...
markstory committed Nov 28, 2010
1 parent cc18c15 commit 9d3b3a72cefabc78ef9302ba98f5c285cfd1b87f
Showing with 64 additions and 0 deletions.
  1. +37 −0 cake/libs/config/ini_file.php
  2. +27 −0 cake/tests/cases/libs/config/ini_file.test.php
@@ -0,0 +1,37 @@
<?php
/**
* IniFile
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.controller.components
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Ini file configuration parser.
*
* @package cake.config
*/
class IniFile {
/**
* Build and construct a new ini file parser, the parser will be a representation of the ini
* file as an object.
*
* @param string $filename Full path to the file to parse.
*/
public function __construct($filename) {
}
}
@@ -0,0 +1,27 @@
<?php
App::import('Core', 'config/IniFile');
class IniFileTest extends CakeTestCase {
var $file;
/**
* setup
*
* @return void
*/
function setup() {
parent::setup();
$this->file = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'config'. DS . 'acl.ini.php';
}
/**
* test constrction
*
* @return void
*/
function testConstruct() {
$config = new IniFile($this->file);
$this->assertTrue(isset($config->admin));
}
}

0 comments on commit 9d3b3a7

Please sign in to comment.
You can’t perform that action at this time.