Skip to content

Commit

Permalink
Add missing tests for ComponentRegistry.
Browse files Browse the repository at this point in the history
A test for loading aliased components was missing.
  • Loading branch information
markstory committed Jul 27, 2013
1 parent 6de103b commit 12b7fc5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
22 changes: 19 additions & 3 deletions lib/Cake/Test/TestCase/Controller/ComponentRegistryTest.php
Expand Up @@ -129,9 +129,9 @@ public function testLoadMissingComponent() {
* @return void
*/
public function testLoadPluginComponent() {
App::build(array(
'Plugin' => array(CAKE . 'Test/TestApp/Plugin/'),
));
App::build([
'Plugin' => [CAKE . 'Test/TestApp/Plugin/'],
]);
Plugin::load('TestPlugin');
$result = $this->Components->load('TestPlugin.Other');
$this->assertInstanceOf('TestPlugin\Controller\Component\OtherComponent', $result, 'Component class is wrong.');
Expand All @@ -140,6 +140,22 @@ public function testLoadPluginComponent() {
Plugin::unload();
}

/**
* Test loading components with aliases and plugins.
*
* @return void
*/
public function testLoadWithAliasAndPlugin() {
App::build(['Plugin' => [CAKE . 'Test/TestApp/Plugin/']]);
Plugin::load('TestPlugin');
$result = $this->Components->load('AliasedOther', ['className' => 'TestPlugin.Other']);
$this->assertInstanceOf('TestPlugin\Controller\Component\OtherComponent', $result);
$this->assertInstanceOf('TestPlugin\Controller\Component\OtherComponent', $this->Components->AliasedOther);

$result = $this->Components->loaded();
$this->assertEquals(['AliasedOther'], $result, 'loaded() results are wrong.');
}

/**
* test getting the controller out of the collection
*
Expand Down
6 changes: 0 additions & 6 deletions lib/Cake/Test/TestCase/View/HelperRegistryTest.php
@@ -1,9 +1,5 @@
<?php
/**
* HelperRegistryTest file
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
Expand All @@ -13,7 +9,6 @@
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.View
* @since CakePHP(tm) v 2.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
Expand All @@ -39,7 +34,6 @@ public function afterRender($viewFile) {
/**
* Class HelperRegistryTest
*
* @package Cake.Test.Case.View
*/
class HelperRegistryTest extends TestCase {

Expand Down

0 comments on commit 12b7fc5

Please sign in to comment.