Browse Source

Removing no longer used ObjectCollection.

Renan Gonçalves 12 years ago
parent
commit
617865a40f

+ 1 - 1
src/Log/Log.php

@@ -156,7 +156,7 @@ class Log {
 	);
 
 /**
- * initialize ObjectCollection
+ * Initializes registry and configurations
  *
  * @return void
  */

+ 0 - 331
src/Utility/ObjectCollection.php

@@ -1,331 +0,0 @@
-<?php
-/**
- * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
- * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
- *
- * Licensed under The MIT License
- * For full copyright and license information, please see the LICENSE.txt
- * Redistributions of files must retain the above copyright notice.
- *
- * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link          http://cakephp.org CakePHP(tm) Project
- * @since         2.0.0
- * @license       http://www.opensource.org/licenses/mit-license.php MIT License
- */
-namespace Cake\Utility;
-
-use Cake\Error;
-use Cake\Event\Event;
-
-/**
- * Deals with Collections of objects. Keeping registries of those objects,
- * loading and constructing new objects and triggering callbacks. Each subclass needs
- * to implement its own load() functionality.
- *
- * All core subclasses of ObjectCollection by convention loaded objects are stored
- * in `$this->_loaded`. Enabled objects are stored in `$this->_enabled`. In addition,
- * they all support an `enabled` option that controls the enabled/disabled state of the object
- * when loaded.
- */
-abstract class ObjectCollection {
-
-/**
- * List of the currently-enabled objects
- *
- * @var array
- */
-	protected $_enabled = array();
-
-/**
- * A hash of loaded objects, indexed by name
- *
- * @var array
- */
-	protected $_loaded = array();
-
-/**
- * Default object priority. A non zero integer.
- *
- * @var integer
- */
-	public $defaultPriority = 10;
-
-/**
- * Loads a new object onto the collection. Can throw a variety of exceptions
- *
- * Implementations of this class support a `$options['enabled']` flag which enables/disables
- * a loaded object.
- *
- * @param string $name Name of object to load.
- * @param array $options Array of configuration options for the object to be constructed.
- * @return object the constructed object
- */
-	abstract public function load($name, $options = array());
-
-/**
- * Trigger a callback method on every object in the collection.
- * Used to trigger methods on objects in the collection. Will fire the methods in the
- * order they were attached.
- *
- * ### Options
- *
- * - `breakOn` Set to the value or values you want the callback propagation to stop on.
- *    Can either be a scalar value, or an array of values to break on. Defaults to `false`.
- *
- * - `break` Set to true to enabled breaking. When a trigger is broken, the last returned value
- *    will be returned. If used in combination with `collectReturn` the collected results will be returned.
- *    Defaults to `false`.
- *
- * - `collectReturn` Set to true to collect the return of each object into an array.
- *    This array of return values will be returned from the trigger() call. Defaults to `false`.
- *
- * - `modParams` Allows each object the callback gets called on to modify the parameters to the next object.
- *    Setting modParams to an integer value will allow you to modify the parameter with that index.
- *    Any non-null value will modify the parameter index indicated.
- *    Defaults to false.
- *
- *
- * @param string $callback|\Cake\Event\Event Method to fire on all the objects. Its assumed all the objects implement
- *   the method you are calling. If an instance of Cake\Event\Event is provided, then then Event name will parsed to
- *   get the callback name. This is done by getting the last word after any dot in the event name
- *   (eg. `Model.afterSave` event will trigger the `afterSave` callback)
- * @param array $params Array of parameters for the triggered callback.
- * @param array $options Array of options.
- * @return mixed Either the last result or all results if collectReturn is on.
- * @throws \Cake\Error\Exception when modParams is used with an index that does not exist.
- */
-	public function trigger($callback, $params = array(), $options = array()) {
-		if (empty($this->_enabled)) {
-			return true;
-		}
-		if ($callback instanceof Event) {
-			$event = $callback;
-			if (is_array($event->data)) {
-				$params =& $event->data;
-			}
-			if (empty($event->omitSubject)) {
-				$subject = $event->subject();
-			}
-			foreach (array('break', 'breakOn', 'collectReturn', 'modParams') as $opt) {
-				if (isset($event->{$opt})) {
-					$options[$opt] = $event->{$opt};
-				}
-			}
-			$parts = explode('.', $event->name());
-			$callback = array_pop($parts);
-		}
-		$options = array_merge(
-			array(
-				'break' => false,
-				'breakOn' => false,
-				'collectReturn' => false,
-				'modParams' => false
-			),
-			$options
-		);
-		$collected = array();
-		$list = array_keys($this->_enabled);
-		if ($options['modParams'] !== false && !isset($params[$options['modParams']])) {
-			throw new Error\Exception('Cannot use modParams with indexes that do not exist.');
-		}
-		$result = null;
-		foreach ($list as $name) {
-			$result = call_user_func_array(array($this->_loaded[$name], $callback), compact('subject') + $params);
-			if ($options['collectReturn'] === true) {
-				$collected[] = $result;
-			}
-			if (
-				$options['break'] && ($result === $options['breakOn'] ||
-				(is_array($options['breakOn']) && in_array($result, $options['breakOn'], true)))
-			) {
-				return $result;
-			} elseif ($options['modParams'] !== false && !in_array($result, array(true, false, null), true)) {
-				$params[$options['modParams']] = $result;
-			}
-		}
-		if ($options['modParams'] !== false) {
-			return $params[$options['modParams']];
-		}
-		return $options['collectReturn'] ? $collected : $result;
-	}
-
-/**
- * Provide public read access to the loaded objects
- *
- * @param string $name Name of property to read
- * @return mixed
- */
-	public function __get($name) {
-		if (isset($this->_loaded[$name])) {
-			return $this->_loaded[$name];
-		}
-		return null;
-	}
-
-/**
- * Provide isset access to _loaded
- *
- * @param string $name Name of object being checked.
- * @return boolean
- */
-	public function __isset($name) {
-		return isset($this->_loaded[$name]);
-	}
-
-/**
- * Enables callbacks on an object or array of objects
- *
- * @param string|array $name CamelCased name of the object(s) to enable (string or array)
- * @param boolean $prioritize Prioritize enabled list after enabling object(s)
- * @return void
- */
-	public function enable($name, $prioritize = true) {
-		$enabled = false;
-		foreach ((array)$name as $object) {
-			if (isset($this->_loaded[$object]) && !isset($this->_enabled[$object])) {
-				$priority = $this->defaultPriority;
-				if (isset($this->_loaded[$object]->settings['priority'])) {
-					$priority = $this->_loaded[$object]->settings['priority'];
-				}
-				$this->_enabled[$object] = array($priority);
-				$enabled = true;
-			}
-		}
-		if ($prioritize && $enabled) {
-			$this->prioritize();
-		}
-	}
-
-/**
- * Prioritize list of enabled object
- *
- * @return array Prioritized list of object
- */
-	public function prioritize() {
-		$i = 1;
-		foreach ($this->_enabled as $name => $priority) {
-			$priority[1] = $i++;
-			$this->_enabled[$name] = $priority;
-		}
-		asort($this->_enabled);
-		return $this->_enabled;
-	}
-
-/**
- * Set priority for an object or array of objects
- *
- * @param string|array $name CamelCased name of the object(s) to enable (string or array)
- * 	If string the second param $priority is used else it should be an associative array
- * 	with keys as object names and values as priorities to set.
- * @param integer|null Integer priority to set or null for default
- * @return void
- */
-	public function setPriority($name, $priority = null) {
-		if (is_string($name)) {
-			$name = array($name => $priority);
-		}
-		foreach ($name as $object => $objectPriority) {
-			if (isset($this->_loaded[$object])) {
-				if ($objectPriority === null) {
-					$objectPriority = $this->defaultPriority;
-				}
-				$this->_loaded[$object]->settings['priority'] = $objectPriority;
-				if (isset($this->_enabled[$object])) {
-					$this->_enabled[$object] = array($objectPriority);
-				}
-			}
-		}
-		$this->prioritize();
-	}
-
-/**
- * Disables callbacks on a 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)
- * @return void
- */
-	public function disable($name) {
-		foreach ((array)$name as $object) {
-			unset($this->_enabled[$object]);
-		}
-	}
-
-/**
- * Gets the list of currently-enabled objects, or, the current status of a single objects
- *
- * @param string $name Optional. The name of the object to check the status of. If omitted,
- *   returns an array of currently-enabled object
- * @return mixed If $name is specified, returns the boolean status of the corresponding object.
- *   Otherwise, returns an array of all enabled objects.
- */
-	public function enabled($name = null) {
-		if (!empty($name)) {
-			return isset($this->_enabled[$name]);
-		}
-		return array_keys($this->_enabled);
-	}
-
-/**
- * Gets the list of loaded objects, or, whether the given object is loaded
- *
- * @param string $name Optional. The name of the object to check the status of. If omitted,
- *   returns an array of currently-loaded objects
- * @return mixed If $name is specified, returns the boolean status of the corresponding object.
- *    Otherwise, returns an array of all loaded objects.
- */
-	public function loaded($name = null) {
-		if (!empty($name)) {
-			return isset($this->_loaded[$name]);
-		}
-		return array_keys($this->_loaded);
-	}
-
-/**
- * Name of the object to remove from the collection
- *
- * @param string $name Name of the object to delete.
- * @return void
- */
-	public function unload($name) {
-		list(, $name) = pluginSplit($name);
-		unset($this->_loaded[$name], $this->_enabled[$name]);
-	}
-
-/**
- * Adds or overwrites an instantiated object to the collection
- *
- * @param string $name Name of the object
- * @param Object $object The object to use
- * @return array Loaded objects
- */
-	public function set($name = null, $object = null) {
-		if (!empty($name) && !empty($object)) {
-			list(, $name) = pluginSplit($name);
-			$this->_loaded[$name] = $object;
-		}
-		return $this->_loaded;
-	}
-
-/**
- * Normalizes an object array, creates an array that makes lazy loading
- * easier
- *
- * @param array $objects Array of child objects to normalize.
- * @return array Array of normalized objects.
- */
-	public static function normalizeObjectArray($objects) {
-		$normal = array();
-		foreach ($objects as $i => $objectName) {
-			$options = array();
-			if (!is_int($i)) {
-				$options = (array)$objectName;
-				$objectName = $i;
-			}
-			list(, $name) = pluginSplit($objectName);
-			$normal[$name] = array('class' => $objectName, 'settings' => $options);
-		}
-		return $normal;
-	}
-
-}

