Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
2 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); | ||
} | ||
} |