Skip to content

Commit

Permalink
Add additional test coverage.
Browse files Browse the repository at this point in the history
Refs #5286
  • Loading branch information
markstory committed Dec 1, 2014
1 parent 3d7b9f9 commit 82b2058
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Core/ObjectRegistry.php
Expand Up @@ -122,11 +122,11 @@ protected function _checkDuplicate($name, $config) {

$fail = false;
foreach ($config as $key => $value) {
if (isset($existingConfig[$key]) && $existingConfig[$key] !== $value) {
if (!array_key_exists($key, $existingConfig)) {
$fail = true;
break;
}
if (!array_key_exists($key, $existingConfig)) {
if (isset($existingConfig[$key]) && $existingConfig[$key] !== $value) {
$fail = true;
break;
}
Expand Down
14 changes: 14 additions & 0 deletions tests/TestCase/View/HelperRegistryTest.php
Expand Up @@ -251,10 +251,23 @@ public function testLoadMultipleTimesAlreadyConfigured() {
$this->addToAssertionCount(1);
}

/**
* Loading a helper overriding defaults to default value
* should "just work"
*
* @return void
*/
public function testLoadMultipleTimesDefaultConfigValuesWorks() {
$this->Helpers->load('Number', ['engine' => 'Cake\I18n\Number']);
$this->Helpers->load('Number');
$this->addToAssertionCount(1);
}

/**
* Loading a helper with different config, should throw an exception
*
* @expectedException RuntimeException
* @expectedExceptionMessage The "Html" alias has already been loaded with the following
* @return void
*/
public function testLoadMultipleTimesDifferentConfigured() {
Expand All @@ -266,6 +279,7 @@ public function testLoadMultipleTimesDifferentConfigured() {
* Loading a helper with different config, should throw an exception
*
* @expectedException RuntimeException
* @expectedExceptionMessage The "Html" alias has already been loaded with the following
* @return void
*/
public function testLoadMultipleTimesDifferentConfigValues() {
Expand Down

0 comments on commit 82b2058

Please sign in to comment.