+ 1 - 2
src/Utility/ObjectRegistry.php

@@ -21,8 +21,7 @@ namespace Cake\Utility;
  * as a super class for various composition based re-use features in CakePHP.
  *
  * Each subclass needs to implement the various abstract methods to complete
- * the template method load(). This class replaces ObjectCollection
- * from previous versions of CakePHP.
+ * the template method load().
  *
  * @see \Cake\Controller\ComponentRegistry
  * @see \Cake\View\HelperRegistry

+ 0 - 589
tests/TestCase/Utility/ObjectCollectionTest.php

@@ -1,589 +0,0 @@
-<?php
-/**
- * ObjectCollectionTest file
- *
- * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
- * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
- *
- * Licensed under The MIT License
- * For full copyright and license information, please see the LICENSE.txt
- * Redistributions of files must retain the above copyright notice.
- *
- * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link          http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
- * @since         2.0.0
- * @license       http://www.opensource.org/licenses/mit-license.php MIT License
- */
-namespace Cake\Test\TestCase\Utility;
-
-use Cake\Core\Object;
-use Cake\Event\Event;
-use Cake\TestSuite\TestCase;
-use Cake\Utility\ObjectCollection;
-
-/**
- * A generic object class
- */
-class GenericObject {
-
-/**
- * Constructor
- *
- * @param GenericObjectCollection $collection
- * @param array $settings
- */
-	public function __construct(GenericObjectCollection $collection, $settings = array()) {
-		$this->_Collection = $collection;
-	}
-
-}
-
-/**
- * First Extension of Generic Object
- */
-class FirstGenericObject extends GenericObject {
-
-/**
- * A generic callback
- */
-	public function callback() {
-	}
-
-}
-
-/**
- * Second Extension of Generic Object
- */
-class SecondGenericObject extends GenericObject {
-
-	public function callback() {
-	}
-
-}
-
-/**
- * Third Extension of Generic Object
- */
-class ThirdGenericObject extends GenericObject {
-
-	public function callback() {
-	}
-
-}
-
-/**
- * A collection of Generic objects
- */
-class GenericObjectCollection extends ObjectCollection {
-
-/**
- * Loads a generic object
- *
- * @param string $object Object name
- * @param array $settings Settings array
- * @return array List of loaded objects
- */
-	public function load($object, $settings = array()) {
-		list(, $name) = pluginSplit($object);
-		if (isset($this->_loaded[$name])) {
-			return $this->_loaded[$name];
-		}
-		$objectClass = $name . 'GenericObject';
-		if (strpos($objectClass, 'Mock') === false) {
-			$objectClass = __NAMESPACE__ . '\\' . $objectClass;
-		}
-		$this->_loaded[$name] = new $objectClass($this, $settings);
-		$enable = isset($settings['enabled']) ? $settings['enabled'] : true;
-		if ($enable === true) {
-			$this->enable($name);
-		}
-		return $this->_loaded[$name];
-	}
-
-/**
- * Helper method for adding/overwriting enabled objects including
- * settings
- *
- * @param string $name Name of the object
- * @param Object $object The object to use
- * @param array $settings Settings to apply for the object
- * @return array Loaded objects
- */
-	public function setObject($name, $object, $settings = array()) {
-		$this->_loaded[$name] = $object;
-		if (isset($settings['priority'])) {
-			$this->setPriority($name, $settings['priority']);
-		}
-		$enable = isset($settings['enabled']) ? $settings['enabled'] : true;
-		if ($enable === true) {
-			$this->enable($name);
-		}
-		return $this->_loaded;
-	}
-
-}
-
-class ObjectCollectionTest extends TestCase {
-
-/**
- * setUp
- *
- * @return void
- */
-	public function setUp() {
-		parent::setUp();
-		$this->Objects = new GenericObjectCollection();
-	}
-
-/**
- * tearDown
- *
- * @return void
- */
-	public function tearDown() {
-		parent::tearDown();
-		unset($this->Objects);
-	}
-
-/**
- * test triggering callbacks on loaded helpers
- *
- * @return void
- */
-	public function testLoad() {
-		$result = $this->Objects->load('First');
-		$this->assertInstanceOf(__NAMESPACE__ . '\FirstGenericObject', $result);
-		$this->assertInstanceOf(__NAMESPACE__ . '\FirstGenericObject', $this->Objects->First);
-
-		$result = $this->Objects->loaded();
-		$this->assertEquals(array('First'), $result, 'loaded() results are wrong.');
-
-		$this->assertTrue($this->Objects->enabled('First'));
-
-		$result = $this->Objects->load('First');
-		$this->assertSame($result, $this->Objects->First);
-	}
-
-/**
- * test unload()
- *
- * @return void
- */
-	public function testUnload() {
-		$this->Objects->load('First');
-		$this->Objects->load('Second');
-
-		$result = $this->Objects->loaded();
-		$this->assertEquals(array('First', 'Second'), $result, 'loaded objects are wrong');
-
-		$this->Objects->unload('First');
-		$this->assertFalse(isset($this->Objects->First));
-		$this->assertTrue(isset($this->Objects->Second));
-
-		$result = $this->Objects->loaded();
-		$this->assertEquals(array('Second'), $result, 'loaded objects are wrong');
-
-		$result = $this->Objects->loaded();
-		$this->assertEquals(array('Second'), $result, 'enabled objects are wrong');
-	}
-
-/**
- * Tests set()
- *
- * @return void
- */
-	public function testSet() {
-		$this->Objects->load('First');
-
-		$result = $this->Objects->loaded();
-		$this->assertEquals(array('First'), $result, 'loaded objects are wrong');
-
-		$result = $this->Objects->set('First', new SecondGenericObject($this->Objects));
-		$this->assertInstanceOf(__NAMESPACE__ . '\SecondGenericObject', $result['First'], 'set failed');
-
-		$result = $this->Objects->set('Second', new SecondGenericObject($this->Objects));
-		$this->assertInstanceOf(__NAMESPACE__ . '\SecondGenericObject', $result['Second'], 'set failed');
-
-		$this->assertEquals(2, count($result));
-	}
-
-/**
- * creates mock classes for testing
- *
- * @return void
- */
-	protected function _makeMockClasses() {
-		$this->FirstGenericObject = $this->getMock(
-			__NAMESPACE__ . '\FirstGenericObject',
-			array(), array(), '', false
-		);
-		$this->SecondGenericObject = $this->getMock(
-			__NAMESPACE__ . '\SecondGenericObject',
-			array(), array(), '', false
-		);
-		$this->ThirdGenericObject = $this->getMock(
-			__NAMESPACE__ . '\ThirdGenericObject',
-			array(), array(), '', false
-		);
-	}
-
-/**
- * test triggering callbacks.
- *
- * @return void
- */
-	public function testTrigger() {
-		$this->_makeMockClasses();
-		$this->Objects->setObject('TriggerMockFirst', $this->FirstGenericObject);
-		$this->Objects->setObject('TriggerMockSecond', $this->SecondGenericObject);
-
-		$this->Objects->TriggerMockFirst->expects($this->once())
-			->method('callback')
-			->will($this->returnValue(true));
-		$this->Objects->TriggerMockSecond->expects($this->once())
-			->method('callback')
-			->will($this->returnValue(true));
-
-		$this->assertTrue($this->Objects->trigger('callback'));
-	}
-
-/**
- * test trigger and disabled objects
- *
- * @return void
- */
-	public function testTriggerWithDisabledObjects() {
-		$this->_makeMockClasses();
-		$this->Objects->setObject('TriggerMockFirst', $this->FirstGenericObject);
-		$this->Objects->setObject('TriggerMockSecond', $this->SecondGenericObject, array('enabled' => false));
-
-		$this->Objects->TriggerMockFirst->expects($this->once())
-			->method('callback')
-			->will($this->returnValue(true));
-		$this->Objects->TriggerMockSecond->expects($this->never())
-			->method('callback')
-			->will($this->returnValue(true));
-
-		$this->assertTrue($this->Objects->trigger('callback', array()));
-	}
-
-/**
- * test that the collectReturn option works.
- *
- * @return void
- */
-	public function testTriggerWithCollectReturn() {
-		$this->_makeMockClasses();
-		$this->Objects->setObject('TriggerMockFirst', $this->FirstGenericObject);
-		$this->Objects->setObject('TriggerMockSecond', $this->SecondGenericObject);
-
-		$this->Objects->TriggerMockFirst->expects($this->once())
-			->method('callback')
-			->will($this->returnValue(array('one', 'two')));
-		$this->Objects->TriggerMockSecond->expects($this->once())
-			->method('callback')
-			->will($this->returnValue(array('three', 'four')));
-
-		$result = $this->Objects->trigger('callback', array(), array('collectReturn' => true));
-		$expected = array(
-			array('one', 'two'),
-			array('three', 'four')
-		);
-		$this->assertEquals($expected, $result);
-	}
-
-/**
- * test that trigger with break & breakOn works.
- *
- * @return void
- */
-	public function testTriggerWithBreak() {
-		$this->_makeMockClasses();
-		$this->Objects->setObject('TriggerMockFirst', $this->FirstGenericObject);
-		$this->Objects->setObject('TriggerMockSecond', $this->SecondGenericObject);
-
-		$this->Objects->TriggerMockFirst->expects($this->once())
-			->method('callback')
-			->will($this->returnValue(false));
-		$this->Objects->TriggerMockSecond->expects($this->never())
-			->method('callback');
-
-		$result = $this->Objects->trigger(
-			'callback',
-			array(),
-			array('break' => true, 'breakOn' => false)
-		);
-		$this->assertFalse($result);
-	}
-
-/**
- * test that trigger with modParams works.
- *
- * @return void
- */
-	public function testTriggerWithModParams() {
-		$this->_makeMockClasses();
-		$this->Objects->setObject('TriggerMockFirst', $this->FirstGenericObject);
-		$this->Objects->setObject('TriggerMockSecond', $this->SecondGenericObject);
-
-		$this->Objects->TriggerMockFirst->expects($this->once())
-			->method('callback')
-			->with(array('value'))
-			->will($this->returnValue(array('new value')));
-
-		$this->Objects->TriggerMockSecond->expects($this->once())
-			->method('callback')
-			->with(array('new value'))
-			->will($this->returnValue(array('newer value')));
-
-		$result = $this->Objects->trigger(
-			'callback',
-			array(array('value')),
-			array('modParams' => 0)
-		);
-		$this->assertEquals(array('newer value'), $result);
-	}
-
-/**
- * test that setting modParams to an index that doesn't exist doesn't cause errors.
- *
- * @expectedException \Cake\Error\Exception
- * @return void
- */
-	public function testTriggerModParamsInvalidIndex() {
-		$this->_makeMockClasses();
-		$this->Objects->setObject('TriggerMockFirst', $this->FirstGenericObject);
-		$this->Objects->setObject('TriggerMockSecond', $this->SecondGenericObject);
-
-		$this->Objects->TriggerMockFirst->expects($this->never())
-			->method('callback');
-
-		$this->Objects->TriggerMockSecond->expects($this->never())
-			->method('callback');
-
-		$this->Objects->trigger(
-			'callback',
-			array(array('value')),
-			array('modParams' => 2)
-		);
-	}
-
-/**
- * test that returning null doesn't modify parameters.
- *
- * @return void
- */
-	public function testTriggerModParamsNullIgnored() {
-		$this->_makeMockClasses();
-		$this->Objects->setObject('TriggerMockFirst', $this->FirstGenericObject);
-		$this->Objects->setObject('TriggerMockSecond', $this->SecondGenericObject);
-
-		$this->Objects->TriggerMockFirst->expects($this->once())
-			->method('callback')
-			->with(array('value'))
-			->will($this->returnValue(null));
-
-		$this->Objects->TriggerMockSecond->expects($this->once())
-			->method('callback')
-			->with(array('value'))
-			->will($this->returnValue(array('new value')));
-
-		$result = $this->Objects->trigger(
-			'callback',
-			array(array('value')),
-			array('modParams' => 0)
-		);
-		$this->assertEquals(array('new value'), $result);
-	}
-
-/**
- * test order of callbacks triggering based on priority.
- *
- * @return void
- */
-	public function testTriggerPriority() {
-		$this->_makeMockClasses();
-		$this->Objects->setObject('TriggerMockFirst', $this->FirstGenericObject);
-		$this->Objects->setObject('TriggerMockSecond', $this->SecondGenericObject, array('priority' => 5));
-
-		$this->Objects->TriggerMockFirst->expects($this->any())
-			->method('callback')
-			->will($this->returnValue('1st'));
-		$this->Objects->TriggerMockSecond->expects($this->any())
-			->method('callback')
-			->will($this->returnValue('2nd'));
-
-		$result = $this->Objects->trigger('callback', array(), array('collectReturn' => true));
-		$expected = array(
-			'2nd',
-			'1st'
-		);
-		$this->assertEquals($expected, $result);
-
-		$this->Objects->setObject('TriggerMockThird', $this->ThirdGenericObject, array('priority' => 7));
-		$this->Objects->TriggerMockThird->expects($this->any())
-			->method('callback')
-			->will($this->returnValue('3rd'));
-
-		$result = $this->Objects->trigger('callback', array(), array('collectReturn' => true));
-		$expected = array(
-			'2nd',
-			'3rd',
-			'1st'
-		);
-		$this->assertEquals($expected, $result);
-
-		$this->Objects->disable('TriggerMockFirst');
-		$result = $this->Objects->trigger('callback', array(), array('collectReturn' => true));
-		$expected = array(
-			'2nd',
-			'3rd'
-		);
-		$this->assertEquals($expected, $result);
-
-		$this->Objects->enable('TriggerMockFirst');
-		$result = $this->Objects->trigger('callback', array(), array('collectReturn' => true));
-		$expected = array(
-			'2nd',
-			'3rd',
-			'1st'
-		);
-		$this->assertEquals($expected, $result);
-
-		$this->Objects->disable('TriggerMockThird');
-		$result = $this->Objects->trigger('callback', array(), array('collectReturn' => true));
-		$expected = array(
-			'2nd',
-			'1st'
-		);
-		$this->assertEquals($expected, $result);
-
-		$this->Objects->enable('TriggerMockThird', false);
-		$result = $this->Objects->trigger('callback', array(), array('collectReturn' => true));
-		$expected = array(
-			'2nd',
-			'1st',
-			'3rd'
-		);
-		$this->assertEquals($expected, $result);
-
-		$this->Objects->setPriority('TriggerMockThird', 1);
-		$result = $this->Objects->trigger('callback', array(), array('collectReturn' => true));
-		$expected = array(
-			'3rd',
-			'2nd',
-			'1st'
-		);
-		$this->assertEquals($expected, $result);
-
-		$this->Objects->disable('TriggerMockThird');
-		$this->Objects->setPriority('TriggerMockThird', 11);
-		$result = $this->Objects->trigger('callback', array(), array('collectReturn' => true));
-		$expected = array(
-			'2nd',
-			'1st'
-		);
-		$this->assertEquals($expected, $result);
-
-		$this->Objects->enable('TriggerMockThird');
-		$result = $this->Objects->trigger('callback', array(), array('collectReturn' => true));
-		$expected = array(
-			'2nd',
-			'1st',
-			'3rd'
-		);
-		$this->assertEquals($expected, $result);
-
-		$this->Objects->setPriority('TriggerMockThird');
-		$result = $this->Objects->trigger('callback', array(), array('collectReturn' => true));
-		$expected = array(
-			'2nd',
-			'1st',
-			'3rd'
-		);
-		$this->assertEquals($expected, $result);
-	}
-
-/**
- * test normalizeObjectArray
- *
- * @return void
- */
-	public function testnormalizeObjectArray() {
-		$components = array(
-			'Html',
-			'Foo.Bar' => array('one', 'two'),
-			'Something',
-			'Banana.Apple' => array('foo' => 'bar')
-		);
-		$result = ObjectCollection::normalizeObjectArray($components);
-		$expected = array(
-			'Html' => array('class' => 'Html', 'settings' => array()),
-			'Bar' => array('class' => 'Foo.Bar', 'settings' => array('one', 'two')),
-			'Something' => array('class' => 'Something', 'settings' => array()),
-			'Apple' => array('class' => 'Banana.Apple', 'settings' => array('foo' => 'bar')),
-		);
-		$this->assertEquals($expected, $result);
-
-		// This is the result after Controller::_mergeVars
-		$components = array(
-			'Html' => null,
-			'Foo.Bar' => array('one', 'two'),
-			'Something' => null,
-			'Banana.Apple' => array('foo' => 'bar')
-		);
-		$result = ObjectCollection::normalizeObjectArray($components);
-		$this->assertEquals($expected, $result);
-	}
-
-/**
- * tests that passing an instance of Cake\Event\Event to trigger will prepend the subject to the list of arguments
- *
- * @return void
- */
-	public function testDispatchEventWithSubject() {
-		$this->_makeMockClasses();
-		$this->Objects->setObject('TriggerMockFirst', $this->FirstGenericObject);
-		$this->Objects->setObject('TriggerMockSecond', $this->SecondGenericObject);
-
-		$subjectClass = new Object();
-		$this->Objects->TriggerMockFirst->expects($this->once())
-			->method('callback')
-			->with($subjectClass, 'first argument')
-			->will($this->returnValue(true));
-		$this->Objects->TriggerMockSecond->expects($this->once())
-			->method('callback')
-			->with($subjectClass, 'first argument')
-			->will($this->returnValue(true));
-
-		$event = new Event('callback', $subjectClass, array('first argument'));
-		$this->assertTrue($this->Objects->trigger($event));
-	}
-
-/**
- * tests that passing an instance of Cake\Event\Event to trigger with omitSubject property
- * will NOT prepend the subject to the list of arguments
- *
- * @return void
- */
-	public function testDispatchEventNoSubject() {
-		$this->_makeMockClasses();
-		$this->Objects->setObject('TriggerMockFirst', $this->FirstGenericObject);
-		$this->Objects->setObject('TriggerMockSecond', $this->SecondGenericObject);
-
-		$subjectClass = new Object();
-		$this->Objects->TriggerMockFirst->expects($this->once())
-			->method('callback')
-			->with('first argument')
-			->will($this->returnValue(true));
-		$this->Objects->TriggerMockSecond->expects($this->once())
-			->method('callback')
-			->with('first argument')
-			->will($this->returnValue(true));
-
-		$event = new Event('callback', $subjectClass, array('first argument'));
-		$event->omitSubject = true;
-		$this->assertTrue($this->Objects->trigger($event));
-	}
-
-}