Skip to content

Commit

Permalink
prevent surpirses with Folder not being available.
Browse files Browse the repository at this point in the history
Previously loading File would load Folder also - that's not true with
the new changes, ensure that the Folder class is regsitered with
App::users when the Folder class is used.
  • Loading branch information
AD7six committed Apr 17, 2011
1 parent 3ff9747 commit 010feb2
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 18 deletions.
7 changes: 4 additions & 3 deletions lib/Cake/Console/Command/SchemaShell.php
Expand Up @@ -20,6 +20,7 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('File', 'Utility');
App::uses('Folder', 'Utility');
App::uses('CakeSchema', 'Model');

/**
Expand Down Expand Up @@ -150,7 +151,7 @@ public function generate() {

$content = $this->Schema->read($options);
$content['file'] = $this->params['file'];

Configure::write('Cache.disable', $cacheDisable);

if ($snapshot === true) {
Expand Down Expand Up @@ -271,7 +272,7 @@ function _loadSchema() {
if (!empty($this->params['plugin'])) {
$plugin = $this->params['plugin'];
}

if (!empty($this->params['dry'])) {
$this->__dry = true;
$this->out(__d('cake_console', 'Performing a dry run.'));
Expand Down Expand Up @@ -463,7 +464,7 @@ public function getOptionParser() {
$write = array(
'help' => __d('cake_console', 'Write the dumped SQL to a file.')
);

$parser = parent::getOptionParser();
$parser->description(
'The Schema Shell generates a schema object from' .
Expand Down
4 changes: 3 additions & 1 deletion lib/Cake/Console/Command/Task/ExtractTask.php
Expand Up @@ -17,6 +17,8 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('File', 'Utility');
App::uses('Folder', 'Utility');

/**
* Language string extractor
*
Expand Down Expand Up @@ -515,7 +517,7 @@ function __markerError($file, $line, $marker, $count) {
function __searchFiles() {
$pattern = false;
if (!empty($this->_exclude)) {
$pattern = '/[\/\\\\]' . implode('|', $this->_exclude) . '[\/\\\\]/';
$pattern = '/[\/\\\\]' . implode('|', $this->_exclude) . '[\/\\\\]/';
}
foreach ($this->__paths as $path) {
$Folder = new Folder($path);
Expand Down
3 changes: 2 additions & 1 deletion lib/Cake/Console/Command/Task/ProjectTask.php
Expand Up @@ -19,6 +19,7 @@
*/

App::uses('File', 'Utility');
App::uses('Folder', 'Utility');
App::uses('String', 'Utility');
App::uses('Security', 'Utility');

Expand Down Expand Up @@ -392,4 +393,4 @@ public function getOptionParser() {
));
}

}
}
3 changes: 2 additions & 1 deletion lib/Cake/tests/Case/Utility/FileTest.php
Expand Up @@ -17,6 +17,7 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('File', 'Utility');
App::uses('Folder', 'Utility');

/**
* FileTest class
Expand Down Expand Up @@ -487,4 +488,4 @@ function _getTmpFile($paintSkip = true) {
}
return false;
}
}
}
25 changes: 13 additions & 12 deletions lib/Cake/tests/Case/View/Helper/HtmlHelperTest.php
Expand Up @@ -17,12 +17,13 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

App::uses('Controller', 'Controller');
App::uses('Helper', 'View');
App::uses('AppHelper', 'View/Helper');
App::uses('ClassRegistry', 'Utility');
App::uses('Controller', 'Controller');
App::uses('HtmlHelper', 'View/Helper');
App::uses('FomrHelper', 'View/Helper');
App::uses('ClassRegistry', 'Utility');
App::uses('Folder', 'Utility');

if (!defined('FULL_BASE_URL')) {
define('FULL_BASE_URL', 'http://cakephp.org');
Expand Down Expand Up @@ -56,10 +57,10 @@ class TestHtmlHelper extends HtmlHelper {
/**
* expose a method as public
*
* @param string $options
* @param string $exclude
* @param string $insertBefore
* @param string $insertAfter
* @param string $options
* @param string $exclude
* @param string $insertBefore
* @param string $insertAfter
* @return void
*/
function parseAttributes($options, $exclude = null, $insertBefore = ' ', $insertAfter = null) {
Expand Down Expand Up @@ -639,7 +640,7 @@ function testScript() {
'script' => array('type' => 'text/javascript', 'src' => 'js/jquery-1.3.2.js', 'defer' => 'defer', 'encoding' => 'utf-8')
);
$this->assertTags($result, $expected);

$this->View->expects($this->any())->method('addScript')
->with($this->matchesRegularExpression('/script_in_head.js/'));
$result = $this->Html->script('script_in_head', array('inline' => false));
Expand Down Expand Up @@ -711,7 +712,7 @@ function testScriptBlock() {
);
$this->assertTags($result, $expected);


$this->View->expects($this->any())->method('addScript')
->with($this->matchesRegularExpression('/window\.foo\s\=\s2;/'));

Expand Down Expand Up @@ -1342,12 +1343,12 @@ function testPara() {
$result = $this->Html->para('class-name', '<text>', array('escape' => true));
$this->assertTags($result, array('p' => array('class' => 'class-name'), '&lt;text&gt;', '/p'));
}

/**
* testCrumbList method
*
*
* @access public
*
*
* @return void
*/
function testCrumbList() {
Expand Down Expand Up @@ -1435,7 +1436,7 @@ function testParseAttributeCompact() {
$helper = new TestHtmlHelper($this->View);
$compact = array('compact', 'checked', 'declare', 'readonly', 'disabled',
'selected', 'defer', 'ismap', 'nohref', 'noshade', 'nowrap', 'multiple', 'noresize');

foreach ($compact as $attribute) {
foreach (array('true', true, 1, '1', $attribute) as $value) {
$attrs = array($attribute => $value);
Expand Down

0 comments on commit 010feb2

Please sign in to comment.