mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
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:
parent
426d35d66e
commit
19f008b1a4
4 changed files with 14 additions and 34 deletions
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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')));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue