From b188d670b7181b5e6ace00522986aca2c2220bb8 Mon Sep 17 00:00:00 2001 From: euromark Date: Sat, 26 Jul 2014 04:06:26 +0200 Subject: [PATCH 1/7] Make year range validation less strict by default. --- lib/Cake/Test/Case/Utility/ValidationTest.php | 3 ++- lib/Cake/Utility/Validation.php | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Test/Case/Utility/ValidationTest.php b/lib/Cake/Test/Case/Utility/ValidationTest.php index a9bbad662..9d2553c3e 100644 --- a/lib/Cake/Test/Case/Utility/ValidationTest.php +++ b/lib/Cake/Test/Case/Utility/ValidationTest.php @@ -1462,10 +1462,11 @@ class ValidationTest extends CakeTestCase { $this->assertTrue(Validation::date('2008', array('y'))); $this->assertTrue(Validation::date('2013', array('y'))); $this->assertTrue(Validation::date('2104', array('y'))); + $this->assertTrue(Validation::date('1899', array('y'))); $this->assertFalse(Validation::date('20009', array('y'))); $this->assertFalse(Validation::date(' 2012', array('y'))); $this->assertFalse(Validation::date('3000', array('y'))); - $this->assertFalse(Validation::date('1899', array('y'))); + $this->assertFalse(Validation::date('1799', array('y'))); } /** diff --git a/lib/Cake/Utility/Validation.php b/lib/Cake/Utility/Validation.php index cb2aa8706..24b9bfa0f 100644 --- a/lib/Cake/Utility/Validation.php +++ b/lib/Cake/Utility/Validation.php @@ -278,7 +278,9 @@ class Validation { /** * Date validation, determines if the string passed is a valid date. - * keys that expect full month, day and year will validate leap years + * keys that expect full month, day and year will validate leap years. + * + * Years are valid from 1800 to 2999. * * ### Formats: * @@ -304,7 +306,7 @@ class Validation { } $month = '(0[123456789]|10|11|12)'; $separator = '([- /.])'; - $fourDigitYear = '(([1][9][0-9][0-9])|([2][0-9][0-9][0-9]))'; + $fourDigitYear = '(([1][8-9][0-9][0-9])|([2][0-9][0-9][0-9]))'; $twoDigitYear = '([0-9]{2})'; $year = '(?:' . $fourDigitYear . '|' . $twoDigitYear . ')'; From 0af698c591df873abc84a25391b8bb893f94bfb6 Mon Sep 17 00:00:00 2001 From: Steve Tauber Date: Tue, 29 Jul 2014 16:08:33 +0200 Subject: [PATCH 2/7] Updating RequestHandlerComponent to accept body of HTTP Delete requests --- lib/Cake/Controller/Component/RequestHandlerComponent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Controller/Component/RequestHandlerComponent.php b/lib/Cake/Controller/Component/RequestHandlerComponent.php index 736e36339..192e4b21a 100644 --- a/lib/Cake/Controller/Component/RequestHandlerComponent.php +++ b/lib/Cake/Controller/Component/RequestHandlerComponent.php @@ -506,7 +506,7 @@ class RequestHandlerComponent extends Component { * in the request content type will be returned. */ public function requestedWith($type = null) { - if (!$this->request->is('post') && !$this->request->is('put')) { + if (!$this->request->is('post') && !$this->request->is('put') && !$this->request->is('delete')) { return null; } if (is_array($type)) { From e6f6ded3349dc4bdbcc5dbeef4709ef42c13675d Mon Sep 17 00:00:00 2001 From: Steve Tauber Date: Tue, 29 Jul 2014 16:34:11 +0200 Subject: [PATCH 3/7] Adding unit test for HTTP DELETE and RequestHandlerComponent::requestedWith --- .../Case/Controller/Component/RequestHandlerComponentTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php b/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php index 94b8bffe2..274751c7c 100644 --- a/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php @@ -601,6 +601,9 @@ class RequestHandlerComponentTest extends CakeTestCase { $result = $this->RequestHandler->requestedWith(array('rss', 'atom')); $this->assertFalse($result); + $_SERVER['REQUEST_METHOD'] = 'DELETE'; + $this->assertEquals('json', $this->RequestHandler->requestedWith()); + $_SERVER['REQUEST_METHOD'] = 'POST'; unset($_SERVER['CONTENT_TYPE']); $_SERVER['HTTP_CONTENT_TYPE'] = 'application/json'; From f9785042bce703def96f397778ff32f1f67159e4 Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 29 Jul 2014 21:53:55 -0400 Subject: [PATCH 4/7] Fix indentation. Refs #4108 --- .../Case/Controller/Component/RequestHandlerComponentTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php b/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php index 274751c7c..3f330b60a 100644 --- a/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php @@ -601,8 +601,8 @@ class RequestHandlerComponentTest extends CakeTestCase { $result = $this->RequestHandler->requestedWith(array('rss', 'atom')); $this->assertFalse($result); - $_SERVER['REQUEST_METHOD'] = 'DELETE'; - $this->assertEquals('json', $this->RequestHandler->requestedWith()); + $_SERVER['REQUEST_METHOD'] = 'DELETE'; + $this->assertEquals('json', $this->RequestHandler->requestedWith()); $_SERVER['REQUEST_METHOD'] = 'POST'; unset($_SERVER['CONTENT_TYPE']); From aa42b80a4d386913a0b83ec1b18f396851f24919 Mon Sep 17 00:00:00 2001 From: Anthony GRASSIOT Date: Wed, 30 Jul 2014 22:11:03 +0200 Subject: [PATCH 5/7] `a` / `an` typo fixes fot API --- lib/Cake/Cache/Cache.php | 2 +- lib/Cake/Console/Command/Task/FixtureTask.php | 2 +- lib/Cake/Console/Command/Task/ViewTask.php | 2 +- lib/Cake/Console/ConsoleErrorHandler.php | 2 +- lib/Cake/Console/ConsoleOutput.php | 2 +- lib/Cake/Console/HelpFormatter.php | 2 +- lib/Cake/Console/Shell.php | 4 ++-- lib/Cake/Core/App.php | 2 +- lib/Cake/Core/CakePlugin.php | 2 +- lib/Cake/Error/ExceptionRenderer.php | 2 +- lib/Cake/Model/Datasource/Database/Mysql.php | 2 +- lib/Cake/Model/Datasource/DboSource.php | 2 +- lib/Cake/Network/CakeResponse.php | 4 ++-- lib/Cake/Routing/Router.php | 2 +- lib/Cake/Utility/File.php | 2 +- lib/Cake/Utility/ObjectCollection.php | 2 +- lib/Cake/Utility/Set.php | 2 +- lib/Cake/Utility/Xml.php | 2 +- lib/Cake/View/Helper/FormHelper.php | 10 +++++----- lib/Cake/View/Helper/JsBaseEngineHelper.php | 2 +- lib/Cake/View/Helper/MootoolsEngineHelper.php | 2 +- 21 files changed, 27 insertions(+), 27 deletions(-) diff --git a/lib/Cake/Cache/Cache.php b/lib/Cake/Cache/Cache.php index 97cc5e138..c8436f72a 100644 --- a/lib/Cake/Cache/Cache.php +++ b/lib/Cake/Cache/Cache.php @@ -197,7 +197,7 @@ class Cache { /** * Drops a cache engine. Deletes the cache configuration information - * If the deleted configuration is the last configuration using an certain engine, + * If the deleted configuration is the last configuration using a certain engine, * the Engine instance is also unset. * * @param string $name A currently configured cache config you wish to remove. diff --git a/lib/Cake/Console/Command/Task/FixtureTask.php b/lib/Cake/Console/Command/Task/FixtureTask.php index cb118cb50..099fe9516 100644 --- a/lib/Cake/Console/Command/Task/FixtureTask.php +++ b/lib/Cake/Console/Command/Task/FixtureTask.php @@ -381,7 +381,7 @@ class FixtureTask extends BakeTask { } /** - * Convert a $records array into a a string. + * Convert a $records array into a string. * * @param array $records Array of records to be converted to string * @return string A string value of the $records array. diff --git a/lib/Cake/Console/Command/Task/ViewTask.php b/lib/Cake/Console/Command/Task/ViewTask.php index 20c1d5287..8c84442b8 100644 --- a/lib/Cake/Console/Command/Task/ViewTask.php +++ b/lib/Cake/Console/Command/Task/ViewTask.php @@ -248,7 +248,7 @@ class ViewTask extends BakeTask { * 'singularHumanName', 'pluralHumanName', 'fields', 'foreignKeys', * 'belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany' * - * @return array Returns an variables to be made available to a view template + * @return array Returns a variables to be made available to a view template */ protected function _loadController() { if (!$this->controllerName) { diff --git a/lib/Cake/Console/ConsoleErrorHandler.php b/lib/Cake/Console/ConsoleErrorHandler.php index 3bb55ea26..d7182e2c0 100644 --- a/lib/Cake/Console/ConsoleErrorHandler.php +++ b/lib/Cake/Console/ConsoleErrorHandler.php @@ -47,7 +47,7 @@ class ConsoleErrorHandler { } /** - * Handle a exception in the console environment. Prints a message to stderr. + * Handle an exception in the console environment. Prints a message to stderr. * * @param Exception $exception The exception to handle * @return void diff --git a/lib/Cake/Console/ConsoleOutput.php b/lib/Cake/Console/ConsoleOutput.php index 39e58d617..ab9828d83 100644 --- a/lib/Cake/Console/ConsoleOutput.php +++ b/lib/Cake/Console/ConsoleOutput.php @@ -170,7 +170,7 @@ class ConsoleOutput { * Outputs a single or multiple messages to stdout. If no parameters * are passed, outputs just a newline. * - * @param string|array $message A string or a an array of strings to output + * @param string|array $message A string or an array of strings to output * @param int $newlines Number of newlines to append * @return int Returns the number of bytes returned from writing to stdout. */ diff --git a/lib/Cake/Console/HelpFormatter.php b/lib/Cake/Console/HelpFormatter.php index c62083e38..140c289bd 100644 --- a/lib/Cake/Console/HelpFormatter.php +++ b/lib/Cake/Console/HelpFormatter.php @@ -45,7 +45,7 @@ class HelpFormatter { protected $_maxOptions = 6; /** - * Build the help formatter for a an OptionParser + * Build the help formatter for an OptionParser * * @param ConsoleOptionParser $parser The option parser help is being generated for. */ diff --git a/lib/Cake/Console/Shell.php b/lib/Cake/Console/Shell.php index 2dc3b9563..6fd07cfee 100644 --- a/lib/Cake/Console/Shell.php +++ b/lib/Cake/Console/Shell.php @@ -594,7 +594,7 @@ class Shell extends Object { * present in most shells. Using Shell::QUIET for a message means it will always display. * While using Shell::VERBOSE means it will only display when verbose output is toggled. * - * @param string|array $message A string or a an array of strings to output + * @param string|array $message A string or an array of strings to output * @param int $newlines Number of newlines to append * @param int $level The message's output level, see above. * @return int|bool Returns the number of bytes returned from writing to stdout. @@ -618,7 +618,7 @@ class Shell extends Object { * Outputs a single or multiple error messages to stderr. If no parameters * are passed outputs just a newline. * - * @param string|array $message A string or a an array of strings to output + * @param string|array $message A string or an array of strings to output * @param int $newlines Number of newlines to append * @return void * @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::err diff --git a/lib/Cake/Core/App.php b/lib/Cake/Core/App.php index 3b0ceff66..22112f10a 100644 --- a/lib/Cake/Core/App.php +++ b/lib/Cake/Core/App.php @@ -590,7 +590,7 @@ class App { * not construct any classes contained in the files. It will only find and require() the file. * * @param string|array $type The type of Class if passed as a string, or all params can be passed as - * an single array to $type. + * a single array to $type. * @param string $name Name of the Class or a unique name for the file * @param bool|array $parent boolean true if Class Parent should be searched, accepts key => value * array('parent' => $parent, 'file' => $file, 'search' => $search, 'ext' => '$ext'); diff --git a/lib/Cake/Core/CakePlugin.php b/lib/Cake/Core/CakePlugin.php index 88e80743f..cd4611fe3 100644 --- a/lib/Cake/Core/CakePlugin.php +++ b/lib/Cake/Core/CakePlugin.php @@ -33,7 +33,7 @@ class CakePlugin { protected static $_plugins = array(); /** - * Loads a plugin and optionally loads bootstrapping, routing files or loads a initialization function + * Loads a plugin and optionally loads bootstrapping, routing files or loads an initialization function * * Examples: * diff --git a/lib/Cake/Error/ExceptionRenderer.php b/lib/Cake/Error/ExceptionRenderer.php index 338a98253..3da88679e 100644 --- a/lib/Cake/Error/ExceptionRenderer.php +++ b/lib/Cake/Error/ExceptionRenderer.php @@ -35,7 +35,7 @@ App::uses('Controller', 'Controller'); * * You can implement application specific exception handling in one of a few ways: * - * - Create a AppController::appError(); + * - Create an AppController::appError(); * - Create a subclass of ExceptionRenderer and configure it to be the `Exception.renderer` * * #### Using AppController::appError(); diff --git a/lib/Cake/Model/Datasource/Database/Mysql.php b/lib/Cake/Model/Datasource/Database/Mysql.php index 29df5126f..3ed56016c 100644 --- a/lib/Cake/Model/Datasource/Database/Mysql.php +++ b/lib/Cake/Model/Datasource/Database/Mysql.php @@ -696,7 +696,7 @@ class Mysql extends DboSource { } /** - * Returns an detailed array of sources (tables) in the database. + * Returns a detailed array of sources (tables) in the database. * * @param string $name Table name to get parameters * @return array Array of table names in the database diff --git a/lib/Cake/Model/Datasource/DboSource.php b/lib/Cake/Model/Datasource/DboSource.php index 0bd7693a4..face8b632 100644 --- a/lib/Cake/Model/Datasource/DboSource.php +++ b/lib/Cake/Model/Datasource/DboSource.php @@ -3246,7 +3246,7 @@ class DboSource extends DataSource { } /** - * Generate a alter syntax from CakeSchema::compare() + * Generate an alter syntax from CakeSchema::compare() * * @param mixed $compare The comparison data. * @param string $table The table name. diff --git a/lib/Cake/Network/CakeResponse.php b/lib/Cake/Network/CakeResponse.php index 637299177..ce36a0f3b 100644 --- a/lib/Cake/Network/CakeResponse.php +++ b/lib/Cake/Network/CakeResponse.php @@ -950,7 +950,7 @@ class CakeResponse { } /** - * Sets the Last-Modified header for the response by taking an modification time + * Sets the Last-Modified header for the response by taking a modification time * If called with no parameters it will return the current Last-Modified value * * ## Examples: @@ -1003,7 +1003,7 @@ class CakeResponse { * parameters are passed, then an array with the current Vary header * value is returned * - * @param string|array $cacheVariances a single Vary string or a array + * @param string|array $cacheVariances a single Vary string or an array * containing the list for variances. * @return array */ diff --git a/lib/Cake/Routing/Router.php b/lib/Cake/Routing/Router.php index 617fb2880..f5768ebbd 100644 --- a/lib/Cake/Routing/Router.php +++ b/lib/Cake/Routing/Router.php @@ -1206,7 +1206,7 @@ class Router { /** * Instructs the router to parse out file extensions from the URL. * - * For example, http://example.com/posts.rss would yield an file extension of "rss". + * For example, http://example.com/posts.rss would yield a file extension of "rss". * The file extension itself is made available in the controller as * `$this->params['ext']`, and is used by the RequestHandler component to * automatically switch to alternate layouts and templates, and load helpers diff --git a/lib/Cake/Utility/File.php b/lib/Cake/Utility/File.php index 2a49bc96c..ea2f7d705 100644 --- a/lib/Cake/Utility/File.php +++ b/lib/Cake/Utility/File.php @@ -197,7 +197,7 @@ class File { } /** - * Prepares a ASCII string for writing. Converts line endings to the + * Prepares an ASCII string for writing. Converts line endings to the * correct terminator for the current platform. If Windows, "\r\n" will be used, * all other platforms will use "\n" * diff --git a/lib/Cake/Utility/ObjectCollection.php b/lib/Cake/Utility/ObjectCollection.php index 4a8f1e6fb..3fd6873b7 100644 --- a/lib/Cake/Utility/ObjectCollection.php +++ b/lib/Cake/Utility/ObjectCollection.php @@ -234,7 +234,7 @@ abstract class ObjectCollection { } /** - * Disables callbacks on a object or array of objects. Public object methods are still + * Disables callbacks on an object or array of objects. Public object methods are still * callable as normal. * * @param string|array $name CamelCased name of the objects(s) to disable (string or array) diff --git a/lib/Cake/Utility/Set.php b/lib/Cake/Utility/Set.php index 2b21b579a..4490df49d 100644 --- a/lib/Cake/Utility/Set.php +++ b/lib/Cake/Utility/Set.php @@ -910,7 +910,7 @@ class Set { } /** - * Expand/unflattens an string to an array + * Expand/unflattens a string to an array * * For example, unflattens an array that was collapsed with `Set::flatten()` * into a multi-dimensional array. So, `array('0.Foo.Bar' => 'Far')` becomes diff --git a/lib/Cake/Utility/Xml.php b/lib/Cake/Utility/Xml.php index 88a83b74b..ad4aa424b 100644 --- a/lib/Cake/Utility/Xml.php +++ b/lib/Cake/Utility/Xml.php @@ -325,7 +325,7 @@ class Xml { } /** - * Returns this XML structure as a array. + * Returns this XML structure as an array. * * @param SimpleXMLElement|DOMDocument|DOMNode $obj SimpleXMLElement, DOMDocument or DOMNode instance * @return array Array representation of the XML structure. diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php index c4396778b..7cbe69a88 100644 --- a/lib/Cake/View/Helper/FormHelper.php +++ b/lib/Cake/View/Helper/FormHelper.php @@ -329,7 +329,7 @@ class FormHelper extends AppHelper { * If an array is passed and $options argument is empty, the array will be used as options. * If `false` no model is used. * @param array $options An array of html attributes and options. - * @return string An formatted opening FORM tag. + * @return string A formatted opening FORM tag. * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#options-for-create */ public function create($model = null, $options = array()) { @@ -1483,7 +1483,7 @@ class FormHelper extends AppHelper { * - `hiddenField` - boolean to indicate if you want the results of radio() to include * a hidden input with a value of ''. This is useful for creating radio sets that non-continuous * - `disabled` - Set to `true` or `disabled` to disable all the radio buttons. - * - `empty` - Set to `true` to create a input with the value '' as the first option. When `true` + * - `empty` - Set to `true` to create an input with the value '' as the first option. When `true` * the radio label will be 'empty'. Set this option to a string to control the label value. * * @param string $fieldName Name of a field, like this "Modelname.fieldname" @@ -2257,7 +2257,7 @@ class FormHelper extends AppHelper { * ### Attributes: * * - `monthNames` - If false, 2 digit numbers will be used instead of text. - * If a array, the given array will be used. + * If an array, the given array will be used. * - `empty` - If true, the empty select option is shown. If a string, * that string is displayed as the empty element. * - `value` The selected value of the input. @@ -2455,7 +2455,7 @@ class FormHelper extends AppHelper { * ### Attributes: * * - `monthNames` If false, 2 digit numbers will be used instead of text. - * If a array, the given array will be used. + * If an array, the given array will be used. * - `minYear` The lowest year to use in the year select * - `maxYear` The maximum year to use in the year select * - `interval` The interval for the minutes select. Defaults to 1 @@ -2933,7 +2933,7 @@ class FormHelper extends AppHelper { * Disabling the field using the `disabled` option, will also omit the field from being * part of the hashed key. * - * This method will convert a numerically indexed 'disabled' into a associative + * This method will convert a numerically indexed 'disabled' into an associative * value. FormHelper's internals expect associative options. * * @param string $field Name of the field to initialize options for. diff --git a/lib/Cake/View/Helper/JsBaseEngineHelper.php b/lib/Cake/View/Helper/JsBaseEngineHelper.php index 44771074a..f8d6d831a 100644 --- a/lib/Cake/View/Helper/JsBaseEngineHelper.php +++ b/lib/Cake/View/Helper/JsBaseEngineHelper.php @@ -476,7 +476,7 @@ abstract class JsBaseEngineHelper extends AppHelper { abstract public function serializeForm($options = array()); /** - * Parse an options assoc array into an JavaScript object literal. + * Parse an options assoc array into a JavaScript object literal. * Similar to object() but treats any non-integer value as a string, * does not include `{ }` * diff --git a/lib/Cake/View/Helper/MootoolsEngineHelper.php b/lib/Cake/View/Helper/MootoolsEngineHelper.php index 33665b89d..970ef6a57 100644 --- a/lib/Cake/View/Helper/MootoolsEngineHelper.php +++ b/lib/Cake/View/Helper/MootoolsEngineHelper.php @@ -225,7 +225,7 @@ class MootoolsEngineHelper extends JsBaseEngineHelper { } /** - * Create an new Request. + * Create a new Request. * * Requires `Request`. If you wish to use 'update' key you must have ```Request.HTML``` * if you wish to do Json requests you will need ```JSON``` and ```Request.JSON```. From f3e1a187400ff577ec5cae9d392b4937ea26fd77 Mon Sep 17 00:00:00 2001 From: chinpei215 Date: Thu, 31 Jul 2014 05:49:23 +0900 Subject: [PATCH 6/7] Fix a fatal error occurs in combination with a scaffold error. --- .../Test/Case/Controller/ScaffoldTest.php | 73 ++++++++++++++++++- lib/Cake/View/Errors/scaffold_error.ctp | 6 +- 2 files changed, 76 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Test/Case/Controller/ScaffoldTest.php b/lib/Cake/Test/Case/Controller/ScaffoldTest.php index 88ec9cea8..fc512c5e5 100644 --- a/lib/Cake/Test/Case/Controller/ScaffoldTest.php +++ b/lib/Cake/Test/Case/Controller/ScaffoldTest.php @@ -63,7 +63,7 @@ class ScaffoldMockControllerWithFields extends Controller { /** * function beforeScaffold * - * @param string method + * @param string $method Method name. * @return bool true */ public function beforeScaffold($method) { @@ -73,6 +73,39 @@ class ScaffoldMockControllerWithFields extends Controller { } +/** + * ScaffoldMockControllerWithError class + * + * @package Cake.Test.Case.Controller + */ +class ScaffoldMockControllerWithError extends Controller { + +/** + * name property + * + * @var string + */ + public $name = 'ScaffoldMock'; + +/** + * scaffold property + * + * @var mixed + */ + public $scaffold; + +/** + * function beforeScaffold + * + * @param string $method Method name. + * @return bool false + */ + public function beforeScaffold($method) { + return false; + } + +} + /** * TestScaffoldMock class * @@ -83,7 +116,7 @@ class TestScaffoldMock extends Scaffold { /** * Overload _scaffold * - * @param CakeRequest $request + * @param CakeRequest $request Request object for scaffolding * @return void */ protected function _scaffold(CakeRequest $request) { @@ -344,4 +377,40 @@ class ScaffoldTest extends CakeTestCase { $this->assertNotRegExp('/textarea name="data\[ScaffoldMock\]\[body\]" cols="30" rows="6" id="ScaffoldMockBody"/', $result); } +/** + * test in case of scaffold error + * + * @return void + */ + public function testScaffoldError() { + $request = new CakeRequest(null, false); + $this->Controller = new ScaffoldMockControllerWithError($request); + $this->Controller->response = $this->getMock('CakeResponse', array('_sendHeader')); + + $params = array( + 'plugin' => null, + 'pass' => array(1), + 'form' => array(), + 'named' => array(), + 'url' => array('url' => 'scaffold_mock/edit'), + 'controller' => 'scaffold_mock', + 'action' => 'edit', + ); + $this->Controller->request->base = ''; + $this->Controller->request->webroot = '/'; + $this->Controller->request->here = '/scaffold_mock/edit'; + $this->Controller->request->addParams($params); + + //set router. + Router::reload(); + Router::setRequestInfo($this->Controller->request); + + $this->Controller->constructClasses(); + ob_start(); + new Scaffold($this->Controller, $this->Controller->request); + $this->Controller->response->send(); + $result = ob_get_clean(); + + $this->assertRegExp('/Scaffold Error/', $result); + } } diff --git a/lib/Cake/View/Errors/scaffold_error.ctp b/lib/Cake/View/Errors/scaffold_error.ctp index ad4208fc9..ce1eea8e6 100644 --- a/lib/Cake/View/Errors/scaffold_error.ctp +++ b/lib/Cake/View/Errors/scaffold_error.ctp @@ -31,4 +31,8 @@ function _scaffoldError() {
-element('exception_stack_trace'); ?> +element('exception_stack_trace'); +} +?> From 23954e6ad3418922d6a4611814bea797ae71678e Mon Sep 17 00:00:00 2001 From: William Notowidagdo Date: Fri, 1 Aug 2014 11:22:29 +0700 Subject: [PATCH 7/7] Update HtmlHelper.php No need to add `null` to `$options` param as mentioned in the docs section: [Using blocks for script and CSS files](http://book.cakephp.org/2.0/en/views.html#using-blocks-for-script-and-css-files) --- lib/Cake/View/Helper/HtmlHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/View/Helper/HtmlHelper.php b/lib/Cake/View/Helper/HtmlHelper.php index db5ca4a14..bde64dcb0 100644 --- a/lib/Cake/View/Helper/HtmlHelper.php +++ b/lib/Cake/View/Helper/HtmlHelper.php @@ -497,7 +497,7 @@ class HtmlHelper extends AppHelper { * * Add the script file to a custom block: * - * `$this->Html->script('styles.js', null, array('block' => 'bodyScript'));` + * `$this->Html->script('styles.js', array('block' => 'bodyScript'));` * * ### Options *