Fixing broken tests in HelperCollectionTest

Moving unload into ObjectCollection as its common between 2 child classes, and possibly a 3rd.
This commit is contained in:
mark_story 2010-07-06 23:29:42 -04:00
parent 426d35d66e
commit 19f008b1a4
4 changed files with 14 additions and 34 deletions

View file

@ -67,18 +67,6 @@ class ComponentCollection extends ObjectCollection {
return $this->_loaded[$name];
}
/**
* Name of the component to remove from the collection
*
* @param string $name Name of component to delete.
* @return void
*/
public function unload($name) {
list($plugin, $name) = pluginSplit($name);
unset($this->_loaded[$name]);
$this->_enabled = array_values(array_diff($this->_enabled, (array)$name));
}
}
/**
* Exceptions used by the ComponentCollection.

View file

@ -45,14 +45,6 @@ abstract class ObjectCollection {
*/
abstract public function load($name, $options = array(), $enable = true);
/**
* Unloads/deletes an object from the collection.
*
* @param string $name Name of the object to delete.
* @return void
*/
abstract public function unload($name);
/**
* 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
@ -176,6 +168,18 @@ abstract class ObjectCollection {
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($plugin, $name) = pluginSplit($name);
unset($this->_loaded[$name]);
$this->_enabled = array_values(array_diff($this->_enabled, (array)$name));
}
/**
* Normalizes an object array, creates an array that makes lazy loading
* easier

View file

@ -73,18 +73,6 @@ class HelperCollection extends ObjectCollection {
return $this->_loaded[$name];
}
/**
* Name of the helper to remove from the collection
*
* @param string $name Name of helper to delete.
* @return void
*/
public function unload($name) {
list($plugin, $name) = pluginSplit($name);
unset($this->_loaded[$name]);
$this->_enabled = array_values(array_diff($this->_enabled, (array)$name));
}
}
/**
* Exceptions used by the HelperCollection.

View file

@ -134,7 +134,7 @@ class HelperCollectionTest extends CakeTestCase {
$this->Helpers->TriggerMockForm->expects($this->once())->method('beforeRender')
->with('one', 'two');
$this->asserTrue($this->Helpers->trigger('beforeRender', array('one', 'two')));
$this->assertTrue($this->Helpers->trigger('beforeRender', array('one', 'two')));
}
/**
@ -157,7 +157,7 @@ class HelperCollectionTest extends CakeTestCase {
$this->Helpers->disable('TriggerMockForm');
$this->asserTrue($this->Helpers->trigger('beforeRender', array('one', 'two')));
$this->assertTrue($this->Helpers->trigger('beforeRender', array('one', 'two')));
}
/**