Skip to content

Commit

Permalink
Starting to extract Ini file parsing out of IniAcl as it breaks singl…
Browse files Browse the repository at this point in the history
…e responsibility, and ini file parsing should be generic enough to be reused.

Adding a test case.
  • Loading branch information
markstory committed Nov 29, 2010
1 parent cc18c15 commit 9d3b3a7
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
37 changes: 37 additions & 0 deletions cake/libs/config/ini_file.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) {

}
}
27 changes: 27 additions & 0 deletions cake/tests/cases/libs/config/ini_file.test.php
@@ -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.