diff --git a/.travis.yml b/.travis.yml index b870cea58..bcee2e21c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,8 +38,8 @@ before_script: - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE SCHEMA test3;' -U postgres -d cakephp_test; fi" - chmod -R 777 ./app/tmp - sudo apt-get install lighttpd - - sh -c "if [ '$PHPCS' = '1' ]; then pear channel-discover pear.cakephp.org; fi" - - sh -c "if [ '$PHPCS' = '1' ]; then pear install --alldeps cakephp/CakePHP_CodeSniffer; fi" + - sh -c "if [ '$PHPCS' = '1' ]; then composer global require 'cakephp/cakephp-codesniffer:*'; fi" + - sh -c "if [ '$PHPCS' = '1' ]; then ~/.composer/vendor/bin/phpcs --config-set installed_paths ~/.composer/vendor/cakephp/cakephp-codesniffer; fi" - echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - phpenv rehash - set +H @@ -124,7 +124,7 @@ before_script: }" > app/Config/database.php script: - sh -c "if [ '$PHPCS' != '1' ]; then ./lib/Cake/Console/cake test core AllTests --stderr; fi" - - sh -c "if [ '$PHPCS' = '1' ]; then phpcs -p --extensions=php --standard=CakePHP ./lib/Cake; fi;" + - sh -c "if [ '$PHPCS' = '1' ]; then ~/.composer/vendor/bin/phpcs -p --extensions=php --standard=CakePHP ./lib/Cake; fi;" notifications: email: false diff --git a/lib/Cake/Cache/Engine/MemcachedEngine.php b/lib/Cake/Cache/Engine/MemcachedEngine.php index 12d4bc43f..74ea7c1c3 100644 --- a/lib/Cake/Cache/Engine/MemcachedEngine.php +++ b/lib/Cake/Cache/Engine/MemcachedEngine.php @@ -133,6 +133,7 @@ class MemcachedEngine extends CacheEngine { __d('cake_dev', 'Memcached extension is not build with SASL support') ); } + $this->_Memcached->setOption(Memcached::OPT_BINARY_PROTOCOL, true); $this->_Memcached->setSaslAuthData($this->settings['login'], $this->settings['password']); } if (is_array($this->settings['options'])) { diff --git a/lib/Cake/Controller/Controller.php b/lib/Cake/Controller/Controller.php index 8925f2dea..ab6e98180 100644 --- a/lib/Cake/Controller/Controller.php +++ b/lib/Cake/Controller/Controller.php @@ -669,6 +669,8 @@ class Controller extends Object implements CakeEventListener { * - triggers Component `startup` methods. * * @return void + * @triggers Controller.initialize $this + * @triggers Controller.startup $this */ public function startupProcess() { $this->getEventManager()->dispatch(new CakeEvent('Controller.initialize', $this)); @@ -683,6 +685,7 @@ class Controller extends Object implements CakeEventListener { * - calls the Controller's `afterFilter` method. * * @return void + * @triggers Controller.shutdown $this */ public function shutdownProcess() { $this->getEventManager()->dispatch(new CakeEvent('Controller.shutdown', $this)); @@ -751,6 +754,7 @@ class Controller extends Object implements CakeEventListener { * @param int $status Optional HTTP status code (eg: 404) * @param bool $exit If true, exit() will be called after the redirect * @return void + * @triggers Controller.beforeRedirect $this, array($url, $status, $exit) * @link http://book.cakephp.org/2.0/en/controllers.html#Controller::redirect */ public function redirect($url, $status = null, $exit = true) { @@ -920,6 +924,7 @@ class Controller extends Object implements CakeEventListener { * @param string $view View to use for rendering * @param string $layout Layout to use * @return CakeResponse A response object containing the rendered view. + * @triggers Controller.beforeRender $this * @link http://book.cakephp.org/2.0/en/controllers.html#Controller::render */ public function render($view = null, $layout = null) { diff --git a/lib/Cake/Event/CakeEventManager.php b/lib/Cake/Event/CakeEventManager.php index a552e4d43..64d94ccd8 100644 --- a/lib/Cake/Event/CakeEventManager.php +++ b/lib/Cake/Event/CakeEventManager.php @@ -221,6 +221,7 @@ class CakeEventManager { * * @param string|CakeEvent $event the event key name or instance of CakeEvent * @return CakeEvent + * @triggers $event */ public function dispatch($event) { if (is_string($event)) { diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index 29171d18e..70302b7a8 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -1721,6 +1721,8 @@ class Model extends Object implements CakeEventListener { * @return mixed On success Model::$data if its not empty or true, false on failure * @throws Exception * @throws PDOException + * @triggers Model.beforeSave $this, array($options) + * @triggers Model.afterSave $this, array($created, $options) * @link http://book.cakephp.org/2.0/en/models/saving-your-data.html */ public function save($data = null, $validate = true, $fieldList = array()) { @@ -2659,6 +2661,8 @@ class Model extends Object implements CakeEventListener { * @param int|string $id ID of record to delete * @param bool $cascade Set to true to delete records that depend on this record * @return bool True on success + * @triggers Model.beforeDelete $this, array($cascade) + * @triggers Model.afterDelete $this * @link http://book.cakephp.org/2.0/en/models/deleting-data.html */ public function delete($id = null, $cascade = true) { @@ -3032,6 +3036,7 @@ class Model extends Object implements CakeEventListener { * @param string $type Type of find operation (all / first / count / neighbors / list / threaded) * @param array $query Option fields (conditions / fields / joins / limit / offset / order / page / group / callbacks) * @return array|null Query array or null if it could not be build for some reasons + * @triggers Model.beforeFind $this, array($query) * @see Model::find() */ public function buildQuery($type = 'first', $query = array()) { @@ -3320,6 +3325,7 @@ class Model extends Object implements CakeEventListener { * @param array $results Results to filter * @param bool $primary If this is the primary model results (results from model where the find operation was performed) * @return array Set of filtered results + * @triggers Model.afterFind $this, array($results, $primary) */ protected function _filterResults($results, $primary = true) { $event = new CakeEvent('Model.afterFind', $this, array($results, $primary)); diff --git a/lib/Cake/Model/ModelValidator.php b/lib/Cake/Model/ModelValidator.php index 6b8de8e58..1980ea01c 100644 --- a/lib/Cake/Model/ModelValidator.php +++ b/lib/Cake/Model/ModelValidator.php @@ -235,6 +235,7 @@ class ModelValidator implements ArrayAccess, IteratorAggregate, Countable { * * @param string $options An optional array of custom options to be made available in the beforeValidate callback * @return array Array of invalid fields + * @triggers Model.afterValidate $model * @see ModelValidator::validates() */ public function errors($options = array()) { @@ -444,6 +445,7 @@ class ModelValidator implements ArrayAccess, IteratorAggregate, Countable { * * @param array $options Options to pass to callback. * @return bool + * @triggers Model.beforeValidate $model, array($options) */ protected function _triggerBeforeValidate($options = array()) { $model = $this->getModel(); diff --git a/lib/Cake/Routing/Dispatcher.php b/lib/Cake/Routing/Dispatcher.php index d7c66c775..13e2a2248 100644 --- a/lib/Cake/Routing/Dispatcher.php +++ b/lib/Cake/Routing/Dispatcher.php @@ -138,6 +138,8 @@ class Dispatcher implements CakeEventListener { * @param CakeResponse $response Response object to put the results of the dispatch into. * @param array $additionalParams Settings array ("bare", "return") which is melded with the GET and POST params * @return string|void if `$request['return']` is set then it returns response body, null otherwise + * @triggers Dispatcher.beforeDispatch $this, compact('request', 'response', 'additionalParams') + * @triggers Dispatcher.afterDispatch $this, compact('request', 'response') * @throws MissingControllerException When the controller is missing. */ public function dispatch(CakeRequest $request, CakeResponse $response, $additionalParams = array()) { diff --git a/lib/Cake/Test/Case/Event/CakeEventManagerTest.php b/lib/Cake/Test/Case/Event/CakeEventManagerTest.php index e6ff8fa7a..5eb8d3a2c 100644 --- a/lib/Cake/Test/Case/Event/CakeEventManagerTest.php +++ b/lib/Cake/Test/Case/Event/CakeEventManagerTest.php @@ -193,6 +193,7 @@ class CakeEventManagerTest extends CakeTestCase { * Tests event dispatching * * @return void + * @triggers fake.event */ public function testDispatch() { $manager = new CakeEventManager(); @@ -227,6 +228,7 @@ class CakeEventManagerTest extends CakeTestCase { * Tests event dispatching with a return value * * @return void + * @triggers fake.event */ public function testDispatchReturnValue() { $this->skipIf( @@ -254,6 +256,7 @@ class CakeEventManagerTest extends CakeTestCase { * Tests that returning false in a callback stops the event * * @return void + * @triggers fake.event */ public function testDispatchFalseStopsEvent() { $this->skipIf( @@ -281,6 +284,7 @@ class CakeEventManagerTest extends CakeTestCase { * Tests event dispatching using priorities * * @return void + * @triggers fake.event */ public function testDispatchPrioritized() { $manager = new CakeEventManager(); @@ -298,6 +302,7 @@ class CakeEventManagerTest extends CakeTestCase { * Tests event dispatching with passed params * * @return void + * @triggers fake.event $this, array('some' => 'data') */ public function testDispatchPassingParams() { $manager = new CakeEventManager(); @@ -316,6 +321,9 @@ class CakeEventManagerTest extends CakeTestCase { * Tests subscribing a listener object and firing the events it subscribed to * * @return void + * @triggers fake.event + * @triggers another.event $this, array('some' => 'data') + * @triggers multiple.handlers */ public function testAttachSubscriber() { $manager = new CakeEventManager(); @@ -380,6 +388,7 @@ class CakeEventManagerTest extends CakeTestCase { * Tests that the global event manager gets the event too from any other manager * * @return void + * @triggers fake.event */ public function testDispatchWithGlobal() { $generalManager = $this->getMock('CakeEventManager', array('prioritisedListeners')); @@ -396,6 +405,7 @@ class CakeEventManagerTest extends CakeTestCase { * Tests that stopping an event will not notify the rest of the listeners * * @return void + * @triggers fake.event */ public function testStopPropagation() { $generalManager = $this->getMock('CakeEventManager'); @@ -423,6 +433,7 @@ class CakeEventManagerTest extends CakeTestCase { * Tests event dispatching using priorities * * @return void + * @triggers fake.event */ public function testDispatchPrioritizedWithGlobal() { $generalManager = $this->getMock('CakeEventManager'); @@ -454,6 +465,7 @@ class CakeEventManagerTest extends CakeTestCase { * Tests event dispatching using priorities * * @return void + * @triggers fake.event */ public function testDispatchGlobalBeforeLocal() { $generalManager = $this->getMock('CakeEventManager'); @@ -490,6 +502,7 @@ class CakeEventManagerTest extends CakeTestCase { /** * Tests events dispatched by a local manager can be handled by * handler registered in the global event manager + * @triggers my_event $manager */ public function testDispatchLocalHandledByGlobal() { $callback = array($this, 'onMyEvent'); @@ -505,6 +518,7 @@ class CakeEventManagerTest extends CakeTestCase { * listeners at the same priority. * * @return void + * @triggers fake.event $this */ public function testDispatchWithGlobalAndLocalEvents() { $listener = new CustomTestEventListener(); diff --git a/lib/Cake/Test/Case/Event/CakeEventTest.php b/lib/Cake/Test/Case/Event/CakeEventTest.php index c4155db9a..9ba28d3a9 100644 --- a/lib/Cake/Test/Case/Event/CakeEventTest.php +++ b/lib/Cake/Test/Case/Event/CakeEventTest.php @@ -30,6 +30,7 @@ class CakeEventTest extends CakeTestCase { * Tests the name() method * * @return void + * @triggers fake.event */ public function testName() { $event = new CakeEvent('fake.event'); @@ -40,6 +41,8 @@ class CakeEventTest extends CakeTestCase { * Tests the subject() method * * @return void + * @triggers fake.event $this + * @triggers fake.event */ public function testSubject() { $event = new CakeEvent('fake.event', $this); @@ -53,6 +56,7 @@ class CakeEventTest extends CakeTestCase { * Tests the event propagation stopping property * * @return void + * @triggers fake.event */ public function testPropagation() { $event = new CakeEvent('fake.event'); @@ -65,6 +69,7 @@ class CakeEventTest extends CakeTestCase { * Tests that it is possible to get/set custom data in a event * * @return void + * @triggers fake.event $this, array('some' => 'data') */ public function testEventData() { $event = new CakeEvent('fake.event', $this, array('some' => 'data')); @@ -75,6 +80,7 @@ class CakeEventTest extends CakeTestCase { * Tests that it is possible to get the name and subject directly * * @return void + * @triggers fake.event $this */ public function testEventDirectPropertyAccess() { $event = new CakeEvent('fake.event', $this); diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php index 0a6493cb6..deee0e55b 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php @@ -1271,7 +1271,7 @@ SQL; * @param Model $model * @param array $queryData * @param array $binding - * @return void + * @return array The prepared association query */ protected function &_prepareAssociationQuery(Model $model, &$queryData, $binding) { $type = $binding['type']; @@ -3455,9 +3455,10 @@ SQL; $test->getLog(); $result = $Article->find('all', compact('conditions', 'contain')); - $expected = 'SELECT `Comment`.`id`, `Comment`.`article_id`, `Comment`.`user_id`, `Comment`.`comment`, `Comment`.`published`, `Comment`.`created`,' . + $expected = 'SELECT `Comment`.`id`, `Comment`.`article_id`, `Comment`.`user_id`, `Comment`.`comment`,' . + ' `Comment`.`published`, `Comment`.`created`,' . ' `Comment`.`updated`, (SELECT id FROM comments WHERE id = (SELECT 1)) AS `Comment__extra`' . - ' FROM `cakephp_test`.`comments` AS `Comment` WHERE `Comment`.`article_id` IN (1, 2)'; + ' FROM ' . $test->fullTableName('comments') . ' AS `Comment` WHERE `Comment`.`article_id` IN (1, 2)'; $log = $test->getLog(); $this->assertTextEquals($expected, $log['log'][count($log['log']) - 2]['query']); diff --git a/lib/Cake/Test/Case/Routing/DispatcherTest.php b/lib/Cake/Test/Case/Routing/DispatcherTest.php index ef0eefe5e..324d56a25 100644 --- a/lib/Cake/Test/Case/Routing/DispatcherTest.php +++ b/lib/Cake/Test/Case/Routing/DispatcherTest.php @@ -589,6 +589,7 @@ class DispatcherTest extends CakeTestCase { * testParseParamsWithoutZerosAndEmptyPost method * * @return void + * @triggers DispatcherTest $Dispatcher, array('request' => $request) */ public function testParseParamsWithoutZerosAndEmptyPost() { $Dispatcher = new Dispatcher(); @@ -607,6 +608,7 @@ class DispatcherTest extends CakeTestCase { * testParseParamsReturnsPostedData method * * @return void + * @triggers DispatcherTest $Dispatcher, array('request' => $request) */ public function testParseParamsReturnsPostedData() { $_POST['testdata'] = "My Posted Content"; @@ -622,6 +624,7 @@ class DispatcherTest extends CakeTestCase { * testParseParamsWithSingleZero method * * @return void + * @triggers DispatcherTest $Dispatcher, array('request' => $test) */ public function testParseParamsWithSingleZero() { $Dispatcher = new Dispatcher(); @@ -640,6 +643,7 @@ class DispatcherTest extends CakeTestCase { * testParseParamsWithManySingleZeros method * * @return void + * @triggers DispatcherTest $Dispatcher, array('request' => $test) */ public function testParseParamsWithManySingleZeros() { $Dispatcher = new Dispatcher(); @@ -659,6 +663,7 @@ class DispatcherTest extends CakeTestCase { * testParseParamsWithManyZerosInEachSectionOfUrl method * * @return void + * @triggers DispatcherTest $Dispatcher, array('request' => $test) */ public function testParseParamsWithManyZerosInEachSectionOfUrl() { $Dispatcher = new Dispatcher(); @@ -678,6 +683,7 @@ class DispatcherTest extends CakeTestCase { * testParseParamsWithMixedOneToManyZerosInEachSectionOfUrl method * * @return void + * @triggers DispatcherTest $Dispatcher, array('request' => $test) */ public function testParseParamsWithMixedOneToManyZerosInEachSectionOfUrl() { $Dispatcher = new Dispatcher(); @@ -697,6 +703,8 @@ class DispatcherTest extends CakeTestCase { * testQueryStringOnRoot method * * @return void + * @triggers DispatcherTest $Dispatcher, array('request' => $request) + * @triggers DispatcherTest $Dispatcher, array('request' => $request) */ public function testQueryStringOnRoot() { Router::reload(); @@ -928,6 +936,7 @@ class DispatcherTest extends CakeTestCase { * testPluginDispatch method * * @return void + * @triggers DispatcherTest $Dispatcher, array('request' => $url) */ public function testPluginDispatch() { $_POST = array(); @@ -1640,6 +1649,11 @@ class DispatcherTest extends CakeTestCase { * testHttpMethodOverrides method * * @return void + * @triggers DispatcherTest $dispatcher, array('request' => $request) + * @triggers DispatcherTest $dispatcher, array('request' => $request) + * @triggers DispatcherTest $dispatcher, array('request' => $request) + * @triggers DispatcherTest $dispatcher, array('request' => $request) + * @triggers DispatcherTest $dispatcher, array('request' => $request) */ public function testHttpMethodOverrides() { Router::reload(); diff --git a/lib/Cake/Test/Case/Routing/Filter/AssetDispatcherTest.php b/lib/Cake/Test/Case/Routing/Filter/AssetDispatcherTest.php index dc43fda46..638700535 100644 --- a/lib/Cake/Test/Case/Routing/Filter/AssetDispatcherTest.php +++ b/lib/Cake/Test/Case/Routing/Filter/AssetDispatcherTest.php @@ -39,6 +39,12 @@ class AssetDispatcherTest extends CakeTestCase { * test that asset filters work for theme and plugin assets * * @return void + * @triggers DispatcherTest $this, compact('request', 'response') + * @triggers DispatcherTest $this, compact('request', 'response') + * @triggers DispatcherTest $this, compact('request', 'response') + * @triggers DispatcherTest $this, compact('request', 'response') + * @triggers DispatcherTest $this, compact('request', 'response') + * @triggers DispatcherTest $this, compact('request', 'response') */ public function testAssetFilterForThemeAndPlugins() { $filter = new AssetDispatcher(); @@ -88,6 +94,7 @@ class AssetDispatcherTest extends CakeTestCase { * by Routing. * * @return void + * @triggers DispatcherTest $this, compact('request', 'response') */ public function testNoHandleRoutedExtension() { $filter = new AssetDispatcher(); @@ -115,6 +122,8 @@ class AssetDispatcherTest extends CakeTestCase { * file dispatching * * @return void + * @triggers DispatcherTest $this, compact('request', 'response') + * @triggers DispatcherTest $this, compact('request', 'response') */ public function testNotModified() { $filter = new AssetDispatcher(); @@ -160,6 +169,7 @@ class AssetDispatcherTest extends CakeTestCase { * Test that no exceptions are thrown for //index.php type URLs. * * @return void + * @triggers Dispatcher.beforeRequest $this, compact('request', 'response') */ public function test404OnDoubleSlash() { $filter = new AssetDispatcher(); @@ -176,6 +186,7 @@ class AssetDispatcherTest extends CakeTestCase { * Test that attempts to traverse directories are prevented. * * @return void + * @triggers Dispatcher.beforeRequest $this, compact('request', 'response') */ public function test404OnDoubleDot() { App::build(array( @@ -198,6 +209,7 @@ class AssetDispatcherTest extends CakeTestCase { * Test that attempts to traverse directories with urlencoded paths fail. * * @return void + * @triggers Dispatcher.beforeRequest $this, compact('request', 'response') */ public function test404OnDoubleDotEncoded() { App::build(array( diff --git a/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php b/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php index 5d4d0f30b..c92c4923b 100644 --- a/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php +++ b/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php @@ -535,6 +535,7 @@ class ObjectCollectionTest extends CakeTestCase { * tests that passing an instance of CakeEvent to trigger will prepend the subject to the list of arguments * * @return void + * @triggers callback $subjectClass, array('first argument') */ public function testDispatchEventWithSubject() { $this->_makeMockClasses(); @@ -560,6 +561,7 @@ class ObjectCollectionTest extends CakeTestCase { * will NOT prepend the subject to the list of arguments * * @return void + * @triggers callback $subjectClass, array('first argument') */ public function testDispatchEventNoSubject() { $this->_makeMockClasses(); diff --git a/lib/Cake/TestSuite/ControllerTestCase.php b/lib/Cake/TestSuite/ControllerTestCase.php index 2216d2247..ba93ab7d2 100644 --- a/lib/Cake/TestSuite/ControllerTestCase.php +++ b/lib/Cake/TestSuite/ControllerTestCase.php @@ -213,6 +213,7 @@ abstract class ControllerTestCase extends CakeTestCase { * @param string $url The url to test * @param array $options See options * @return mixed + * @triggers ControllerTestCase $Dispatch, array('request' => $request) */ protected function _testAction($url = '', $options = array()) { $this->vars = $this->result = $this->view = $this->contents = $this->headers = null; diff --git a/lib/Cake/View/View.php b/lib/Cake/View/View.php index d0ef25200..a33dd1a1f 100644 --- a/lib/Cake/View/View.php +++ b/lib/Cake/View/View.php @@ -458,6 +458,8 @@ class View extends Object { * @param string $view Name of view file to use * @param string $layout Layout to use. * @return string|null Rendered content or null if content already rendered and returned earlier. + * @triggers View.beforeRender $this, array($viewFileName) + * @triggers View.afterRender $this, array($viewFileName) * @throws CakeException If there is an error in the view. */ public function render($view = null, $layout = null) { @@ -504,6 +506,8 @@ class View extends Object { * @param string $content Content to render in a view, wrapped by the surrounding layout. * @param string $layout Layout name * @return mixed Rendered output, or false on error + * @triggers View.beforeLayout $this, array($layoutFileName) + * @triggers View.afterLayout $this, array($layoutFileName) * @throws CakeException if there is an error in the view. */ public function renderLayout($content, $layout = null) { @@ -901,6 +905,8 @@ class View extends Object { * @param string $viewFile Filename of the view * @param array $data Data to include in rendered view. If empty the current View::$viewVars will be used. * @return string Rendered output + * @triggers View.beforeRenderFile $this, array($viewFile) + * @triggers View.afterRenderFile $this, array($viewFile, $content) * @throws CakeException when a block is left open. */ protected function _render($viewFile, $data = array()) { @@ -1196,6 +1202,8 @@ class View extends Object { * @param array $data Data to render * @param array $options Element options * @return string + * @triggers View.beforeRender $this, array($file) + * @triggers View.afterRender $this, array($file, $element) */ protected function _renderElement($file, $data, $options) { $current = $this->_current;